azure-rest-api-specs-examples/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples-go/TestBaseAccountUpdate.go

45 строки
1.3 KiB
Go

package armtestbase_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/testbase/armtestbase"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/TestBaseAccountUpdate.json
func ExampleAccountsClient_BeginUpdate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client, err := armtestbase.NewAccountsClient("476f61a4-952c-422a-b4db-568a828f35df", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := client.BeginUpdate(ctx,
"contoso-rg1",
"contoso-testBaseAccount1",
armtestbase.AccountUpdateParameters{
Properties: &armtestbase.AccountUpdateParameterProperties{
SKU: &armtestbase.AccountSKU{
Name: to.Ptr("S0"),
Tier: to.Ptr(armtestbase.TierStandard),
},
},
},
nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// TODO: use response item
_ = res
}