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/billing/2024-04-01/policy Documentation

The policy SDK allows for interaction with the Azure Resource Manager Service billing (API Version 2024-04-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/billing/2024-04-01/policy"

Client Initialization

client := policy.NewPolicyClientWithBaseURI("https://management.azure.com")
client.Client.Authorizer = authorizer

Example Usage: PolicyClient.PoliciesCreateOrUpdateByBillingAccount

ctx := context.TODO()
id := policy.NewBillingAccountID("billingAccountValue")

payload := policy.BillingAccountPolicy{
	// ...
}


if err := client.PoliciesCreateOrUpdateByBillingAccountThenPoll(ctx, id, payload); err != nil {
	// handle the error
}

Example Usage: PolicyClient.PoliciesCreateOrUpdateByBillingProfile

ctx := context.TODO()
id := policy.NewBillingProfileID("billingAccountValue", "billingProfileValue")

payload := policy.BillingProfilePolicy{
	// ...
}


if err := client.PoliciesCreateOrUpdateByBillingProfileThenPoll(ctx, id, payload); err != nil {
	// handle the error
}

Example Usage: PolicyClient.PoliciesCreateOrUpdateByCustomer

ctx := context.TODO()
id := policy.NewBillingProfileCustomerID("billingAccountValue", "billingProfileValue", "customerValue")

payload := policy.CustomerPolicy{
	// ...
}


if err := client.PoliciesCreateOrUpdateByCustomerThenPoll(ctx, id, payload); err != nil {
	// handle the error
}

Example Usage: PolicyClient.PoliciesCreateOrUpdateByCustomerAtBillingAccount

ctx := context.TODO()
id := policy.NewCustomerID("billingAccountValue", "customerValue")

payload := policy.CustomerPolicy{
	// ...
}


if err := client.PoliciesCreateOrUpdateByCustomerAtBillingAccountThenPoll(ctx, id, payload); err != nil {
	// handle the error
}

Example Usage: PolicyClient.PoliciesGetByBillingAccount

ctx := context.TODO()
id := policy.NewBillingAccountID("billingAccountValue")

read, err := client.PoliciesGetByBillingAccount(ctx, id)
if err != nil {
	// handle the error
}
if model := read.Model; model != nil {
	// do something with the model/response object
}

Example Usage: PolicyClient.PoliciesGetByBillingProfile

ctx := context.TODO()
id := policy.NewBillingProfileID("billingAccountValue", "billingProfileValue")

read, err := client.PoliciesGetByBillingProfile(ctx, id)
if err != nil {
	// handle the error
}
if model := read.Model; model != nil {
	// do something with the model/response object
}

Example Usage: PolicyClient.PoliciesGetByCustomer

ctx := context.TODO()
id := policy.NewBillingProfileCustomerID("billingAccountValue", "billingProfileValue", "customerValue")

read, err := client.PoliciesGetByCustomer(ctx, id)
if err != nil {
	// handle the error
}
if model := read.Model; model != nil {
	// do something with the model/response object
}

Example Usage: PolicyClient.PoliciesGetByCustomerAtBillingAccount

ctx := context.TODO()
id := policy.NewCustomerID("billingAccountValue", "customerValue")

read, err := client.PoliciesGetByCustomerAtBillingAccount(ctx, id)
if err != nil {
	// handle the error
}
if model := read.Model; model != nil {
	// do something with the model/response object
}

Example Usage: PolicyClient.PoliciesGetBySubscription

ctx := context.TODO()
id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012")

read, err := client.PoliciesGetBySubscription(ctx, id)
if err != nil {
	// handle the error
}
if model := read.Model; model != nil {
	// do something with the model/response object
}