package
0.20240715.1103416
Repository: https://github.com/hashicorp/go-azure-sdk.git
Documentation: pkg.go.dev
# README
github.com/hashicorp/go-azure-sdk/resource-manager/subscription/2021-10-01/subscriptions
Documentation
The subscriptions
SDK allows for interaction with the Azure Resource Manager Service subscription
(API Version 2021-10-01
).
This readme covers example usages, but further information on using this SDK can be found in the project root.
Import Path
import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
import "github.com/hashicorp/go-azure-sdk/resource-manager/subscription/2021-10-01/subscriptions"
Client Initialization
client := subscriptions.NewSubscriptionsClientWithBaseURI("https://management.azure.com")
client.Client.Authorizer = authorizer
Example Usage: SubscriptionsClient.AliasCreate
ctx := context.TODO()
id := subscriptions.NewAliasID("aliasValue")
payload := subscriptions.PutAliasRequest{
// ...
}
if err := client.AliasCreateThenPoll(ctx, id, payload); err != nil {
// handle the error
}
Example Usage: SubscriptionsClient.AliasDelete
ctx := context.TODO()
id := subscriptions.NewAliasID("aliasValue")
read, err := client.AliasDelete(ctx, id)
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}
Example Usage: SubscriptionsClient.AliasGet
ctx := context.TODO()
id := subscriptions.NewAliasID("aliasValue")
read, err := client.AliasGet(ctx, id)
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}
Example Usage: SubscriptionsClient.AliasList
ctx := context.TODO()
// alternatively `client.AliasList(ctx)` can be used to do batched pagination
items, err := client.AliasListComplete(ctx)
if err != nil {
// handle the error
}
for _, item := range items {
// do something
}
Example Usage: SubscriptionsClient.BillingAccountGetPolicy
ctx := context.TODO()
id := subscriptions.NewBillingAccountID("billingAccountIdValue")
read, err := client.BillingAccountGetPolicy(ctx, id)
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}
Example Usage: SubscriptionsClient.SubscriptionAcceptOwnership
ctx := context.TODO()
id := subscriptions.NewProviderSubscriptionID("12345678-1234-9876-4563-123456789012")
payload := subscriptions.AcceptOwnershipRequest{
// ...
}
if err := client.SubscriptionAcceptOwnershipThenPoll(ctx, id, payload); err != nil {
// handle the error
}
Example Usage: SubscriptionsClient.SubscriptionAcceptOwnershipStatus
ctx := context.TODO()
id := subscriptions.NewProviderSubscriptionID("12345678-1234-9876-4563-123456789012")
read, err := client.SubscriptionAcceptOwnershipStatus(ctx, id)
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}
Example Usage: SubscriptionsClient.SubscriptionCancel
ctx := context.TODO()
id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012")
read, err := client.SubscriptionCancel(ctx, id, subscriptions.DefaultSubscriptionCancelOperationOptions())
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}
Example Usage: SubscriptionsClient.SubscriptionEnable
ctx := context.TODO()
id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012")
read, err := client.SubscriptionEnable(ctx, id)
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}
Example Usage: SubscriptionsClient.SubscriptionOperationGet
ctx := context.TODO()
id := subscriptions.NewSubscriptionOperationID("operationIdValue")
read, err := client.SubscriptionOperationGet(ctx, id)
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}
Example Usage: SubscriptionsClient.SubscriptionPolicyAddUpdatePolicyForTenant
ctx := context.TODO()
payload := subscriptions.PutTenantPolicyRequestProperties{
// ...
}
read, err := client.SubscriptionPolicyAddUpdatePolicyForTenant(ctx, payload)
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}
Example Usage: SubscriptionsClient.SubscriptionPolicyGetPolicyForTenant
ctx := context.TODO()
read, err := client.SubscriptionPolicyGetPolicyForTenant(ctx)
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}
Example Usage: SubscriptionsClient.SubscriptionPolicyListPolicyForTenant
ctx := context.TODO()
// alternatively `client.SubscriptionPolicyListPolicyForTenant(ctx)` can be used to do batched pagination
items, err := client.SubscriptionPolicyListPolicyForTenantComplete(ctx)
if err != nil {
// handle the error
}
for _, item := range items {
// do something
}
Example Usage: SubscriptionsClient.SubscriptionRename
ctx := context.TODO()
id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012")
payload := subscriptions.SubscriptionName{
// ...
}
read, err := client.SubscriptionRename(ctx, id, payload)
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}