diff --git a/sdk/resourcemanager/cosmos/armcosmos/CHANGELOG.md b/sdk/resourcemanager/cosmos/armcosmos/CHANGELOG.md index 70bfc04ce132..0ffa82e0cbc8 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/CHANGELOG.md +++ b/sdk/resourcemanager/cosmos/armcosmos/CHANGELOG.md @@ -1,5 +1,53 @@ # Release History +## 0.6.0 (2022-04-25) +### Breaking Changes + +- Field `PercentageComplete` of struct `DataTransferJobProperties` has been removed + +### Features Added + +- New const `ThroughputPolicyTypeCustom` +- New const `ThroughputPolicyTypeEqual` +- New const `ThroughputPolicyTypeNone` +- New function `*MongoDBResourcesClient.BeginMongoDBContainerRedistributeThroughput(context.Context, string, string, string, string, RedistributeThroughputParameters, *MongoDBResourcesClientBeginMongoDBContainerRedistributeThroughputOptions) (*armruntime.Poller[MongoDBResourcesClientMongoDBContainerRedistributeThroughputResponse], error)` +- New function `RetrieveThroughputPropertiesResource.MarshalJSON() ([]byte, error)` +- New function `RedistributeThroughputParameters.MarshalJSON() ([]byte, error)` +- New function `PossibleThroughputPolicyTypeValues() []ThroughputPolicyType` +- New function `*SQLResourcesClient.BeginSQLContainerRetrieveThroughputDistribution(context.Context, string, string, string, string, RetrieveThroughputParameters, *SQLResourcesClientBeginSQLContainerRetrieveThroughputDistributionOptions) (*armruntime.Poller[SQLResourcesClientSQLContainerRetrieveThroughputDistributionResponse], error)` +- New function `RedistributeThroughputPropertiesResource.MarshalJSON() ([]byte, error)` +- New function `*MongoDBResourcesClient.BeginSQLContainerRetrieveThroughputDistribution(context.Context, string, string, string, string, RetrieveThroughputParameters, *MongoDBResourcesClientBeginSQLContainerRetrieveThroughputDistributionOptions) (*armruntime.Poller[MongoDBResourcesClientSQLContainerRetrieveThroughputDistributionResponse], error)` +- New function `*DataTransferJobsClient.Cancel(context.Context, string, string, string, *DataTransferJobsClientCancelOptions) (DataTransferJobsClientCancelResponse, error)` +- New function `*DataTransferJobsClient.Resume(context.Context, string, string, string, *DataTransferJobsClientResumeOptions) (DataTransferJobsClientResumeResponse, error)` +- New function `*DataTransferJobsClient.Pause(context.Context, string, string, string, *DataTransferJobsClientPauseOptions) (DataTransferJobsClientPauseResponse, error)` +- New function `RetrieveThroughputParameters.MarshalJSON() ([]byte, error)` +- New function `*SQLResourcesClient.BeginSQLContainerRedistributeThroughput(context.Context, string, string, string, string, RedistributeThroughputParameters, *SQLResourcesClientBeginSQLContainerRedistributeThroughputOptions) (*armruntime.Poller[SQLResourcesClientSQLContainerRedistributeThroughputResponse], error)` +- New struct `DataTransferJobsClientCancelOptions` +- New struct `DataTransferJobsClientCancelResponse` +- New struct `DataTransferJobsClientPauseOptions` +- New struct `DataTransferJobsClientPauseResponse` +- New struct `DataTransferJobsClientResumeOptions` +- New struct `DataTransferJobsClientResumeResponse` +- New struct `MongoDBResourcesClientBeginMongoDBContainerRedistributeThroughputOptions` +- New struct `MongoDBResourcesClientBeginSQLContainerRetrieveThroughputDistributionOptions` +- New struct `MongoDBResourcesClientMongoDBContainerRedistributeThroughputResponse` +- New struct `MongoDBResourcesClientSQLContainerRetrieveThroughputDistributionResponse` +- New struct `PhysicalPartitionID` +- New struct `PhysicalPartitionThroughputInfoResource` +- New struct `RedistributeThroughputParameters` +- New struct `RedistributeThroughputProperties` +- New struct `RedistributeThroughputPropertiesResource` +- New struct `RetrieveThroughputParameters` +- New struct `RetrieveThroughputProperties` +- New struct `RetrieveThroughputPropertiesResource` +- New struct `SQLResourcesClientBeginSQLContainerRedistributeThroughputOptions` +- New struct `SQLResourcesClientBeginSQLContainerRetrieveThroughputDistributionOptions` +- New struct `SQLResourcesClientSQLContainerRedistributeThroughputResponse` +- New struct `SQLResourcesClientSQLContainerRetrieveThroughputDistributionResponse` +- New field `TotalCount` in struct `DataTransferJobProperties` +- New field `ProcessedCount` in struct `DataTransferJobProperties` + + ## 0.5.0 (2022-04-15) ### Breaking Changes diff --git a/sdk/resourcemanager/cosmos/armcosmos/autorest.md b/sdk/resourcemanager/cosmos/armcosmos/autorest.md index c64a916ed885..0aa782a72086 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/autorest.md +++ b/sdk/resourcemanager/cosmos/armcosmos/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/cc26f1d28c939bbcde00a29aa8958b3eebb10cea/specification/cosmos-db/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/cc26f1d28c939bbcde00a29aa8958b3eebb10cea/specification/cosmos-db/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/cosmos-db/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/cosmos-db/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.5.0 +module-version: 0.6.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/cosmos/armcosmos/go.mod b/sdk/resourcemanager/cosmos/armcosmos/go.mod index a2558961aaf0..27dd03fa007b 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/go.mod +++ b/sdk/resourcemanager/cosmos/armcosmos/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect - golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect - golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect - golang.org/x/text v0.3.7 // indirect + golang.org/x/net v0.0.0-20210610132358-84b48f89b13b // indirect + golang.org/x/text v0.3.6 // indirect ) diff --git a/sdk/resourcemanager/cosmos/armcosmos/go.sum b/sdk/resourcemanager/cosmos/armcosmos/go.sum index 56d1c32628ae..a7eaa30576c1 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/go.sum +++ b/sdk/resourcemanager/cosmos/armcosmos/go.sum @@ -1,26 +1,11 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ= github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0/go.mod h1:w5pDIZuawUmY3Bj4tVx3Xb8KS96ToB0j315w9rqpAg0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 h1:NVS/4LOQfkBpk+B1VopIzv1ptmYeEskA8w/3K/w7vjo= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0/go.mod h1:RG0cZndeZM17StwohYclmcXSr4oOJ8b1I5hB8llIc6Y= github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo= github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -28,26 +13,20 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= -golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_cassandraclusters_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_cassandraclusters_client_test.go deleted file mode 100644 index 12b4d9eaffb0..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_cassandraclusters_client_test.go +++ /dev/null @@ -1,373 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraClustersClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraClustersClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraClustersClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraClustersClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "", - "", - &armcosmos.CassandraClustersClientBeginDeleteOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraClustersClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateUpdate(ctx, - "", - "", - armcosmos.ClusterResource{ - Location: to.Ptr(""), - Tags: map[string]*string{}, - Properties: &armcosmos.ClusterResourceProperties{ - AuthenticationMethod: to.Ptr(armcosmos.AuthenticationMethodCassandra), - CassandraVersion: to.Ptr(""), - ClientCertificates: []*armcosmos.Certificate{ - { - Pem: to.Ptr(""), - }}, - ClusterNameOverride: to.Ptr(""), - DelegatedManagementSubnetID: to.Ptr(""), - ExternalGossipCertificates: []*armcosmos.Certificate{ - { - Pem: to.Ptr(""), - }}, - ExternalSeedNodes: []*armcosmos.SeedNode{ - { - IPAddress: to.Ptr(""), - }, - { - IPAddress: to.Ptr(""), - }, - { - IPAddress: to.Ptr(""), - }}, - HoursBetweenBackups: to.Ptr[int32](24), - InitialCassandraAdminPassword: to.Ptr(""), - }, - }, - &armcosmos.CassandraClustersClientBeginCreateUpdateOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraClustersClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "", - "", - armcosmos.ClusterResource{ - Tags: map[string]*string{ - "owner": to.Ptr("mike"), - }, - Properties: &armcosmos.ClusterResourceProperties{ - AuthenticationMethod: to.Ptr(armcosmos.AuthenticationMethodNone), - ExternalGossipCertificates: []*armcosmos.Certificate{ - { - Pem: to.Ptr(""), - }}, - ExternalSeedNodes: []*armcosmos.SeedNode{ - { - IPAddress: to.Ptr(""), - }, - { - IPAddress: to.Ptr(""), - }, - { - IPAddress: to.Ptr(""), - }}, - HoursBetweenBackups: to.Ptr[int32](12), - }, - }, - &armcosmos.CassandraClustersClientBeginUpdateOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraClustersClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginInvokeCommand(ctx, - "", - "", - armcosmos.CommandPostBody{ - Arguments: map[string]*string{ - "status": to.Ptr(""), - }, - Command: to.Ptr(""), - Host: to.Ptr(""), - }, - &armcosmos.CassandraClustersClientBeginInvokeCommandOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraClustersClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBackupsPager("", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraClustersClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetBackup(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraClustersClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeallocate(ctx, - "", - "", - &armcosmos.CassandraClustersClientBeginDeallocateOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraClustersClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStart(ctx, - "", - "", - &armcosmos.CassandraClustersClientBeginStartOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraClustersClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Status(ctx, - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_cassandradatacenters_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_cassandradatacenters_client_test.go deleted file mode 100644 index d0f09ddde65a..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_cassandradatacenters_client_test.go +++ /dev/null @@ -1,165 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraDataCentersClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraDataCentersClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraDataCentersClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "", - "", - "", - &armcosmos.CassandraDataCentersClientBeginDeleteOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraDataCentersClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateUpdate(ctx, - "", - "", - "", - armcosmos.DataCenterResource{ - Properties: &armcosmos.DataCenterResourceProperties{ - Base64EncodedCassandraYamlFragment: to.Ptr(""), - DataCenterLocation: to.Ptr(""), - DelegatedSubnetID: to.Ptr(""), - NodeCount: to.Ptr[int32](9), - }, - }, - &armcosmos.CassandraDataCentersClientBeginCreateUpdateOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraDataCentersClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "", - "", - "", - armcosmos.DataCenterResource{ - Properties: &armcosmos.DataCenterResourceProperties{ - Base64EncodedCassandraYamlFragment: to.Ptr(""), - DataCenterLocation: to.Ptr(""), - DelegatedSubnetID: to.Ptr(""), - NodeCount: to.Ptr[int32](9), - }, - }, - &armcosmos.CassandraDataCentersClientBeginUpdateOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_cassandraresources_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_cassandraresources_client_test.go deleted file mode 100644 index 324c40af523a..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_cassandraresources_client_test.go +++ /dev/null @@ -1,728 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListCassandraKeyspacesPager("", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetCassandraKeyspace(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateUpdateCassandraKeyspace(ctx, - "", - "", - "", - armcosmos.CassandraKeyspaceCreateUpdateParameters{ - Location: to.Ptr(""), - Tags: map[string]*string{}, - Properties: &armcosmos.CassandraKeyspaceCreateUpdateProperties{ - Options: &armcosmos.CreateUpdateOptions{}, - Resource: &armcosmos.CassandraKeyspaceResource{ - ID: to.Ptr(""), - }, - }, - }, - &armcosmos.CassandraResourcesClientBeginCreateUpdateCassandraKeyspaceOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeleteCassandraKeyspace(ctx, - "", - "", - "", - &armcosmos.CassandraResourcesClientBeginDeleteCassandraKeyspaceOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetCassandraKeyspaceThroughput(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdateCassandraKeyspaceThroughput(ctx, - "", - "", - "", - armcosmos.ThroughputSettingsUpdateParameters{ - Location: to.Ptr(""), - Tags: map[string]*string{}, - Properties: &armcosmos.ThroughputSettingsUpdateProperties{ - Resource: &armcosmos.ThroughputSettingsResource{ - Throughput: to.Ptr[int32](400), - }, - }, - }, - &armcosmos.CassandraResourcesClientBeginUpdateCassandraKeyspaceThroughputOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginMigrateCassandraKeyspaceToAutoscale(ctx, - "", - "", - "", - &armcosmos.CassandraResourcesClientBeginMigrateCassandraKeyspaceToAutoscaleOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginMigrateCassandraKeyspaceToManualThroughput(ctx, - "", - "", - "", - &armcosmos.CassandraResourcesClientBeginMigrateCassandraKeyspaceToManualThroughputOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListCassandraTablesPager("", - "", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetCassandraTable(ctx, - "", - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateUpdateCassandraTable(ctx, - "", - "", - "", - "", - armcosmos.CassandraTableCreateUpdateParameters{ - Location: to.Ptr(""), - Tags: map[string]*string{}, - Properties: &armcosmos.CassandraTableCreateUpdateProperties{ - Options: &armcosmos.CreateUpdateOptions{}, - Resource: &armcosmos.CassandraTableResource{ - Schema: &armcosmos.CassandraSchema{ - ClusterKeys: []*armcosmos.ClusterKey{ - { - Name: to.Ptr(""), - OrderBy: to.Ptr(""), - }}, - Columns: []*armcosmos.Column{ - { - Name: to.Ptr(""), - Type: to.Ptr(""), - }}, - PartitionKeys: []*armcosmos.CassandraPartitionKey{ - { - Name: to.Ptr(""), - }}, - }, - AnalyticalStorageTTL: to.Ptr[int32](500), - DefaultTTL: to.Ptr[int32](100), - ID: to.Ptr(""), - }, - }, - }, - &armcosmos.CassandraResourcesClientBeginCreateUpdateCassandraTableOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeleteCassandraTable(ctx, - "", - "", - "", - "", - &armcosmos.CassandraResourcesClientBeginDeleteCassandraTableOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetCassandraTableThroughput(ctx, - "", - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdateCassandraTableThroughput(ctx, - "", - "", - "", - "", - armcosmos.ThroughputSettingsUpdateParameters{ - Location: to.Ptr(""), - Tags: map[string]*string{}, - Properties: &armcosmos.ThroughputSettingsUpdateProperties{ - Resource: &armcosmos.ThroughputSettingsResource{ - Throughput: to.Ptr[int32](400), - }, - }, - }, - &armcosmos.CassandraResourcesClientBeginUpdateCassandraTableThroughputOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginMigrateCassandraTableToAutoscale(ctx, - "", - "", - "", - "", - &armcosmos.CassandraResourcesClientBeginMigrateCassandraTableToAutoscaleOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginMigrateCassandraTableToManualThroughput(ctx, - "", - "", - "", - "", - &armcosmos.CassandraResourcesClientBeginMigrateCassandraTableToManualThroughputOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListCassandraViewsPager("", - "", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetCassandraView(ctx, - "", - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateUpdateCassandraView(ctx, - "", - "", - "", - "", - armcosmos.CassandraViewCreateUpdateParameters{ - Tags: map[string]*string{}, - Properties: &armcosmos.CassandraViewCreateUpdateProperties{ - Options: &armcosmos.CreateUpdateOptions{}, - Resource: &armcosmos.CassandraViewResource{ - ID: to.Ptr(""), - ViewDefinition: to.Ptr(""), - }, - }, - }, - &armcosmos.CassandraResourcesClientBeginCreateUpdateCassandraViewOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeleteCassandraView(ctx, - "", - "", - "", - "", - &armcosmos.CassandraResourcesClientBeginDeleteCassandraViewOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetCassandraViewThroughput(ctx, - "", - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdateCassandraViewThroughput(ctx, - "", - "", - "", - "", - armcosmos.ThroughputSettingsUpdateParameters{ - Tags: map[string]*string{}, - Properties: &armcosmos.ThroughputSettingsUpdateProperties{ - Resource: &armcosmos.ThroughputSettingsResource{ - Throughput: to.Ptr[int32](400), - }, - }, - }, - &armcosmos.CassandraResourcesClientBeginUpdateCassandraViewThroughputOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginMigrateCassandraViewToAutoscale(ctx, - "", - "", - "", - "", - &armcosmos.CassandraResourcesClientBeginMigrateCassandraViewToAutoscaleOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCassandraResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginMigrateCassandraViewToManualThroughput(ctx, - "", - "", - "", - "", - &armcosmos.CassandraResourcesClientBeginMigrateCassandraViewToManualThroughputOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_collection_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_collection_client_test.go deleted file mode 100644 index 0447da2b5886..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_collection_client_test.go +++ /dev/null @@ -1,106 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCollectionClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListMetricsPager("", - "", - "", - "", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCollectionClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListUsagesPager("", - "", - "", - "", - &armcosmos.CollectionClientListUsagesOptions{Filter: to.Ptr("")}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCollectionClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListMetricDefinitionsPager("", - "", - "", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_collectionpartition_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_collectionpartition_client_test.go deleted file mode 100644 index f57b770a90ae..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_collectionpartition_client_test.go +++ /dev/null @@ -1,77 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCollectionPartitionClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListMetricsPager("", - "", - "", - "", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCollectionPartitionClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListUsagesPager("", - "", - "", - "", - &armcosmos.CollectionPartitionClientListUsagesOptions{Filter: to.Ptr("")}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_collectionpartitionregion_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_collectionpartitionregion_client_test.go deleted file mode 100644 index 574dc8c1cdf1..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_collectionpartitionregion_client_test.go +++ /dev/null @@ -1,48 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCollectionPartitionRegionClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListMetricsPager("", - "", - "", - "", - "", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_collectionregion_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_collectionregion_client_test.go deleted file mode 100644 index 9a3316f4cc02..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_collectionregion_client_test.go +++ /dev/null @@ -1,48 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewCollectionRegionClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListMetricsPager("", - "", - "", - "", - "", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_database_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_database_client_test.go deleted file mode 100644 index 32820b1e53f6..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_database_client_test.go +++ /dev/null @@ -1,103 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewDatabaseClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListMetricsPager("", - "", - "", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewDatabaseClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListUsagesPager("", - "", - "", - &armcosmos.DatabaseClientListUsagesOptions{Filter: to.Ptr("")}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewDatabaseClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListMetricDefinitionsPager("", - "", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_databaseaccountregion_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_databaseaccountregion_client_test.go deleted file mode 100644 index 119e1504f688..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_databaseaccountregion_client_test.go +++ /dev/null @@ -1,46 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewDatabaseAccountRegionClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListMetricsPager("", - "", - "", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_databaseaccounts_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_databaseaccounts_client_test.go deleted file mode 100644 index 27249ca3f647..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_databaseaccounts_client_test.go +++ /dev/null @@ -1,599 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewDatabaseAccountsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewDatabaseAccountsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "", - "", - 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(""), - 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(""), - DiagnosticLogSettings: &armcosmos.DiagnosticLogSettings{ - EnableFullTextQuery: to.Ptr(armcosmos.EnableFullTextQueryTrue), - }, - EnableAnalyticalStorage: to.Ptr(true), - EnableFreeTier: to.Ptr(false), - IPRules: []*armcosmos.IPAddressOrRange{ - { - IPAddressOrRange: to.Ptr(""), - }, - { - IPAddressOrRange: to.Ptr(""), - }}, - IsVirtualNetworkFilterEnabled: to.Ptr(true), - NetworkACLBypass: to.Ptr(armcosmos.NetworkACLBypassAzureServices), - NetworkACLBypassResourceIDs: []*string{ - to.Ptr("/subscriptions/subId/resourcegroups/rgName/providers/Microsoft.Synapse/workspaces/workspaceName")}, - VirtualNetworkRules: []*armcosmos.VirtualNetworkRule{ - { - ID: to.Ptr(""), - IgnoreMissingVNetServiceEndpoint: to.Ptr(false), - }}, - }, - Tags: map[string]*string{ - "dept": to.Ptr("finance"), - }, - }, - &armcosmos.DatabaseAccountsClientBeginUpdateOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-15-preview/examples/CosmosDBDatabaseAccountCreateMax.json -func ExampleDatabaseAccountsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcosmos.NewDatabaseAccountsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "", - "", - 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(""), - 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(""), - }}, - CreateMode: to.Ptr(armcosmos.CreateModeDefault), - DatabaseAccountOfferType: to.Ptr(""), - DefaultIdentity: to.Ptr(""), - EnableAnalyticalStorage: to.Ptr(true), - EnableFreeTier: to.Ptr(false), - EnableMaterializedViews: to.Ptr(false), - IPRules: []*armcosmos.IPAddressOrRange{ - { - IPAddressOrRange: to.Ptr(""), - }, - { - IPAddressOrRange: to.Ptr(""), - }}, - IsVirtualNetworkFilterEnabled: to.Ptr(true), - KeyVaultKeyURI: to.Ptr(""), - Locations: []*armcosmos.Location{ - { - FailoverPriority: to.Ptr[int32](0), - IsZoneRedundant: to.Ptr(false), - LocationName: to.Ptr(""), - }, - { - FailoverPriority: to.Ptr[int32](1), - IsZoneRedundant: to.Ptr(false), - LocationName: to.Ptr(""), - }}, - 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(""), - IgnoreMissingVNetServiceEndpoint: to.Ptr(false), - }}, - }, - }, - &armcosmos.DatabaseAccountsClientBeginCreateOrUpdateOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewDatabaseAccountsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "", - "", - &armcosmos.DatabaseAccountsClientBeginDeleteOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewDatabaseAccountsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginFailoverPriorityChange(ctx, - "", - "", - armcosmos.FailoverPolicies{ - FailoverPolicies: []*armcosmos.FailoverPolicy{ - { - FailoverPriority: to.Ptr[int32](0), - LocationName: to.Ptr(""), - }, - { - FailoverPriority: to.Ptr[int32](1), - LocationName: to.Ptr(""), - }}, - }, - &armcosmos.DatabaseAccountsClientBeginFailoverPriorityChangeOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewDatabaseAccountsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewDatabaseAccountsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewDatabaseAccountsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListKeys(ctx, - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-15-preview/examples/CosmosDBDatabaseAccountListConnectionStrings.json -func ExampleDatabaseAccountsClient_ListConnectionStrings() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcosmos.NewDatabaseAccountsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListConnectionStrings(ctx, - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewDatabaseAccountsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginOfflineRegion(ctx, - "", - "", - armcosmos.RegionForOnlineOffline{}, - &armcosmos.DatabaseAccountsClientBeginOfflineRegionOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewDatabaseAccountsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginOnlineRegion(ctx, - "", - "", - armcosmos.RegionForOnlineOffline{}, - &armcosmos.DatabaseAccountsClientBeginOnlineRegionOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewDatabaseAccountsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetReadOnlyKeys(ctx, - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-15-preview/examples/CosmosDBDatabaseAccountListReadOnlyKeys.json -func ExampleDatabaseAccountsClient_ListReadOnlyKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcosmos.NewDatabaseAccountsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListReadOnlyKeys(ctx, - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewDatabaseAccountsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRegenerateKey(ctx, - "", - "", - armcosmos.DatabaseAccountRegenerateKeyParameters{ - KeyKind: to.Ptr(armcosmos.KeyKindPrimary), - }, - &armcosmos.DatabaseAccountsClientBeginRegenerateKeyOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewDatabaseAccountsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.CheckNameExists(ctx, - "", - 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/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewDatabaseAccountsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListMetricsPager("", - "", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewDatabaseAccountsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListUsagesPager("", - "", - &armcosmos.DatabaseAccountsClientListUsagesOptions{Filter: to.Ptr("")}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewDatabaseAccountsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListMetricDefinitionsPager("", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_datatransferjobs_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_datatransferjobs_client_test.go deleted file mode 100644 index 3a10dc4ac9bb..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_datatransferjobs_client_test.go +++ /dev/null @@ -1,103 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewDataTransferJobsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Create(ctx, - "", - "", - "", - armcosmos.CreateJobRequest{ - Properties: &armcosmos.DataTransferJobProperties{ - Destination: &armcosmos.AzureBlobDataTransferDataSourceSink{ - Component: to.Ptr(armcosmos.DataTransferComponentAzureBlobStorage), - ContainerName: to.Ptr(""), - EndpointURL: to.Ptr(""), - }, - Source: &armcosmos.CassandraDataTransferDataSourceSink{ - Component: to.Ptr(armcosmos.DataTransferComponentCosmosDBCassandra), - KeyspaceName: to.Ptr(""), - TableName: to.Ptr(""), - }, - }, - }, - 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/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewDataTransferJobsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewDataTransferJobsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByDatabaseAccountPager("", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_graphresources_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_graphresources_client_test.go deleted file mode 100644 index f0e4a16906da..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_graphresources_client_test.go +++ /dev/null @@ -1,132 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewGraphResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListGraphsPager("", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewGraphResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetGraph(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewGraphResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateUpdateGraph(ctx, - "", - "", - "", - armcosmos.GraphResourceCreateUpdateParameters{ - Location: to.Ptr(""), - Tags: map[string]*string{}, - Properties: &armcosmos.GraphResourceCreateUpdateProperties{ - Options: &armcosmos.CreateUpdateOptions{}, - Resource: &armcosmos.GraphResource{ - ID: to.Ptr(""), - }, - }, - }, - &armcosmos.GraphResourcesClientBeginCreateUpdateGraphOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewGraphResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeleteGraphResource(ctx, - "", - "", - "", - &armcosmos.GraphResourcesClientBeginDeleteGraphResourceOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_gremlinresources_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_gremlinresources_client_test.go deleted file mode 100644 index 3e2396c8d896..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_gremlinresources_client_test.go +++ /dev/null @@ -1,546 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewGremlinResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListGremlinDatabasesPager("", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewGremlinResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetGremlinDatabase(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewGremlinResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateUpdateGremlinDatabase(ctx, - "", - "", - "", - armcosmos.GremlinDatabaseCreateUpdateParameters{ - Location: to.Ptr(""), - Tags: map[string]*string{}, - Properties: &armcosmos.GremlinDatabaseCreateUpdateProperties{ - Options: &armcosmos.CreateUpdateOptions{}, - Resource: &armcosmos.GremlinDatabaseResource{ - ID: to.Ptr(""), - }, - }, - }, - &armcosmos.GremlinResourcesClientBeginCreateUpdateGremlinDatabaseOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewGremlinResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeleteGremlinDatabase(ctx, - "", - "", - "", - &armcosmos.GremlinResourcesClientBeginDeleteGremlinDatabaseOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewGremlinResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetGremlinDatabaseThroughput(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewGremlinResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdateGremlinDatabaseThroughput(ctx, - "", - "", - "", - armcosmos.ThroughputSettingsUpdateParameters{ - Location: to.Ptr(""), - Tags: map[string]*string{}, - Properties: &armcosmos.ThroughputSettingsUpdateProperties{ - Resource: &armcosmos.ThroughputSettingsResource{ - Throughput: to.Ptr[int32](400), - }, - }, - }, - &armcosmos.GremlinResourcesClientBeginUpdateGremlinDatabaseThroughputOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewGremlinResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginMigrateGremlinDatabaseToAutoscale(ctx, - "", - "", - "", - &armcosmos.GremlinResourcesClientBeginMigrateGremlinDatabaseToAutoscaleOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewGremlinResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginMigrateGremlinDatabaseToManualThroughput(ctx, - "", - "", - "", - &armcosmos.GremlinResourcesClientBeginMigrateGremlinDatabaseToManualThroughputOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewGremlinResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListGremlinGraphsPager("", - "", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewGremlinResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetGremlinGraph(ctx, - "", - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewGremlinResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateUpdateGremlinGraph(ctx, - "", - "", - "", - "", - armcosmos.GremlinGraphCreateUpdateParameters{ - Location: to.Ptr(""), - Tags: map[string]*string{}, - Properties: &armcosmos.GremlinGraphCreateUpdateProperties{ - Options: &armcosmos.CreateUpdateOptions{}, - Resource: &armcosmos.GremlinGraphResource{ - ConflictResolutionPolicy: &armcosmos.ConflictResolutionPolicy{ - ConflictResolutionPath: to.Ptr(""), - Mode: to.Ptr(armcosmos.ConflictResolutionModeLastWriterWins), - }, - DefaultTTL: to.Ptr[int32](100), - ID: to.Ptr(""), - 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")}, - }}, - }, - }, - }, - }, - &armcosmos.GremlinResourcesClientBeginCreateUpdateGremlinGraphOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewGremlinResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeleteGremlinGraph(ctx, - "", - "", - "", - "", - &armcosmos.GremlinResourcesClientBeginDeleteGremlinGraphOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewGremlinResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetGremlinGraphThroughput(ctx, - "", - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewGremlinResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdateGremlinGraphThroughput(ctx, - "", - "", - "", - "", - armcosmos.ThroughputSettingsUpdateParameters{ - Location: to.Ptr(""), - Tags: map[string]*string{}, - Properties: &armcosmos.ThroughputSettingsUpdateProperties{ - Resource: &armcosmos.ThroughputSettingsResource{ - Throughput: to.Ptr[int32](400), - }, - }, - }, - &armcosmos.GremlinResourcesClientBeginUpdateGremlinGraphThroughputOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewGremlinResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginMigrateGremlinGraphToAutoscale(ctx, - "", - "", - "", - "", - &armcosmos.GremlinResourcesClientBeginMigrateGremlinGraphToAutoscaleOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewGremlinResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginMigrateGremlinGraphToManualThroughput(ctx, - "", - "", - "", - "", - &armcosmos.GremlinResourcesClientBeginMigrateGremlinGraphToManualThroughputOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewGremlinResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRetrieveContinuousBackupInformation(ctx, - "", - "", - "", - "", - armcosmos.ContinuousBackupRestoreLocation{ - Location: to.Ptr(""), - }, - &armcosmos.GremlinResourcesClientBeginRetrieveContinuousBackupInformationOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_locations_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_locations_client_test.go deleted file mode 100644 index 7f34f7e8fd9e..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_locations_client_test.go +++ /dev/null @@ -1,63 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewLocationsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewLocationsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_mongodbresources_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_mongodbresources_client_test.go deleted file mode 100644 index 22f8e13c3bfd..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_mongodbresources_client_test.go +++ /dev/null @@ -1,800 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListMongoDBDatabasesPager("", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetMongoDBDatabase(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-15-preview/examples/CosmosDBMongoDBDatabaseCreateUpdate.json -func ExampleMongoDBResourcesClient_BeginCreateUpdateMongoDBDatabase() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateUpdateMongoDBDatabase(ctx, - "", - "", - "", - armcosmos.MongoDBDatabaseCreateUpdateParameters{ - Location: to.Ptr(""), - Tags: map[string]*string{}, - Properties: &armcosmos.MongoDBDatabaseCreateUpdateProperties{ - Options: &armcosmos.CreateUpdateOptions{}, - Resource: &armcosmos.MongoDBDatabaseResource{ - ID: to.Ptr(""), - }, - }, - }, - &armcosmos.MongoDBResourcesClientBeginCreateUpdateMongoDBDatabaseOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeleteMongoDBDatabase(ctx, - "", - "", - "", - &armcosmos.MongoDBResourcesClientBeginDeleteMongoDBDatabaseOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetMongoDBDatabaseThroughput(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdateMongoDBDatabaseThroughput(ctx, - "", - "", - "", - armcosmos.ThroughputSettingsUpdateParameters{ - Location: to.Ptr(""), - Tags: map[string]*string{}, - Properties: &armcosmos.ThroughputSettingsUpdateProperties{ - Resource: &armcosmos.ThroughputSettingsResource{ - Throughput: to.Ptr[int32](400), - }, - }, - }, - &armcosmos.MongoDBResourcesClientBeginUpdateMongoDBDatabaseThroughputOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginMigrateMongoDBDatabaseToAutoscale(ctx, - "", - "", - "", - &armcosmos.MongoDBResourcesClientBeginMigrateMongoDBDatabaseToAutoscaleOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginMigrateMongoDBDatabaseToManualThroughput(ctx, - "", - "", - "", - &armcosmos.MongoDBResourcesClientBeginMigrateMongoDBDatabaseToManualThroughputOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListMongoDBCollectionsPager("", - "", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetMongoDBCollection(ctx, - "", - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-15-preview/examples/CosmosDBMongoDBCollectionCreateUpdate.json -func ExampleMongoDBResourcesClient_BeginCreateUpdateMongoDBCollection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateUpdateMongoDBCollection(ctx, - "", - "", - "", - "", - armcosmos.MongoDBCollectionCreateUpdateParameters{ - Location: to.Ptr(""), - Tags: map[string]*string{}, - Properties: &armcosmos.MongoDBCollectionCreateUpdateProperties{ - Options: &armcosmos.CreateUpdateOptions{}, - Resource: &armcosmos.MongoDBCollectionResource{ - AnalyticalStorageTTL: to.Ptr[int32](500), - ID: to.Ptr(""), - 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"), - }, - }, - }, - }, - &armcosmos.MongoDBResourcesClientBeginCreateUpdateMongoDBCollectionOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeleteMongoDBCollection(ctx, - "", - "", - "", - "", - &armcosmos.MongoDBResourcesClientBeginDeleteMongoDBCollectionOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginListMongoDBCollectionPartitionMerge(ctx, - "", - "", - "", - "", - armcosmos.MergeParameters{ - IsDryRun: to.Ptr(false), - }, - &armcosmos.MongoDBResourcesClientBeginListMongoDBCollectionPartitionMergeOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetMongoDBCollectionThroughput(ctx, - "", - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdateMongoDBCollectionThroughput(ctx, - "", - "", - "", - "", - armcosmos.ThroughputSettingsUpdateParameters{ - Location: to.Ptr(""), - Tags: map[string]*string{}, - Properties: &armcosmos.ThroughputSettingsUpdateProperties{ - Resource: &armcosmos.ThroughputSettingsResource{ - Throughput: to.Ptr[int32](400), - }, - }, - }, - &armcosmos.MongoDBResourcesClientBeginUpdateMongoDBCollectionThroughputOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginMigrateMongoDBCollectionToAutoscale(ctx, - "", - "", - "", - "", - &armcosmos.MongoDBResourcesClientBeginMigrateMongoDBCollectionToAutoscaleOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginMigrateMongoDBCollectionToManualThroughput(ctx, - "", - "", - "", - "", - &armcosmos.MongoDBResourcesClientBeginMigrateMongoDBCollectionToManualThroughputOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetMongoRoleDefinition(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateUpdateMongoRoleDefinition(ctx, - "", - "", - "", - armcosmos.MongoRoleDefinitionCreateUpdateParameters{ - Properties: &armcosmos.MongoRoleDefinitionResource{ - DatabaseName: to.Ptr(""), - Privileges: []*armcosmos.Privilege{ - { - Actions: []*string{ - to.Ptr("insert"), - to.Ptr("find")}, - Resource: &armcosmos.PrivilegeResource{ - Collection: to.Ptr(""), - Db: to.Ptr(""), - }, - }}, - RoleName: to.Ptr(""), - Roles: []*armcosmos.Role{ - { - Db: to.Ptr(""), - Role: to.Ptr(""), - }}, - }, - }, - &armcosmos.MongoDBResourcesClientBeginCreateUpdateMongoRoleDefinitionOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeleteMongoRoleDefinition(ctx, - "", - "", - "", - &armcosmos.MongoDBResourcesClientBeginDeleteMongoRoleDefinitionOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListMongoRoleDefinitionsPager("", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetMongoUserDefinition(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateUpdateMongoUserDefinition(ctx, - "", - "", - "", - armcosmos.MongoUserDefinitionCreateUpdateParameters{ - Properties: &armcosmos.MongoUserDefinitionResource{ - CustomData: to.Ptr(""), - DatabaseName: to.Ptr(""), - Mechanisms: to.Ptr(""), - Password: to.Ptr(""), - Roles: []*armcosmos.Role{ - { - Db: to.Ptr(""), - Role: to.Ptr(""), - }}, - UserName: to.Ptr(""), - }, - }, - &armcosmos.MongoDBResourcesClientBeginCreateUpdateMongoUserDefinitionOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeleteMongoUserDefinition(ctx, - "", - "", - "", - &armcosmos.MongoDBResourcesClientBeginDeleteMongoUserDefinitionOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListMongoUserDefinitionsPager("", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewMongoDBResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRetrieveContinuousBackupInformation(ctx, - "", - "", - "", - "", - armcosmos.ContinuousBackupRestoreLocation{ - Location: to.Ptr(""), - }, - &armcosmos.MongoDBResourcesClientBeginRetrieveContinuousBackupInformationOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_notebookworkspaces_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_notebookworkspaces_client_test.go deleted file mode 100644 index 5e5883d6a06f..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_notebookworkspaces_client_test.go +++ /dev/null @@ -1,195 +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. - -package armcosmos_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewNotebookWorkspacesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByDatabaseAccountPager("", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewNotebookWorkspacesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "", - "", - armcosmos.NotebookWorkspaceNameDefault, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewNotebookWorkspacesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "", - "", - armcosmos.NotebookWorkspaceNameDefault, - armcosmos.NotebookWorkspaceCreateUpdateParameters{}, - &armcosmos.NotebookWorkspacesClientBeginCreateOrUpdateOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewNotebookWorkspacesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "", - "", - armcosmos.NotebookWorkspaceNameDefault, - &armcosmos.NotebookWorkspacesClientBeginDeleteOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewNotebookWorkspacesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListConnectionInfo(ctx, - "", - "", - armcosmos.NotebookWorkspaceNameDefault, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewNotebookWorkspacesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRegenerateAuthToken(ctx, - "", - "", - armcosmos.NotebookWorkspaceNameDefault, - &armcosmos.NotebookWorkspacesClientBeginRegenerateAuthTokenOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewNotebookWorkspacesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStart(ctx, - "", - "", - armcosmos.NotebookWorkspaceNameDefault, - &armcosmos.NotebookWorkspacesClientBeginStartOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_operations_client_test.go deleted file mode 100644 index b5f30409a3fb..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_operations_client_test.go +++ /dev/null @@ -1,42 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_partitionkeyrangeid_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_partitionkeyrangeid_client_test.go deleted file mode 100644 index 23b40bc2cf0c..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_partitionkeyrangeid_client_test.go +++ /dev/null @@ -1,48 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewPartitionKeyRangeIDClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListMetricsPager("", - "", - "", - "", - "", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_partitionkeyrangeidregion_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_partitionkeyrangeidregion_client_test.go deleted file mode 100644 index 655364ff596f..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_partitionkeyrangeidregion_client_test.go +++ /dev/null @@ -1,49 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewPartitionKeyRangeIDRegionClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListMetricsPager("", - "", - "", - "", - "", - "", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_percentile_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_percentile_client_test.go deleted file mode 100644 index 63cc11c5bba6..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_percentile_client_test.go +++ /dev/null @@ -1,45 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewPercentileClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListMetricsPager("", - "", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_percentilesourcetarget_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_percentilesourcetarget_client_test.go deleted file mode 100644 index 1cd0c9d91064..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_percentilesourcetarget_client_test.go +++ /dev/null @@ -1,47 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewPercentileSourceTargetClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListMetricsPager("", - "", - "", - "", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_percentiletarget_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_percentiletarget_client_test.go deleted file mode 100644 index 1acf495dfc2a..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_percentiletarget_client_test.go +++ /dev/null @@ -1,46 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewPercentileTargetClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListMetricsPager("", - "", - "", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_privateendpointconnections_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_privateendpointconnections_client_test.go deleted file mode 100644 index 8a2808494c39..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_privateendpointconnections_client_test.go +++ /dev/null @@ -1,130 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewPrivateEndpointConnectionsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByDatabaseAccountPager("", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewPrivateEndpointConnectionsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewPrivateEndpointConnectionsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "", - "", - "", - armcosmos.PrivateEndpointConnection{ - Properties: &armcosmos.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armcosmos.PrivateLinkServiceConnectionStateProperty{ - Description: to.Ptr(""), - Status: to.Ptr(""), - }, - }, - }, - &armcosmos.PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewPrivateEndpointConnectionsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "", - "", - "", - &armcosmos.PrivateEndpointConnectionsClientBeginDeleteOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_privatelinkresources_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_privatelinkresources_client_test.go deleted file mode 100644 index 1dbc1e10ca5f..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_privatelinkresources_client_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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewPrivateLinkResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByDatabaseAccountPager("", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewPrivateLinkResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorabledatabaseaccounts_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorabledatabaseaccounts_client_test.go deleted file mode 100644 index c073d5886f8e..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorabledatabaseaccounts_client_test.go +++ /dev/null @@ -1,90 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewRestorableDatabaseAccountsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByLocationPager("", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewRestorableDatabaseAccountsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewRestorableDatabaseAccountsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetByLocation(ctx, - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablegremlindatabases_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablegremlindatabases_client_test.go deleted file mode 100644 index a6e3e2045669..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablegremlindatabases_client_test.go +++ /dev/null @@ -1,44 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewRestorableGremlinDatabasesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablegremlingraphs_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablegremlingraphs_client_test.go deleted file mode 100644 index 648017e9d2b8..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablegremlingraphs_client_test.go +++ /dev/null @@ -1,48 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewRestorableGremlinGraphsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("", - "", - &armcosmos.RestorableGremlinGraphsClientListOptions{RestorableGremlinDatabaseRid: to.Ptr(""), - StartTime: nil, - EndTime: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablegremlinresources_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablegremlinresources_client_test.go deleted file mode 100644 index 9db02cd9a484..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablegremlinresources_client_test.go +++ /dev/null @@ -1,47 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewRestorableGremlinResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("", - "", - &armcosmos.RestorableGremlinResourcesClientListOptions{RestoreLocation: to.Ptr(""), - RestoreTimestampInUTC: to.Ptr(""), - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablemongodbcollections_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablemongodbcollections_client_test.go deleted file mode 100644 index 4b9b62466c5a..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablemongodbcollections_client_test.go +++ /dev/null @@ -1,48 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewRestorableMongodbCollectionsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("", - "", - &armcosmos.RestorableMongodbCollectionsClientListOptions{RestorableMongodbDatabaseRid: to.Ptr(""), - StartTime: nil, - EndTime: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablemongodbdatabases_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablemongodbdatabases_client_test.go deleted file mode 100644 index 69c7452bc189..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablemongodbdatabases_client_test.go +++ /dev/null @@ -1,44 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewRestorableMongodbDatabasesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablemongodbresources_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablemongodbresources_client_test.go deleted file mode 100644 index 76fa880709ae..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablemongodbresources_client_test.go +++ /dev/null @@ -1,47 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewRestorableMongodbResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("", - "", - &armcosmos.RestorableMongodbResourcesClientListOptions{RestoreLocation: to.Ptr(""), - RestoreTimestampInUTC: to.Ptr(""), - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablesqlcontainers_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablesqlcontainers_client_test.go deleted file mode 100644 index d71752f61ba6..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablesqlcontainers_client_test.go +++ /dev/null @@ -1,48 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewRestorableSQLContainersClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("", - "", - &armcosmos.RestorableSQLContainersClientListOptions{RestorableSQLDatabaseRid: to.Ptr(""), - StartTime: nil, - EndTime: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablesqldatabases_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablesqldatabases_client_test.go deleted file mode 100644 index d2ac5f54b1d1..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablesqldatabases_client_test.go +++ /dev/null @@ -1,44 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewRestorableSQLDatabasesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablesqlresources_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablesqlresources_client_test.go deleted file mode 100644 index eb94e9b47de9..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorablesqlresources_client_test.go +++ /dev/null @@ -1,47 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewRestorableSQLResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("", - "", - &armcosmos.RestorableSQLResourcesClientListOptions{RestoreLocation: to.Ptr(""), - RestoreTimestampInUTC: to.Ptr(""), - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorabletableresources_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorabletableresources_client_test.go deleted file mode 100644 index 4adf744a5c51..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorabletableresources_client_test.go +++ /dev/null @@ -1,47 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewRestorableTableResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("", - "", - &armcosmos.RestorableTableResourcesClientListOptions{RestoreLocation: to.Ptr(""), - RestoreTimestampInUTC: to.Ptr(""), - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorabletables_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorabletables_client_test.go deleted file mode 100644 index a07ac1037e5e..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_restorabletables_client_test.go +++ /dev/null @@ -1,46 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewRestorableTablesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("", - "", - &armcosmos.RestorableTablesClientListOptions{StartTime: nil, - EndTime: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_service_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_service_client_test.go deleted file mode 100644 index bee2bd291345..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_service_client_test.go +++ /dev/null @@ -1,129 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewServiceClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-15-preview/examples/CosmosDBDataTransferServiceCreate.json -func ExampleServiceClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcosmos.NewServiceClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "", - "", - "", - armcosmos.ServiceResourceCreateUpdateParameters{ - Properties: &armcosmos.ServiceResourceCreateUpdateProperties{ - InstanceCount: to.Ptr[int32](1), - InstanceSize: to.Ptr(armcosmos.ServiceSizeCosmosD4S), - ServiceType: to.Ptr(armcosmos.ServiceTypeDataTransfer), - }, - }, - &armcosmos.ServiceClientBeginCreateOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-15-preview/examples/CosmosDBDataTransferServiceGet.json -func ExampleServiceClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcosmos.NewServiceClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-15-preview/examples/CosmosDBDataTransferServiceDelete.json -func ExampleServiceClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcosmos.NewServiceClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "", - "", - "", - &armcosmos.ServiceClientBeginDeleteOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_sqlresources_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_sqlresources_client_test.go deleted file mode 100644 index 4b7894e57706..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_sqlresources_client_test.go +++ /dev/null @@ -1,146 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewSQLResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListClientEncryptionKeysPager("", - "", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewSQLResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetClientEncryptionKey(ctx, - "", - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewSQLResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateUpdateClientEncryptionKey(ctx, - "", - "", - "", - "", - armcosmos.ClientEncryptionKeyCreateUpdateParameters{ - Properties: &armcosmos.ClientEncryptionKeyCreateUpdateProperties{ - Resource: &armcosmos.ClientEncryptionKeyResource{ - EncryptionAlgorithm: to.Ptr(""), - ID: to.Ptr(""), - KeyWrapMetadata: &armcosmos.KeyWrapMetadata{ - Name: to.Ptr(""), - Type: to.Ptr(""), - Algorithm: to.Ptr(""), - Value: to.Ptr(""), - }, - WrappedDataEncryptionKey: []byte("This is actually an array of bytes. This request/response is being presented as a string for readability in the example"), - }, - }, - }, - &armcosmos.SQLResourcesClientBeginCreateUpdateClientEncryptionKeyOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewSQLResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRetrieveContinuousBackupInformation(ctx, - "", - "", - "", - "", - armcosmos.ContinuousBackupRestoreLocation{ - Location: to.Ptr(""), - }, - &armcosmos.SQLResourcesClientBeginRetrieveContinuousBackupInformationOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_tableresources_client_test.go b/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_tableresources_client_test.go deleted file mode 100644 index 9a3f8382137d..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/ze_generated_example_tableresources_client_test.go +++ /dev/null @@ -1,275 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewTableResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListTablesPager("", - "", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewTableResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetTable(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewTableResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateUpdateTable(ctx, - "", - "", - "", - armcosmos.TableCreateUpdateParameters{ - Location: to.Ptr(""), - Tags: map[string]*string{}, - Properties: &armcosmos.TableCreateUpdateProperties{ - Options: &armcosmos.CreateUpdateOptions{}, - Resource: &armcosmos.TableResource{ - ID: to.Ptr(""), - }, - }, - }, - &armcosmos.TableResourcesClientBeginCreateUpdateTableOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewTableResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeleteTable(ctx, - "", - "", - "", - &armcosmos.TableResourcesClientBeginDeleteTableOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewTableResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetTableThroughput(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewTableResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdateTableThroughput(ctx, - "", - "", - "", - armcosmos.ThroughputSettingsUpdateParameters{ - Location: to.Ptr(""), - Tags: map[string]*string{}, - Properties: &armcosmos.ThroughputSettingsUpdateProperties{ - Resource: &armcosmos.ThroughputSettingsResource{ - Throughput: to.Ptr[int32](400), - }, - }, - }, - &armcosmos.TableResourcesClientBeginUpdateTableThroughputOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewTableResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginMigrateTableToAutoscale(ctx, - "", - "", - "", - &armcosmos.TableResourcesClientBeginMigrateTableToAutoscaleOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewTableResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginMigrateTableToManualThroughput(ctx, - "", - "", - "", - &armcosmos.TableResourcesClientBeginMigrateTableToManualThroughputOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2022-02-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() - client, err := armcosmos.NewTableResourcesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRetrieveContinuousBackupInformation(ctx, - "", - "", - "", - armcosmos.ContinuousBackupRestoreLocation{ - Location: to.Ptr(""), - }, - &armcosmos.TableResourcesClientBeginRetrieveContinuousBackupInformationOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_constants.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_constants.go index b1fd7443ac22..a7a0c6154341 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_constants.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_constants.go @@ -10,7 +10,7 @@ package armcosmos const ( moduleName = "armcosmos" - moduleVersion = "v0.5.0" + moduleVersion = "v0.6.0" ) // APIType - Enum to indicate the API type of the restorable database account. @@ -760,6 +760,24 @@ func PossibleSpatialTypeValues() []SpatialType { } } +// ThroughputPolicyType - ThroughputPolicy to apply for throughput redistribution +type ThroughputPolicyType string + +const ( + ThroughputPolicyTypeCustom ThroughputPolicyType = "custom" + ThroughputPolicyTypeEqual ThroughputPolicyType = "equal" + ThroughputPolicyTypeNone ThroughputPolicyType = "none" +) + +// PossibleThroughputPolicyTypeValues returns the possible values for the ThroughputPolicyType const type. +func PossibleThroughputPolicyTypeValues() []ThroughputPolicyType { + return []ThroughputPolicyType{ + ThroughputPolicyTypeCustom, + ThroughputPolicyTypeEqual, + ThroughputPolicyTypeNone, + } +} + // TriggerOperation - The operation the trigger is associated with type TriggerOperation string diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_datatransferjobs_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_datatransferjobs_client.go index 94e8724aea34..23b752726c96 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_datatransferjobs_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_datatransferjobs_client.go @@ -54,6 +54,66 @@ func NewDataTransferJobsClient(subscriptionID string, credential azcore.TokenCre return client, nil } +// Cancel - Cancels a Data Transfer Job. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// accountName - Cosmos DB database account name. +// jobName - Name of the Data Transfer Job +// options - DataTransferJobsClientCancelOptions contains the optional parameters for the DataTransferJobsClient.Cancel method. +func (client *DataTransferJobsClient) Cancel(ctx context.Context, resourceGroupName string, accountName string, jobName string, options *DataTransferJobsClientCancelOptions) (DataTransferJobsClientCancelResponse, error) { + req, err := client.cancelCreateRequest(ctx, resourceGroupName, accountName, jobName, options) + if err != nil { + return DataTransferJobsClientCancelResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DataTransferJobsClientCancelResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DataTransferJobsClientCancelResponse{}, runtime.NewResponseError(resp) + } + return client.cancelHandleResponse(resp) +} + +// cancelCreateRequest creates the Cancel request. +func (client *DataTransferJobsClient) cancelCreateRequest(ctx context.Context, resourceGroupName string, accountName string, jobName string, options *DataTransferJobsClientCancelOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/cancel" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-02-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// cancelHandleResponse handles the Cancel response. +func (client *DataTransferJobsClient) cancelHandleResponse(resp *http.Response) (DataTransferJobsClientCancelResponse, error) { + result := DataTransferJobsClientCancelResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DataTransferJobGetResults); err != nil { + return DataTransferJobsClientCancelResponse{}, err + } + return result, nil +} + // Create - Creates a Data Transfer Job. // If the operation fails it returns an *azcore.ResponseError type. // resourceGroupName - The name of the resource group. The name is case insensitive. @@ -69,7 +129,7 @@ func (client *DataTransferJobsClient) Create(ctx context.Context, resourceGroupN if err != nil { return DataTransferJobsClientCreateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { + if !runtime.HasStatusCode(resp, http.StatusOK) { return DataTransferJobsClientCreateResponse{}, runtime.NewResponseError(resp) } return client.createHandleResponse(resp) @@ -242,3 +302,123 @@ func (client *DataTransferJobsClient) listByDatabaseAccountHandleResponse(resp * } return result, nil } + +// Pause - Pause a Data Transfer Job. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// accountName - Cosmos DB database account name. +// jobName - Name of the Data Transfer Job +// options - DataTransferJobsClientPauseOptions contains the optional parameters for the DataTransferJobsClient.Pause method. +func (client *DataTransferJobsClient) Pause(ctx context.Context, resourceGroupName string, accountName string, jobName string, options *DataTransferJobsClientPauseOptions) (DataTransferJobsClientPauseResponse, error) { + req, err := client.pauseCreateRequest(ctx, resourceGroupName, accountName, jobName, options) + if err != nil { + return DataTransferJobsClientPauseResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DataTransferJobsClientPauseResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DataTransferJobsClientPauseResponse{}, runtime.NewResponseError(resp) + } + return client.pauseHandleResponse(resp) +} + +// pauseCreateRequest creates the Pause request. +func (client *DataTransferJobsClient) pauseCreateRequest(ctx context.Context, resourceGroupName string, accountName string, jobName string, options *DataTransferJobsClientPauseOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/pause" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-02-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// pauseHandleResponse handles the Pause response. +func (client *DataTransferJobsClient) pauseHandleResponse(resp *http.Response) (DataTransferJobsClientPauseResponse, error) { + result := DataTransferJobsClientPauseResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DataTransferJobGetResults); err != nil { + return DataTransferJobsClientPauseResponse{}, err + } + return result, nil +} + +// Resume - Resumes a Data Transfer Job. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// accountName - Cosmos DB database account name. +// jobName - Name of the Data Transfer Job +// options - DataTransferJobsClientResumeOptions contains the optional parameters for the DataTransferJobsClient.Resume method. +func (client *DataTransferJobsClient) Resume(ctx context.Context, resourceGroupName string, accountName string, jobName string, options *DataTransferJobsClientResumeOptions) (DataTransferJobsClientResumeResponse, error) { + req, err := client.resumeCreateRequest(ctx, resourceGroupName, accountName, jobName, options) + if err != nil { + return DataTransferJobsClientResumeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DataTransferJobsClientResumeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DataTransferJobsClientResumeResponse{}, runtime.NewResponseError(resp) + } + return client.resumeHandleResponse(resp) +} + +// resumeCreateRequest creates the Resume request. +func (client *DataTransferJobsClient) resumeCreateRequest(ctx context.Context, resourceGroupName string, accountName string, jobName string, options *DataTransferJobsClientResumeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/resume" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-02-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// resumeHandleResponse handles the Resume response. +func (client *DataTransferJobsClient) resumeHandleResponse(resp *http.Response) (DataTransferJobsClientResumeResponse, error) { + result := DataTransferJobsClientResumeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DataTransferJobGetResults); err != nil { + return DataTransferJobsClientResumeResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_models.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_models.go index 2bb65ecc9847..00950c1ef8dc 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_models.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_models.go @@ -1464,11 +1464,19 @@ type DataTransferJobProperties struct { // READ-ONLY; Last Updated Time (ISO-8601 format). LastUpdatedUTCTime *time.Time `json:"lastUpdatedUtcTime,omitempty" azure:"ro"` - // READ-ONLY; Percentage of completion. - PercentageComplete *float32 `json:"percentageComplete,omitempty" azure:"ro"` + // READ-ONLY; Processed Count. + ProcessedCount *float32 `json:"processedCount,omitempty" azure:"ro"` // READ-ONLY; Job Status Status *string `json:"status,omitempty" azure:"ro"` + + // READ-ONLY; Total Count. + TotalCount *float32 `json:"totalCount,omitempty" azure:"ro"` +} + +// 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. @@ -1487,6 +1495,16 @@ 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. @@ -3379,6 +3397,13 @@ type MongoDBResourcesClientBeginMigrateMongoDBDatabaseToManualThroughputOptions ResumeToken string } +// MongoDBResourcesClientBeginMongoDBContainerRedistributeThroughputOptions contains the optional parameters for the MongoDBResourcesClient.BeginMongoDBContainerRedistributeThroughput +// method. +type MongoDBResourcesClientBeginMongoDBContainerRedistributeThroughputOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // MongoDBResourcesClientBeginRetrieveContinuousBackupInformationOptions contains the optional parameters for the MongoDBResourcesClient.BeginRetrieveContinuousBackupInformation // method. type MongoDBResourcesClientBeginRetrieveContinuousBackupInformationOptions struct { @@ -3386,6 +3411,13 @@ type MongoDBResourcesClientBeginRetrieveContinuousBackupInformationOptions struc ResumeToken string } +// MongoDBResourcesClientBeginSQLContainerRetrieveThroughputDistributionOptions contains the optional parameters for the MongoDBResourcesClient.BeginSQLContainerRetrieveThroughputDistribution +// method. +type MongoDBResourcesClientBeginSQLContainerRetrieveThroughputDistributionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // MongoDBResourcesClientBeginUpdateMongoDBCollectionThroughputOptions contains the optional parameters for the MongoDBResourcesClient.BeginUpdateMongoDBCollectionThroughput // method. type MongoDBResourcesClientBeginUpdateMongoDBCollectionThroughputOptions struct { @@ -3917,6 +3949,12 @@ type Permission struct { NotDataActions []*string `json:"notDataActions,omitempty"` } +// PhysicalPartitionID - PhysicalPartitionId object +type PhysicalPartitionID struct { + // REQUIRED; Id of a physical partition + ID *string `json:"id,omitempty"` +} + // PhysicalPartitionStorageInfo - The storage of a physical partition type PhysicalPartitionStorageInfo struct { // READ-ONLY; The unique identifier of the partition. @@ -3932,6 +3970,15 @@ type PhysicalPartitionStorageInfoCollection struct { PhysicalPartitionStorageInfoCollection []*PhysicalPartitionStorageInfo `json:"physicalPartitionStorageInfoCollection,omitempty" azure:"ro"` } +// PhysicalPartitionThroughputInfoResource - PhysicalPartitionThroughputInfo object +type PhysicalPartitionThroughputInfoResource struct { + // REQUIRED; Id of a physical partition + ID *string `json:"id,omitempty"` + + // Throughput of a physical partition + Throughput *float64 `json:"throughput,omitempty"` +} + // PrivateEndpointConnection - A private endpoint connection type PrivateEndpointConnection struct { // Resource properties. @@ -4087,6 +4134,52 @@ type ProxyResource struct { Type *string `json:"type,omitempty" azure:"ro"` } +// RedistributeThroughputParameters - Cosmos DB redistribute throughput parameters object +type RedistributeThroughputParameters struct { + // REQUIRED; Properties to redistribute throughput parameters object + Properties *RedistributeThroughputProperties `json:"properties,omitempty"` + + // Identity for the resource. + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + + // The location of the resource group to which the resource belongs. + Location *string `json:"location,omitempty"` + + // Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource + // (across resource groups). A maximum of 15 tags can be provided for a + // resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, + // the default experience for a template type is set with "defaultExperience": + // "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; The unique resource identifier of the ARM resource. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the ARM resource. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of Azure resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// RedistributeThroughputProperties - Properties to redistribute throughput for Azure Cosmos DB resource. +type RedistributeThroughputProperties struct { + // REQUIRED; The standard JSON format of a resource throughput + Resource *RedistributeThroughputPropertiesResource `json:"resource,omitempty"` +} + +// RedistributeThroughputPropertiesResource - Resource to redistribute throughput for Azure Cosmos DB resource +type RedistributeThroughputPropertiesResource struct { + // REQUIRED; Array of PhysicalPartitionThroughputInfoResource objects. + SourcePhysicalPartitionThroughputInfo []*PhysicalPartitionThroughputInfoResource `json:"sourcePhysicalPartitionThroughputInfo,omitempty"` + + // REQUIRED; Array of PhysicalPartitionThroughputInfoResource objects. + TargetPhysicalPartitionThroughputInfo []*PhysicalPartitionThroughputInfoResource `json:"targetPhysicalPartitionThroughputInfo,omitempty"` + + // REQUIRED; ThroughputPolicy to apply for throughput redistribution + ThroughputPolicy *ThroughputPolicyType `json:"throughputPolicy,omitempty"` +} + // RegionForOnlineOffline - Cosmos DB region to online or offline. type RegionForOnlineOffline struct { // REQUIRED; Cosmos DB region, with spaces between words and each word capitalized. @@ -4721,6 +4814,46 @@ type RestoreParameters struct { TablesToRestore []*string `json:"tablesToRestore,omitempty"` } +// RetrieveThroughputParameters - Cosmos DB retrieve throughput parameters object +type RetrieveThroughputParameters struct { + // REQUIRED; Properties to retrieve throughput parameters object + Properties *RetrieveThroughputProperties `json:"properties,omitempty"` + + // Identity for the resource. + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + + // The location of the resource group to which the resource belongs. + Location *string `json:"location,omitempty"` + + // Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource + // (across resource groups). A maximum of 15 tags can be provided for a + // resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, + // the default experience for a template type is set with "defaultExperience": + // "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; The unique resource identifier of the ARM resource. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the ARM resource. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of Azure resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// RetrieveThroughputProperties - Properties to retrieve throughput for Azure Cosmos DB resource. +type RetrieveThroughputProperties struct { + // REQUIRED; The standard JSON format of a resource throughput + Resource *RetrieveThroughputPropertiesResource `json:"resource,omitempty"` +} + +// RetrieveThroughputPropertiesResource - Resource to retrieve throughput information for Cosmos DB resource +type RetrieveThroughputPropertiesResource struct { + // REQUIRED; Array of PhysicalPartitionId objects. + PhysicalPartitionIDs []*PhysicalPartitionID `json:"physicalPartitionIds,omitempty"` +} + // Role - The set of roles permitted through this Role Definition. type Role struct { // The database name the role is applied. @@ -5199,6 +5332,20 @@ type SQLResourcesClientBeginRetrieveContinuousBackupInformationOptions struct { ResumeToken string } +// SQLResourcesClientBeginSQLContainerRedistributeThroughputOptions contains the optional parameters for the SQLResourcesClient.BeginSQLContainerRedistributeThroughput +// method. +type SQLResourcesClientBeginSQLContainerRedistributeThroughputOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientBeginSQLContainerRetrieveThroughputDistributionOptions contains the optional parameters for the SQLResourcesClient.BeginSQLContainerRetrieveThroughputDistribution +// method. +type SQLResourcesClientBeginSQLContainerRetrieveThroughputDistributionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // SQLResourcesClientBeginUpdateSQLContainerThroughputOptions contains the optional parameters for the SQLResourcesClient.BeginUpdateSQLContainerThroughput // method. type SQLResourcesClientBeginUpdateSQLContainerThroughputOptions struct { diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_models_serde.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_models_serde.go index b122ba8fa36a..4146bd822f33 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_models_serde.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_models_serde.go @@ -592,9 +592,10 @@ func (d DataTransferJobProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "error", d.Error) populate(objectMap, "jobName", d.JobName) populateTimeRFC3339(objectMap, "lastUpdatedUtcTime", d.LastUpdatedUTCTime) - populate(objectMap, "percentageComplete", d.PercentageComplete) + populate(objectMap, "processedCount", d.ProcessedCount) populate(objectMap, "source", d.Source) populate(objectMap, "status", d.Status) + populate(objectMap, "totalCount", d.TotalCount) populate(objectMap, "workerCount", d.WorkerCount) return json.Marshal(objectMap) } @@ -620,8 +621,8 @@ func (d *DataTransferJobProperties) UnmarshalJSON(data []byte) error { case "lastUpdatedUtcTime": err = unpopulateTimeRFC3339(val, &d.LastUpdatedUTCTime) delete(rawMsg, key) - case "percentageComplete": - err = unpopulate(val, &d.PercentageComplete) + case "processedCount": + err = unpopulate(val, &d.ProcessedCount) delete(rawMsg, key) case "source": d.Source, err = unmarshalDataTransferDataSourceSinkClassification(val) @@ -629,6 +630,9 @@ func (d *DataTransferJobProperties) UnmarshalJSON(data []byte) error { case "status": err = unpopulate(val, &d.Status) delete(rawMsg, key) + case "totalCount": + err = unpopulate(val, &d.TotalCount) + delete(rawMsg, key) case "workerCount": err = unpopulate(val, &d.WorkerCount) delete(rawMsg, key) @@ -2117,6 +2121,28 @@ func (p Privilege) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// MarshalJSON implements the json.Marshaller interface for type RedistributeThroughputParameters. +func (r RedistributeThroughputParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "identity", r.Identity) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type RedistributeThroughputPropertiesResource. +func (r RedistributeThroughputPropertiesResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "sourcePhysicalPartitionThroughputInfo", r.SourcePhysicalPartitionThroughputInfo) + populate(objectMap, "targetPhysicalPartitionThroughputInfo", r.TargetPhysicalPartitionThroughputInfo) + populate(objectMap, "throughputPolicy", r.ThroughputPolicy) + return json.Marshal(objectMap) +} + // MarshalJSON implements the json.Marshaller interface for type RestorableDatabaseAccountProperties. func (r RestorableDatabaseAccountProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -2334,6 +2360,26 @@ func (r *RestoreParameters) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type RetrieveThroughputParameters. +func (r RetrieveThroughputParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "identity", r.Identity) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type RetrieveThroughputPropertiesResource. +func (r RetrieveThroughputPropertiesResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "physicalPartitionIds", r.PhysicalPartitionIDs) + return json.Marshal(objectMap) +} + // MarshalJSON implements the json.Marshaller interface for type SQLContainerCreateUpdateParameters. func (s SQLContainerCreateUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_mongodbresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_mongodbresources_client.go index 0d661fc63ef7..5b707da9ea5a 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_mongodbresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_mongodbresources_client.go @@ -1578,6 +1578,80 @@ func (client *MongoDBResourcesClient) migrateMongoDBDatabaseToManualThroughputCr return req, nil } +// BeginMongoDBContainerRedistributeThroughput - Redistribute throughput for an Azure Cosmos DB MongoDB container +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// accountName - Cosmos DB database account name. +// databaseName - Cosmos DB database name. +// collectionName - Cosmos DB collection name. +// redistributeThroughputParameters - The parameters to provide for redistributing throughput for the current MongoDB container. +// options - MongoDBResourcesClientBeginMongoDBContainerRedistributeThroughputOptions contains the optional parameters for +// the MongoDBResourcesClient.BeginMongoDBContainerRedistributeThroughput method. +func (client *MongoDBResourcesClient) BeginMongoDBContainerRedistributeThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, redistributeThroughputParameters RedistributeThroughputParameters, options *MongoDBResourcesClientBeginMongoDBContainerRedistributeThroughputOptions) (*armruntime.Poller[MongoDBResourcesClientMongoDBContainerRedistributeThroughputResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.mongoDBContainerRedistributeThroughput(ctx, resourceGroupName, accountName, databaseName, collectionName, redistributeThroughputParameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[MongoDBResourcesClientMongoDBContainerRedistributeThroughputResponse]{ + FinalStateVia: armruntime.FinalStateViaLocation, + }) + } else { + return armruntime.NewPollerFromResumeToken[MongoDBResourcesClientMongoDBContainerRedistributeThroughputResponse](options.ResumeToken, client.pl, nil) + } +} + +// MongoDBContainerRedistributeThroughput - Redistribute throughput for an Azure Cosmos DB MongoDB container +// If the operation fails it returns an *azcore.ResponseError type. +func (client *MongoDBResourcesClient) mongoDBContainerRedistributeThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, redistributeThroughputParameters RedistributeThroughputParameters, options *MongoDBResourcesClientBeginMongoDBContainerRedistributeThroughputOptions) (*http.Response, error) { + req, err := client.mongoDBContainerRedistributeThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, collectionName, redistributeThroughputParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// mongoDBContainerRedistributeThroughputCreateRequest creates the MongoDBContainerRedistributeThroughput request. +func (client *MongoDBResourcesClient) mongoDBContainerRedistributeThroughputCreateRequest(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, redistributeThroughputParameters RedistributeThroughputParameters, options *MongoDBResourcesClientBeginMongoDBContainerRedistributeThroughputOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/redistributeThroughput" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if collectionName == "" { + return nil, errors.New("parameter collectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{collectionName}", url.PathEscape(collectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-02-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, redistributeThroughputParameters) +} + // BeginRetrieveContinuousBackupInformation - Retrieves continuous backup information for a Mongodb collection. // If the operation fails it returns an *azcore.ResponseError type. // resourceGroupName - The name of the resource group. The name is case insensitive. @@ -1652,6 +1726,81 @@ func (client *MongoDBResourcesClient) retrieveContinuousBackupInformationCreateR return req, runtime.MarshalAsJSON(req, location) } +// BeginSQLContainerRetrieveThroughputDistribution - Retrieve throughput distribution for an Azure Cosmos DB MongoDB container +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// accountName - Cosmos DB database account name. +// databaseName - Cosmos DB database name. +// collectionName - Cosmos DB collection name. +// retrieveThroughputParameters - The parameters to provide for retrieving throughput distribution for the current MongoDB +// container. +// options - MongoDBResourcesClientBeginSQLContainerRetrieveThroughputDistributionOptions contains the optional parameters +// for the MongoDBResourcesClient.BeginSQLContainerRetrieveThroughputDistribution method. +func (client *MongoDBResourcesClient) BeginSQLContainerRetrieveThroughputDistribution(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, retrieveThroughputParameters RetrieveThroughputParameters, options *MongoDBResourcesClientBeginSQLContainerRetrieveThroughputDistributionOptions) (*armruntime.Poller[MongoDBResourcesClientSQLContainerRetrieveThroughputDistributionResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.sQLContainerRetrieveThroughputDistribution(ctx, resourceGroupName, accountName, databaseName, collectionName, retrieveThroughputParameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[MongoDBResourcesClientSQLContainerRetrieveThroughputDistributionResponse]{ + FinalStateVia: armruntime.FinalStateViaLocation, + }) + } else { + return armruntime.NewPollerFromResumeToken[MongoDBResourcesClientSQLContainerRetrieveThroughputDistributionResponse](options.ResumeToken, client.pl, nil) + } +} + +// SQLContainerRetrieveThroughputDistribution - Retrieve throughput distribution for an Azure Cosmos DB MongoDB container +// If the operation fails it returns an *azcore.ResponseError type. +func (client *MongoDBResourcesClient) sQLContainerRetrieveThroughputDistribution(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, retrieveThroughputParameters RetrieveThroughputParameters, options *MongoDBResourcesClientBeginSQLContainerRetrieveThroughputDistributionOptions) (*http.Response, error) { + req, err := client.sqlContainerRetrieveThroughputDistributionCreateRequest(ctx, resourceGroupName, accountName, databaseName, collectionName, retrieveThroughputParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// sqlContainerRetrieveThroughputDistributionCreateRequest creates the SQLContainerRetrieveThroughputDistribution request. +func (client *MongoDBResourcesClient) sqlContainerRetrieveThroughputDistributionCreateRequest(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, retrieveThroughputParameters RetrieveThroughputParameters, options *MongoDBResourcesClientBeginSQLContainerRetrieveThroughputDistributionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/retrieveThroughputDistribution" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if collectionName == "" { + return nil, errors.New("parameter collectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{collectionName}", url.PathEscape(collectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-02-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, retrieveThroughputParameters) +} + // BeginUpdateMongoDBCollectionThroughput - Update the RUs per second of an Azure Cosmos DB MongoDB collection // If the operation fails it returns an *azcore.ResponseError type. // resourceGroupName - The name of the resource group. The name is case insensitive. diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_response_types.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_response_types.go index 6c887faef05b..3c8d899bd417 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_response_types.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_response_types.go @@ -248,6 +248,11 @@ type CollectionRegionClientListMetricsResponse struct { MetricListResult } +// DataTransferJobsClientCancelResponse contains the response from method DataTransferJobsClient.Cancel. +type DataTransferJobsClientCancelResponse struct { + DataTransferJobGetResults +} + // DataTransferJobsClientCreateResponse contains the response from method DataTransferJobsClient.Create. type DataTransferJobsClientCreateResponse struct { DataTransferJobGetResults @@ -263,6 +268,16 @@ type DataTransferJobsClientListByDatabaseAccountResponse struct { DataTransferJobFeedResults } +// DataTransferJobsClientPauseResponse contains the response from method DataTransferJobsClient.Pause. +type DataTransferJobsClientPauseResponse struct { + DataTransferJobGetResults +} + +// DataTransferJobsClientResumeResponse contains the response from method DataTransferJobsClient.Resume. +type DataTransferJobsClientResumeResponse struct { + DataTransferJobGetResults +} + // DatabaseAccountRegionClientListMetricsResponse contains the response from method DatabaseAccountRegionClient.ListMetrics. type DatabaseAccountRegionClientListMetricsResponse struct { MetricListResult @@ -604,11 +619,21 @@ type MongoDBResourcesClientMigrateMongoDBDatabaseToManualThroughputResponse stru ThroughputSettingsGetResults } +// MongoDBResourcesClientMongoDBContainerRedistributeThroughputResponse contains the response from method MongoDBResourcesClient.MongoDBContainerRedistributeThroughput. +type MongoDBResourcesClientMongoDBContainerRedistributeThroughputResponse struct { + // placeholder for future response values +} + // MongoDBResourcesClientRetrieveContinuousBackupInformationResponse contains the response from method MongoDBResourcesClient.RetrieveContinuousBackupInformation. type MongoDBResourcesClientRetrieveContinuousBackupInformationResponse struct { BackupInformation } +// MongoDBResourcesClientSQLContainerRetrieveThroughputDistributionResponse contains the response from method MongoDBResourcesClient.SQLContainerRetrieveThroughputDistribution. +type MongoDBResourcesClientSQLContainerRetrieveThroughputDistributionResponse struct { + // placeholder for future response values +} + // MongoDBResourcesClientUpdateMongoDBCollectionThroughputResponse contains the response from method MongoDBResourcesClient.UpdateMongoDBCollectionThroughput. type MongoDBResourcesClientUpdateMongoDBCollectionThroughputResponse struct { ThroughputSettingsGetResults @@ -979,6 +1004,16 @@ type SQLResourcesClientRetrieveContinuousBackupInformationResponse struct { BackupInformation } +// SQLResourcesClientSQLContainerRedistributeThroughputResponse contains the response from method SQLResourcesClient.SQLContainerRedistributeThroughput. +type SQLResourcesClientSQLContainerRedistributeThroughputResponse struct { + // placeholder for future response values +} + +// SQLResourcesClientSQLContainerRetrieveThroughputDistributionResponse contains the response from method SQLResourcesClient.SQLContainerRetrieveThroughputDistribution. +type SQLResourcesClientSQLContainerRetrieveThroughputDistributionResponse struct { + // placeholder for future response values +} + // SQLResourcesClientUpdateSQLContainerThroughputResponse contains the response from method SQLResourcesClient.UpdateSQLContainerThroughput. type SQLResourcesClientUpdateSQLContainerThroughputResponse struct { ThroughputSettingsGetResults diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_sqlresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_sqlresources_client.go index b12fea9b568c..60b15bb1cd11 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_sqlresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_sqlresources_client.go @@ -2746,6 +2746,154 @@ func (client *SQLResourcesClient) retrieveContinuousBackupInformationCreateReque return req, runtime.MarshalAsJSON(req, location) } +// BeginSQLContainerRedistributeThroughput - Redistribute throughput for an Azure Cosmos DB SQL container +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// accountName - Cosmos DB database account name. +// databaseName - Cosmos DB database name. +// containerName - Cosmos DB container name. +// redistributeThroughputParameters - The parameters to provide for redistributing throughput for the current SQL container. +// options - SQLResourcesClientBeginSQLContainerRedistributeThroughputOptions contains the optional parameters for the SQLResourcesClient.BeginSQLContainerRedistributeThroughput +// method. +func (client *SQLResourcesClient) BeginSQLContainerRedistributeThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, redistributeThroughputParameters RedistributeThroughputParameters, options *SQLResourcesClientBeginSQLContainerRedistributeThroughputOptions) (*armruntime.Poller[SQLResourcesClientSQLContainerRedistributeThroughputResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.sQLContainerRedistributeThroughput(ctx, resourceGroupName, accountName, databaseName, containerName, redistributeThroughputParameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[SQLResourcesClientSQLContainerRedistributeThroughputResponse]{ + FinalStateVia: armruntime.FinalStateViaLocation, + }) + } else { + return armruntime.NewPollerFromResumeToken[SQLResourcesClientSQLContainerRedistributeThroughputResponse](options.ResumeToken, client.pl, nil) + } +} + +// SQLContainerRedistributeThroughput - Redistribute throughput for an Azure Cosmos DB SQL container +// If the operation fails it returns an *azcore.ResponseError type. +func (client *SQLResourcesClient) sQLContainerRedistributeThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, redistributeThroughputParameters RedistributeThroughputParameters, options *SQLResourcesClientBeginSQLContainerRedistributeThroughputOptions) (*http.Response, error) { + req, err := client.sqlContainerRedistributeThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, redistributeThroughputParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// sqlContainerRedistributeThroughputCreateRequest creates the SQLContainerRedistributeThroughput request. +func (client *SQLResourcesClient) sqlContainerRedistributeThroughputCreateRequest(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, redistributeThroughputParameters RedistributeThroughputParameters, options *SQLResourcesClientBeginSQLContainerRedistributeThroughputOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/redistributeThroughput" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if containerName == "" { + return nil, errors.New("parameter containerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-02-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, redistributeThroughputParameters) +} + +// BeginSQLContainerRetrieveThroughputDistribution - Retrieve throughput distribution for an Azure Cosmos DB SQL container +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// accountName - Cosmos DB database account name. +// databaseName - Cosmos DB database name. +// containerName - Cosmos DB container name. +// retrieveThroughputParameters - The parameters to provide for retrieving throughput distribution for the current SQL container. +// options - SQLResourcesClientBeginSQLContainerRetrieveThroughputDistributionOptions contains the optional parameters for +// the SQLResourcesClient.BeginSQLContainerRetrieveThroughputDistribution method. +func (client *SQLResourcesClient) BeginSQLContainerRetrieveThroughputDistribution(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, retrieveThroughputParameters RetrieveThroughputParameters, options *SQLResourcesClientBeginSQLContainerRetrieveThroughputDistributionOptions) (*armruntime.Poller[SQLResourcesClientSQLContainerRetrieveThroughputDistributionResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.sQLContainerRetrieveThroughputDistribution(ctx, resourceGroupName, accountName, databaseName, containerName, retrieveThroughputParameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[SQLResourcesClientSQLContainerRetrieveThroughputDistributionResponse]{ + FinalStateVia: armruntime.FinalStateViaLocation, + }) + } else { + return armruntime.NewPollerFromResumeToken[SQLResourcesClientSQLContainerRetrieveThroughputDistributionResponse](options.ResumeToken, client.pl, nil) + } +} + +// SQLContainerRetrieveThroughputDistribution - Retrieve throughput distribution for an Azure Cosmos DB SQL container +// If the operation fails it returns an *azcore.ResponseError type. +func (client *SQLResourcesClient) sQLContainerRetrieveThroughputDistribution(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, retrieveThroughputParameters RetrieveThroughputParameters, options *SQLResourcesClientBeginSQLContainerRetrieveThroughputDistributionOptions) (*http.Response, error) { + req, err := client.sqlContainerRetrieveThroughputDistributionCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, retrieveThroughputParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// sqlContainerRetrieveThroughputDistributionCreateRequest creates the SQLContainerRetrieveThroughputDistribution request. +func (client *SQLResourcesClient) sqlContainerRetrieveThroughputDistributionCreateRequest(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, retrieveThroughputParameters RetrieveThroughputParameters, options *SQLResourcesClientBeginSQLContainerRetrieveThroughputDistributionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/retrieveThroughputDistribution" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if containerName == "" { + return nil, errors.New("parameter containerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-02-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, retrieveThroughputParameters) +} + // BeginUpdateSQLContainerThroughput - Update RUs per second of an Azure Cosmos DB SQL container // If the operation fails it returns an *azcore.ResponseError type. // resourceGroupName - The name of the resource group. The name is case insensitive.