armcostmanagement

package module
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2023 License: MIT Imports: 15 Imported by: 6

README

Azure Costmanagement Module for Go

PkgGoDev

The armcostmanagement module provides operations for working with Azure Costmanagement.

Source code

Getting started

Prerequisites

  • an Azure subscription
  • Go 1.18 or above (You could download and install the latest version of Go from here. It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this doc.)

Install the package

This project uses Go modules for versioning and dependency management.

Install the Azure Costmanagement module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement

Authorization

When creating a client, you will need to provide a credential for authenticating with Azure Costmanagement. The azidentity module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more.

cred, err := azidentity.NewDefaultAzureCredential(nil)

For more information on authentication, please see the documentation for azidentity at pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity.

Client Factory

Azure Costmanagement module consists of one or more clients. We provide a client factory which could be used to create any client in this module.

clientFactory, err := armcostmanagement.NewClientFactory(<subscription ID>, cred, nil)

You can use ClientOptions in package github.com/Azure/azure-sdk-for-go/sdk/azcore/arm to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for azcore at pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore.

options := arm.ClientOptions {
    ClientOptions: azcore.ClientOptions {
        Cloud: cloud.AzureChina,
    },
}
clientFactory, err := armcostmanagement.NewClientFactory(<subscription ID>, cred, &options)

Clients

A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory.

client := clientFactory.NewAlertsClient()

Provide Feedback

If you encounter bugs or have suggestions, please open an issue and assign the Costmanagement label.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccumulatedType

type AccumulatedType string

AccumulatedType - Show costs accumulated over time.

const (
	AccumulatedTypeFalse AccumulatedType = "false"
	AccumulatedTypeTrue  AccumulatedType = "true"
)

func PossibleAccumulatedTypeValues

func PossibleAccumulatedTypeValues() []AccumulatedType

PossibleAccumulatedTypeValues returns the possible values for the AccumulatedType const type.

type Alert

type Alert struct {
	// eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating
	// the latest version or not.
	ETag *string

	// Alert properties.
	Properties *AlertProperties

	// READ-ONLY; Resource Id.
	ID *string

	// READ-ONLY; Resource name.
	Name *string

	// READ-ONLY; Resource type.
	Type *string
}

Alert - An individual alert.

func (Alert) MarshalJSON added in v1.1.0

func (a Alert) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Alert.

func (*Alert) UnmarshalJSON added in v1.1.0

func (a *Alert) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Alert.

type AlertCategory

type AlertCategory string

AlertCategory - Alert category

const (
	AlertCategoryBilling AlertCategory = "Billing"
	AlertCategoryCost    AlertCategory = "Cost"
	AlertCategorySystem  AlertCategory = "System"
	AlertCategoryUsage   AlertCategory = "Usage"
)

func PossibleAlertCategoryValues

func PossibleAlertCategoryValues() []AlertCategory

PossibleAlertCategoryValues returns the possible values for the AlertCategory const type.

type AlertCriteria

type AlertCriteria string

AlertCriteria - Criteria that triggered alert

const (
	AlertCriteriaCostThresholdExceeded          AlertCriteria = "CostThresholdExceeded"
	AlertCriteriaCreditThresholdApproaching     AlertCriteria = "CreditThresholdApproaching"
	AlertCriteriaCreditThresholdReached         AlertCriteria = "CreditThresholdReached"
	AlertCriteriaCrossCloudCollectionError      AlertCriteria = "CrossCloudCollectionError"
	AlertCriteriaCrossCloudNewDataAvailable     AlertCriteria = "CrossCloudNewDataAvailable"
	AlertCriteriaForecastCostThresholdExceeded  AlertCriteria = "ForecastCostThresholdExceeded"
	AlertCriteriaForecastUsageThresholdExceeded AlertCriteria = "ForecastUsageThresholdExceeded"
	AlertCriteriaGeneralThresholdError          AlertCriteria = "GeneralThresholdError"
	AlertCriteriaInvoiceDueDateApproaching      AlertCriteria = "InvoiceDueDateApproaching"
	AlertCriteriaInvoiceDueDateReached          AlertCriteria = "InvoiceDueDateReached"
	AlertCriteriaMultiCurrency                  AlertCriteria = "MultiCurrency"
	AlertCriteriaQuotaThresholdApproaching      AlertCriteria = "QuotaThresholdApproaching"
	AlertCriteriaQuotaThresholdReached          AlertCriteria = "QuotaThresholdReached"
	AlertCriteriaUsageThresholdExceeded         AlertCriteria = "UsageThresholdExceeded"
)

func PossibleAlertCriteriaValues

func PossibleAlertCriteriaValues() []AlertCriteria

PossibleAlertCriteriaValues returns the possible values for the AlertCriteria const type.

type AlertOperator

type AlertOperator string

AlertOperator - operator used to compare currentSpend with amount

const (
	AlertOperatorEqualTo              AlertOperator = "EqualTo"
	AlertOperatorGreaterThan          AlertOperator = "GreaterThan"
	AlertOperatorGreaterThanOrEqualTo AlertOperator = "GreaterThanOrEqualTo"
	AlertOperatorLessThan             AlertOperator = "LessThan"
	AlertOperatorLessThanOrEqualTo    AlertOperator = "LessThanOrEqualTo"
	AlertOperatorNone                 AlertOperator = "None"
)

func PossibleAlertOperatorValues

func PossibleAlertOperatorValues() []AlertOperator

PossibleAlertOperatorValues returns the possible values for the AlertOperator const type.

type AlertProperties

type AlertProperties struct {
	// dateTime in which alert was closed
	CloseTime *string

	// related budget
	CostEntityID *string

	// dateTime in which alert was created
	CreationTime *string

	// defines the type of alert
	Definition *AlertPropertiesDefinition

	// Alert description
	Description *string

	// Alert details
	Details *AlertPropertiesDetails

	// dateTime in which alert was last modified
	ModificationTime *string

	// Source of alert
	Source *AlertSource

	// alert status
	Status *AlertStatus

	// dateTime in which the alert status was last modified
	StatusModificationTime *string

	// User who last modified the alert
	StatusModificationUserName *string
}

AlertProperties - Alert properties.

func (AlertProperties) MarshalJSON added in v1.1.0

func (a AlertProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AlertProperties.

func (*AlertProperties) UnmarshalJSON added in v1.1.0

func (a *AlertProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AlertProperties.

type AlertPropertiesDefinition

type AlertPropertiesDefinition struct {
	// Alert category
	Category *AlertCategory

	// Criteria that triggered alert
	Criteria *AlertCriteria

	// type of alert
	Type *AlertType
}

AlertPropertiesDefinition - defines the type of alert

func (AlertPropertiesDefinition) MarshalJSON added in v1.1.0

func (a AlertPropertiesDefinition) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AlertPropertiesDefinition.

func (*AlertPropertiesDefinition) UnmarshalJSON added in v1.1.0

func (a *AlertPropertiesDefinition) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AlertPropertiesDefinition.

type AlertPropertiesDetails

type AlertPropertiesDetails struct {
	// budget threshold amount
	Amount *float64

	// company name
	CompanyName *string

	// list of emails to contact
	ContactEmails []*string

	// list of action groups to broadcast to
	ContactGroups []*string

	// list of contact roles
	ContactRoles []*string

	// current spend
	CurrentSpend *float64

	// department name
	DepartmentName *string

	// datetime of enrollmentEndDate
	EnrollmentEndDate *string

	// enrollment number
	EnrollmentNumber *string

	// datetime of enrollmentStartDate
	EnrollmentStartDate *string

	// invoicing threshold
	InvoicingThreshold *float64

	// array of meters to filter by
	MeterFilter []any

	// operator used to compare currentSpend with amount
	Operator *AlertOperator

	// overriding alert
	OverridingAlert *string

	// datetime of periodStartDate
	PeriodStartDate *string

	// array of resources to filter by
	ResourceFilter []any

	// array of resourceGroups to filter by
	ResourceGroupFilter []any

	// tags to filter by
	TagFilter any

	// notification threshold percentage as a decimal which activated this alert
	Threshold *float64

	// Type of timegrain cadence
	TimeGrainType *AlertTimeGrainType

	// notificationId that triggered this alert
	TriggeredBy *string

	// unit of currency being used
	Unit *string
}

AlertPropertiesDetails - Alert details

func (AlertPropertiesDetails) MarshalJSON

func (a AlertPropertiesDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AlertPropertiesDetails.

func (*AlertPropertiesDetails) UnmarshalJSON added in v1.1.0

func (a *AlertPropertiesDetails) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AlertPropertiesDetails.

type AlertSource

type AlertSource string

AlertSource - Source of alert

const (
	AlertSourcePreset AlertSource = "Preset"
	AlertSourceUser   AlertSource = "User"
)

func PossibleAlertSourceValues

func PossibleAlertSourceValues() []AlertSource

PossibleAlertSourceValues returns the possible values for the AlertSource const type.

type AlertStatus

type AlertStatus string

AlertStatus - alert status

const (
	AlertStatusActive     AlertStatus = "Active"
	AlertStatusDismissed  AlertStatus = "Dismissed"
	AlertStatusNone       AlertStatus = "None"
	AlertStatusOverridden AlertStatus = "Overridden"
	AlertStatusResolved   AlertStatus = "Resolved"
)

func PossibleAlertStatusValues

func PossibleAlertStatusValues() []AlertStatus

PossibleAlertStatusValues returns the possible values for the AlertStatus const type.

type AlertTimeGrainType

type AlertTimeGrainType string

AlertTimeGrainType - Type of timegrain cadence

const (
	AlertTimeGrainTypeAnnually       AlertTimeGrainType = "Annually"
	AlertTimeGrainTypeBillingAnnual  AlertTimeGrainType = "BillingAnnual"
	AlertTimeGrainTypeBillingMonth   AlertTimeGrainType = "BillingMonth"
	AlertTimeGrainTypeBillingQuarter AlertTimeGrainType = "BillingQuarter"
	AlertTimeGrainTypeMonthly        AlertTimeGrainType = "Monthly"
	AlertTimeGrainTypeNone           AlertTimeGrainType = "None"
	AlertTimeGrainTypeQuarterly      AlertTimeGrainType = "Quarterly"
)

func PossibleAlertTimeGrainTypeValues

func PossibleAlertTimeGrainTypeValues() []AlertTimeGrainType

PossibleAlertTimeGrainTypeValues returns the possible values for the AlertTimeGrainType const type.

type AlertType

type AlertType string

AlertType - type of alert

const (
	AlertTypeBudget         AlertType = "Budget"
	AlertTypeBudgetForecast AlertType = "BudgetForecast"
	AlertTypeCredit         AlertType = "Credit"
	AlertTypeGeneral        AlertType = "General"
	AlertTypeInvoice        AlertType = "Invoice"
	AlertTypeQuota          AlertType = "Quota"
	AlertTypeXCloud         AlertType = "xCloud"
)

func PossibleAlertTypeValues

func PossibleAlertTypeValues() []AlertType

PossibleAlertTypeValues returns the possible values for the AlertType const type.

type AlertsClient

type AlertsClient struct {
	// contains filtered or unexported fields
}

AlertsClient contains the methods for the Alerts group. Don't use this type directly, use NewAlertsClient() instead.

func NewAlertsClient

func NewAlertsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertsClient, error)

NewAlertsClient creates a new instance of AlertsClient with the specified values.

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*AlertsClient) Dismiss

func (client *AlertsClient) Dismiss(ctx context.Context, scope string, alertID string, parameters DismissAlertPayload, options *AlertsClientDismissOptions) (AlertsClientDismissResponse, error)

Dismiss - Dismisses the specified alert If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • scope - The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.
  • alertID - Alert ID
  • parameters - Parameters supplied to the Dismiss Alert operation.
  • options - AlertsClientDismissOptions contains the optional parameters for the AlertsClient.Dismiss method.
Example (PatchResourceGroupAlerts)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/DismissResourceGroupAlerts.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAlertsClient().Dismiss(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", "22222222-2222-2222-2222-222222222222", armcostmanagement.DismissAlertPayload{
		Properties: &armcostmanagement.AlertProperties{
			Status: to.Ptr(armcostmanagement.AlertStatusDismissed),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.Alert = armcostmanagement.Alert{
	// 	Name: to.Ptr("22222222-2222-2222-2222-222222222222"),
	// 	Type: to.Ptr("Microsoft.CostManagement/alerts"),
	// 	ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer/providers/Microsoft.CostManagement/alerts/22222222-2222-2222-2222-222222222222"),
	// 	Properties: &armcostmanagement.AlertProperties{
	// 		Description: to.Ptr(""),
	// 		CloseTime: to.Ptr("0001-01-01T00:00:00"),
	// 		CostEntityID: to.Ptr("budget1"),
	// 		CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"),
	// 		Definition: &armcostmanagement.AlertPropertiesDefinition{
	// 			Type: to.Ptr(armcostmanagement.AlertTypeBudget),
	// 			Category: to.Ptr(armcostmanagement.AlertCategoryCost),
	// 			Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded),
	// 		},
	// 		ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"),
	// 		Source: to.Ptr(armcostmanagement.AlertSourcePreset),
	// 		Status: to.Ptr(armcostmanagement.AlertStatusDismissed),
	// 		StatusModificationTime: to.Ptr("0001-01-01T00:00:00"),
	// 		Details: &armcostmanagement.AlertPropertiesDetails{
	// 			Amount: to.Ptr[float64](200000),
	// 			ContactEmails: []*string{
	// 				to.Ptr("1234@contoso.com")},
	// 				ContactGroups: []*string{
	// 				},
	// 				ContactRoles: []*string{
	// 				},
	// 				CurrentSpend: to.Ptr[float64](161000.12),
	// 				MeterFilter: []any{
	// 				},
	// 				Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan),
	// 				PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"),
	// 				ResourceFilter: []any{
	// 				},
	// 				ResourceGroupFilter: []any{
	// 				},
	// 				TagFilter: map[string]any{
	// 				},
	// 				Threshold: to.Ptr[float64](0.8),
	// 				TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly),
	// 				TriggeredBy: to.Ptr("22222222-2222-2222-2222-222222222222_1_01"),
	// 				Unit: to.Ptr("USD"),
	// 			},
	// 		},
	// 	}
}
Output:

Example (PatchSubscriptionAlerts)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/DismissSubscriptionAlerts.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAlertsClient().Dismiss(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "22222222-2222-2222-2222-222222222222", armcostmanagement.DismissAlertPayload{
		Properties: &armcostmanagement.AlertProperties{
			Status: to.Ptr(armcostmanagement.AlertStatusDismissed),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.Alert = armcostmanagement.Alert{
	// 	Name: to.Ptr("22222222-2222-2222-2222-222222222222"),
	// 	Type: to.Ptr("Microsoft.CostManagement/alerts"),
	// 	ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/alerts/22222222-2222-2222-2222-222222222222"),
	// 	Properties: &armcostmanagement.AlertProperties{
	// 		Description: to.Ptr(""),
	// 		CloseTime: to.Ptr("0001-01-01T00:00:00"),
	// 		CostEntityID: to.Ptr("budget1"),
	// 		CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"),
	// 		Definition: &armcostmanagement.AlertPropertiesDefinition{
	// 			Type: to.Ptr(armcostmanagement.AlertTypeBudget),
	// 			Category: to.Ptr(armcostmanagement.AlertCategoryCost),
	// 			Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded),
	// 		},
	// 		ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"),
	// 		Source: to.Ptr(armcostmanagement.AlertSourcePreset),
	// 		Status: to.Ptr(armcostmanagement.AlertStatusDismissed),
	// 		StatusModificationTime: to.Ptr("0001-01-01T00:00:00"),
	// 		Details: &armcostmanagement.AlertPropertiesDetails{
	// 			Amount: to.Ptr[float64](200000),
	// 			ContactEmails: []*string{
	// 				to.Ptr("1234@contoso.com")},
	// 				ContactGroups: []*string{
	// 				},
	// 				ContactRoles: []*string{
	// 				},
	// 				CurrentSpend: to.Ptr[float64](161000.12),
	// 				MeterFilter: []any{
	// 				},
	// 				Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan),
	// 				PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"),
	// 				ResourceFilter: []any{
	// 				},
	// 				ResourceGroupFilter: []any{
	// 				},
	// 				TagFilter: map[string]any{
	// 				},
	// 				Threshold: to.Ptr[float64](0.8),
	// 				TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly),
	// 				TriggeredBy: to.Ptr("22222222-2222-2222-2222-222222222222_1_01"),
	// 				Unit: to.Ptr("USD"),
	// 			},
	// 		},
	// 	}
}
Output:

func (*AlertsClient) Get

func (client *AlertsClient) Get(ctx context.Context, scope string, alertID string, options *AlertsClientGetOptions) (AlertsClientGetResponse, error)

Get - Gets the alert for the scope by alert ID. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • scope - The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.
  • alertID - Alert ID
  • options - AlertsClientGetOptions contains the optional parameters for the AlertsClient.Get method.
Example (SingleResourceGroupAlerts)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/SingleResourceGroupAlert.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAlertsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", "22222222-2222-2222-2222-222222222222", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.Alert = armcostmanagement.Alert{
	// 	Name: to.Ptr("22222222-2222-2222-2222-222222222222"),
	// 	Type: to.Ptr("Microsoft.CostManagement/alerts"),
	// 	ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer/providers/Microsoft.CostManagement/alerts/22222222-2222-2222-2222-222222222222"),
	// 	Properties: &armcostmanagement.AlertProperties{
	// 		Description: to.Ptr(""),
	// 		CloseTime: to.Ptr("0001-01-01T00:00:00"),
	// 		CostEntityID: to.Ptr("budget1"),
	// 		CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"),
	// 		Definition: &armcostmanagement.AlertPropertiesDefinition{
	// 			Type: to.Ptr(armcostmanagement.AlertTypeBudget),
	// 			Category: to.Ptr(armcostmanagement.AlertCategoryCost),
	// 			Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded),
	// 		},
	// 		ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"),
	// 		Source: to.Ptr(armcostmanagement.AlertSourcePreset),
	// 		Status: to.Ptr(armcostmanagement.AlertStatusActive),
	// 		StatusModificationTime: to.Ptr("0001-01-01T00:00:00"),
	// 		Details: &armcostmanagement.AlertPropertiesDetails{
	// 			Amount: to.Ptr[float64](200000),
	// 			ContactEmails: []*string{
	// 				to.Ptr("1234@contoso.com")},
	// 				ContactGroups: []*string{
	// 				},
	// 				ContactRoles: []*string{
	// 				},
	// 				CurrentSpend: to.Ptr[float64](161000.12),
	// 				MeterFilter: []any{
	// 				},
	// 				Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan),
	// 				PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"),
	// 				ResourceFilter: []any{
	// 				},
	// 				ResourceGroupFilter: []any{
	// 				},
	// 				TagFilter: map[string]any{
	// 				},
	// 				Threshold: to.Ptr[float64](0.8),
	// 				TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly),
	// 				TriggeredBy: to.Ptr("22222222-2222-2222-2222-222222222222_1_01"),
	// 				Unit: to.Ptr("USD"),
	// 			},
	// 		},
	// 	}
}
Output:

Example (SingleSubscriptionAlerts)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/SingleSubscriptionAlert.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAlertsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "22222222-2222-2222-2222-222222222222", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.Alert = armcostmanagement.Alert{
	// 	Name: to.Ptr("22222222-2222-2222-2222-222222222222"),
	// 	Type: to.Ptr("Microsoft.CostManagement/alerts"),
	// 	ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/alerts/22222222-2222-2222-2222-222222222222"),
	// 	Properties: &armcostmanagement.AlertProperties{
	// 		Description: to.Ptr(""),
	// 		CloseTime: to.Ptr("0001-01-01T00:00:00"),
	// 		CostEntityID: to.Ptr("budget1"),
	// 		CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"),
	// 		Definition: &armcostmanagement.AlertPropertiesDefinition{
	// 			Type: to.Ptr(armcostmanagement.AlertTypeBudget),
	// 			Category: to.Ptr(armcostmanagement.AlertCategoryCost),
	// 			Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded),
	// 		},
	// 		ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"),
	// 		Source: to.Ptr(armcostmanagement.AlertSourcePreset),
	// 		Status: to.Ptr(armcostmanagement.AlertStatusActive),
	// 		StatusModificationTime: to.Ptr("0001-01-01T00:00:00"),
	// 		Details: &armcostmanagement.AlertPropertiesDetails{
	// 			Amount: to.Ptr[float64](200000),
	// 			ContactEmails: []*string{
	// 				to.Ptr("1234@contoso.com")},
	// 				ContactGroups: []*string{
	// 				},
	// 				ContactRoles: []*string{
	// 				},
	// 				CurrentSpend: to.Ptr[float64](161000.12),
	// 				MeterFilter: []any{
	// 				},
	// 				Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan),
	// 				PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"),
	// 				ResourceFilter: []any{
	// 				},
	// 				ResourceGroupFilter: []any{
	// 				},
	// 				TagFilter: map[string]any{
	// 				},
	// 				Threshold: to.Ptr[float64](0.8),
	// 				TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly),
	// 				TriggeredBy: to.Ptr("22222222-2222-2222-2222-222222222222_1_01"),
	// 				Unit: to.Ptr("USD"),
	// 			},
	// 		},
	// 	}
}
Output:

func (*AlertsClient) List

List - Lists the alerts for scope defined. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • scope - The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.
  • options - AlertsClientListOptions contains the optional parameters for the AlertsClient.List method.
Example (BillingAccountAlerts)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingAccountAlerts.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAlertsClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.AlertsResult = armcostmanagement.AlertsResult{
	// 	Value: []*armcostmanagement.Alert{
	// 		{
	// 			Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 			Type: to.Ptr("Microsoft.CostManagement/alerts"),
	// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/providers/Microsoft.CostManagement/alerts/00000000-0000-0000-0000-000000000000"),
	// 			Properties: &armcostmanagement.AlertProperties{
	// 				Description: to.Ptr(""),
	// 				CloseTime: to.Ptr("0001-01-01T00:00:00"),
	// 				CostEntityID: to.Ptr("budget1"),
	// 				CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"),
	// 				Definition: &armcostmanagement.AlertPropertiesDefinition{
	// 					Type: to.Ptr(armcostmanagement.AlertTypeBudget),
	// 					Category: to.Ptr(armcostmanagement.AlertCategoryCost),
	// 					Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded),
	// 				},
	// 				ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"),
	// 				Source: to.Ptr(armcostmanagement.AlertSourcePreset),
	// 				Status: to.Ptr(armcostmanagement.AlertStatusActive),
	// 				StatusModificationTime: to.Ptr("0001-01-01T00:00:00"),
	// 				Details: &armcostmanagement.AlertPropertiesDetails{
	// 					Amount: to.Ptr[float64](200000),
	// 					ContactEmails: []*string{
	// 						to.Ptr("1234@contoso.com")},
	// 						ContactGroups: []*string{
	// 						},
	// 						ContactRoles: []*string{
	// 						},
	// 						CurrentSpend: to.Ptr[float64](161000.12),
	// 						MeterFilter: []any{
	// 						},
	// 						Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan),
	// 						PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"),
	// 						ResourceFilter: []any{
	// 						},
	// 						ResourceGroupFilter: []any{
	// 						},
	// 						TagFilter: map[string]any{
	// 						},
	// 						Threshold: to.Ptr[float64](0.8),
	// 						TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly),
	// 						TriggeredBy: to.Ptr("00000000-0000-0000-0000-000000000000_1_01"),
	// 						Unit: to.Ptr("USD"),
	// 					},
	// 				},
	// 			},
	// 			{
	// 				Name: to.Ptr("11111111-1111-1111-111111111111"),
	// 				Type: to.Ptr("Microsoft.CostManagement/alerts"),
	// 				ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/providers/Microsoft.CostManagement/alerts/11111111-1111-1111-111111111111"),
	// 				Properties: &armcostmanagement.AlertProperties{
	// 					Description: to.Ptr(""),
	// 					CloseTime: to.Ptr("0001-01-01T00:00:00"),
	// 					CostEntityID: to.Ptr("budget1"),
	// 					CreationTime: to.Ptr("2019-06-24T05:51:52.8713179Z"),
	// 					Definition: &armcostmanagement.AlertPropertiesDefinition{
	// 						Type: to.Ptr(armcostmanagement.AlertTypeBudget),
	// 						Category: to.Ptr(armcostmanagement.AlertCategoryCost),
	// 						Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded),
	// 					},
	// 					ModificationTime: to.Ptr("2019-08-31T17:51:55.1808807Z"),
	// 					Source: to.Ptr(armcostmanagement.AlertSourcePreset),
	// 					Status: to.Ptr(armcostmanagement.AlertStatusActive),
	// 					StatusModificationTime: to.Ptr("0001-01-01T00:00:00"),
	// 					Details: &armcostmanagement.AlertPropertiesDetails{
	// 						Amount: to.Ptr[float64](200000),
	// 						ContactEmails: []*string{
	// 							to.Ptr("1234@contoso.com")},
	// 							ContactGroups: []*string{
	// 							},
	// 							ContactRoles: []*string{
	// 							},
	// 							CurrentSpend: to.Ptr[float64](171000.32),
	// 							MeterFilter: []any{
	// 							},
	// 							Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan),
	// 							PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"),
	// 							ResourceFilter: []any{
	// 							},
	// 							ResourceGroupFilter: []any{
	// 							},
	// 							TagFilter: map[string]any{
	// 							},
	// 							Threshold: to.Ptr[float64](0.8),
	// 							TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly),
	// 							TriggeredBy: to.Ptr("11111111-1111-1111-111111111111_1_01"),
	// 							Unit: to.Ptr("USD"),
	// 						},
	// 					},
	// 			}},
	// 		}
}
Output:

Example (BillingProfileAlerts)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingProfileAlerts.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAlertsClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.AlertsResult = armcostmanagement.AlertsResult{
	// 	Value: []*armcostmanagement.Alert{
	// 		{
	// 			Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 			Type: to.Ptr("Microsoft.CostManagement/alerts"),
	// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/alerts/00000000-0000-0000-0000-000000000000"),
	// 			Properties: &armcostmanagement.AlertProperties{
	// 				Description: to.Ptr(""),
	// 				CloseTime: to.Ptr("0001-01-01T00:00:00"),
	// 				CostEntityID: to.Ptr("budget1"),
	// 				CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"),
	// 				Definition: &armcostmanagement.AlertPropertiesDefinition{
	// 					Type: to.Ptr(armcostmanagement.AlertTypeBudget),
	// 					Category: to.Ptr(armcostmanagement.AlertCategoryCost),
	// 					Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded),
	// 				},
	// 				ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"),
	// 				Source: to.Ptr(armcostmanagement.AlertSourcePreset),
	// 				Status: to.Ptr(armcostmanagement.AlertStatusActive),
	// 				StatusModificationTime: to.Ptr("0001-01-01T00:00:00"),
	// 				Details: &armcostmanagement.AlertPropertiesDetails{
	// 					Amount: to.Ptr[float64](200000),
	// 					ContactEmails: []*string{
	// 						to.Ptr("1234@contoso.com")},
	// 						ContactGroups: []*string{
	// 						},
	// 						ContactRoles: []*string{
	// 						},
	// 						CurrentSpend: to.Ptr[float64](161000.12),
	// 						MeterFilter: []any{
	// 						},
	// 						Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan),
	// 						PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"),
	// 						ResourceFilter: []any{
	// 						},
	// 						ResourceGroupFilter: []any{
	// 						},
	// 						TagFilter: map[string]any{
	// 						},
	// 						Threshold: to.Ptr[float64](0.8),
	// 						TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly),
	// 						TriggeredBy: to.Ptr("00000000-0000-0000-0000-000000000000_1_01"),
	// 						Unit: to.Ptr("USD"),
	// 					},
	// 				},
	// 			},
	// 			{
	// 				Name: to.Ptr("11111111-1111-1111-111111111111"),
	// 				Type: to.Ptr("Microsoft.CostManagement/alerts"),
	// 				ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/alerts/11111111-1111-1111-111111111111"),
	// 				Properties: &armcostmanagement.AlertProperties{
	// 					Description: to.Ptr(""),
	// 					CloseTime: to.Ptr("0001-01-01T00:00:00"),
	// 					CostEntityID: to.Ptr("budget1"),
	// 					CreationTime: to.Ptr("2019-06-24T05:51:52.8713179Z"),
	// 					Definition: &armcostmanagement.AlertPropertiesDefinition{
	// 						Type: to.Ptr(armcostmanagement.AlertTypeBudget),
	// 						Category: to.Ptr(armcostmanagement.AlertCategoryCost),
	// 						Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded),
	// 					},
	// 					ModificationTime: to.Ptr("2019-08-31T17:51:55.1808807Z"),
	// 					Source: to.Ptr(armcostmanagement.AlertSourcePreset),
	// 					Status: to.Ptr(armcostmanagement.AlertStatusActive),
	// 					StatusModificationTime: to.Ptr("0001-01-01T00:00:00"),
	// 					Details: &armcostmanagement.AlertPropertiesDetails{
	// 						Amount: to.Ptr[float64](200000),
	// 						ContactEmails: []*string{
	// 							to.Ptr("1234@contoso.com")},
	// 							ContactGroups: []*string{
	// 							},
	// 							ContactRoles: []*string{
	// 							},
	// 							CurrentSpend: to.Ptr[float64](171000.32),
	// 							MeterFilter: []any{
	// 							},
	// 							Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan),
	// 							PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"),
	// 							ResourceFilter: []any{
	// 							},
	// 							ResourceGroupFilter: []any{
	// 							},
	// 							TagFilter: map[string]any{
	// 							},
	// 							Threshold: to.Ptr[float64](0.8),
	// 							TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly),
	// 							TriggeredBy: to.Ptr("11111111-1111-1111-111111111111_1_01"),
	// 							Unit: to.Ptr("USD"),
	// 						},
	// 					},
	// 			}},
	// 		}
}
Output:

Example (DepartmentAlerts)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/DepartmentAlerts.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAlertsClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.AlertsResult = armcostmanagement.AlertsResult{
	// 	Value: []*armcostmanagement.Alert{
	// 		{
	// 			Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 			Type: to.Ptr("Microsoft.CostManagement/alerts"),
	// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123/providers/Microsoft.CostManagement/alerts/00000000-0000-0000-0000-000000000000"),
	// 			Properties: &armcostmanagement.AlertProperties{
	// 				Description: to.Ptr(""),
	// 				CloseTime: to.Ptr("0001-01-01T00:00:00"),
	// 				CostEntityID: to.Ptr("budget1"),
	// 				CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"),
	// 				Definition: &armcostmanagement.AlertPropertiesDefinition{
	// 					Type: to.Ptr(armcostmanagement.AlertTypeBudget),
	// 					Category: to.Ptr(armcostmanagement.AlertCategoryCost),
	// 					Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded),
	// 				},
	// 				ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"),
	// 				Source: to.Ptr(armcostmanagement.AlertSourcePreset),
	// 				Status: to.Ptr(armcostmanagement.AlertStatusActive),
	// 				StatusModificationTime: to.Ptr("0001-01-01T00:00:00"),
	// 				Details: &armcostmanagement.AlertPropertiesDetails{
	// 					Amount: to.Ptr[float64](200000),
	// 					ContactEmails: []*string{
	// 						to.Ptr("1234@contoso.com")},
	// 						ContactGroups: []*string{
	// 						},
	// 						ContactRoles: []*string{
	// 						},
	// 						CurrentSpend: to.Ptr[float64](161000.12),
	// 						MeterFilter: []any{
	// 						},
	// 						Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan),
	// 						PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"),
	// 						ResourceFilter: []any{
	// 						},
	// 						ResourceGroupFilter: []any{
	// 						},
	// 						TagFilter: map[string]any{
	// 						},
	// 						Threshold: to.Ptr[float64](0.8),
	// 						TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly),
	// 						TriggeredBy: to.Ptr("00000000-0000-0000-0000-000000000000_1_01"),
	// 						Unit: to.Ptr("USD"),
	// 					},
	// 				},
	// 			},
	// 			{
	// 				Name: to.Ptr("11111111-1111-1111-111111111111"),
	// 				Type: to.Ptr("Microsoft.CostManagement/alerts"),
	// 				ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123/providers/Microsoft.CostManagement/alerts/11111111-1111-1111-111111111111"),
	// 				Properties: &armcostmanagement.AlertProperties{
	// 					Description: to.Ptr(""),
	// 					CloseTime: to.Ptr("0001-01-01T00:00:00"),
	// 					CostEntityID: to.Ptr("budget1"),
	// 					CreationTime: to.Ptr("2019-06-24T05:51:52.8713179Z"),
	// 					Definition: &armcostmanagement.AlertPropertiesDefinition{
	// 						Type: to.Ptr(armcostmanagement.AlertTypeBudget),
	// 						Category: to.Ptr(armcostmanagement.AlertCategoryCost),
	// 						Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded),
	// 					},
	// 					ModificationTime: to.Ptr("2019-08-31T17:51:55.1808807Z"),
	// 					Source: to.Ptr(armcostmanagement.AlertSourcePreset),
	// 					Status: to.Ptr(armcostmanagement.AlertStatusActive),
	// 					StatusModificationTime: to.Ptr("0001-01-01T00:00:00"),
	// 					Details: &armcostmanagement.AlertPropertiesDetails{
	// 						Amount: to.Ptr[float64](200000),
	// 						ContactEmails: []*string{
	// 							to.Ptr("1234@contoso.com")},
	// 							ContactGroups: []*string{
	// 							},
	// 							ContactRoles: []*string{
	// 							},
	// 							CurrentSpend: to.Ptr[float64](171000.32),
	// 							MeterFilter: []any{
	// 							},
	// 							Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan),
	// 							PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"),
	// 							ResourceFilter: []any{
	// 							},
	// 							ResourceGroupFilter: []any{
	// 							},
	// 							TagFilter: map[string]any{
	// 							},
	// 							Threshold: to.Ptr[float64](0.8),
	// 							TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly),
	// 							TriggeredBy: to.Ptr("11111111-1111-1111-111111111111_1_01"),
	// 							Unit: to.Ptr("USD"),
	// 						},
	// 					},
	// 			}},
	// 		}
}
Output:

Example (EnrollmentAccountAlerts)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/EnrollmentAccountAlerts.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAlertsClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.AlertsResult = armcostmanagement.AlertsResult{
	// 	Value: []*armcostmanagement.Alert{
	// 		{
	// 			Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 			Type: to.Ptr("Microsoft.CostManagement/alerts"),
	// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456/providers/Microsoft.CostManagement/alerts/00000000-0000-0000-0000-000000000000"),
	// 			Properties: &armcostmanagement.AlertProperties{
	// 				Description: to.Ptr(""),
	// 				CloseTime: to.Ptr("0001-01-01T00:00:00"),
	// 				CostEntityID: to.Ptr("budget1"),
	// 				CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"),
	// 				Definition: &armcostmanagement.AlertPropertiesDefinition{
	// 					Type: to.Ptr(armcostmanagement.AlertTypeBudget),
	// 					Category: to.Ptr(armcostmanagement.AlertCategoryCost),
	// 					Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded),
	// 				},
	// 				ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"),
	// 				Source: to.Ptr(armcostmanagement.AlertSourcePreset),
	// 				Status: to.Ptr(armcostmanagement.AlertStatusActive),
	// 				StatusModificationTime: to.Ptr("0001-01-01T00:00:00"),
	// 				Details: &armcostmanagement.AlertPropertiesDetails{
	// 					Amount: to.Ptr[float64](200000),
	// 					ContactEmails: []*string{
	// 						to.Ptr("1234@contoso.com")},
	// 						ContactGroups: []*string{
	// 						},
	// 						ContactRoles: []*string{
	// 						},
	// 						CurrentSpend: to.Ptr[float64](161000.12),
	// 						MeterFilter: []any{
	// 						},
	// 						Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan),
	// 						PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"),
	// 						ResourceFilter: []any{
	// 						},
	// 						ResourceGroupFilter: []any{
	// 						},
	// 						TagFilter: map[string]any{
	// 						},
	// 						Threshold: to.Ptr[float64](0.8),
	// 						TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly),
	// 						TriggeredBy: to.Ptr("00000000-0000-0000-0000-000000000000_1_01"),
	// 						Unit: to.Ptr("USD"),
	// 					},
	// 				},
	// 			},
	// 			{
	// 				Name: to.Ptr("11111111-1111-1111-111111111111"),
	// 				Type: to.Ptr("Microsoft.CostManagement/alerts"),
	// 				ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456/providers/Microsoft.CostManagement/alerts/11111111-1111-1111-111111111111"),
	// 				Properties: &armcostmanagement.AlertProperties{
	// 					Description: to.Ptr(""),
	// 					CloseTime: to.Ptr("0001-01-01T00:00:00"),
	// 					CostEntityID: to.Ptr("budget1"),
	// 					CreationTime: to.Ptr("2019-06-24T05:51:52.8713179Z"),
	// 					Definition: &armcostmanagement.AlertPropertiesDefinition{
	// 						Type: to.Ptr(armcostmanagement.AlertTypeBudget),
	// 						Category: to.Ptr(armcostmanagement.AlertCategoryCost),
	// 						Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded),
	// 					},
	// 					ModificationTime: to.Ptr("2019-08-31T17:51:55.1808807Z"),
	// 					Source: to.Ptr(armcostmanagement.AlertSourcePreset),
	// 					Status: to.Ptr(armcostmanagement.AlertStatusActive),
	// 					StatusModificationTime: to.Ptr("0001-01-01T00:00:00"),
	// 					Details: &armcostmanagement.AlertPropertiesDetails{
	// 						Amount: to.Ptr[float64](200000),
	// 						ContactEmails: []*string{
	// 							to.Ptr("1234@contoso.com")},
	// 							ContactGroups: []*string{
	// 							},
	// 							ContactRoles: []*string{
	// 							},
	// 							CurrentSpend: to.Ptr[float64](171000.32),
	// 							MeterFilter: []any{
	// 							},
	// 							Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan),
	// 							PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"),
	// 							ResourceFilter: []any{
	// 							},
	// 							ResourceGroupFilter: []any{
	// 							},
	// 							TagFilter: map[string]any{
	// 							},
	// 							Threshold: to.Ptr[float64](0.8),
	// 							TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly),
	// 							TriggeredBy: to.Ptr("11111111-1111-1111-111111111111_1_01"),
	// 							Unit: to.Ptr("USD"),
	// 						},
	// 					},
	// 			}},
	// 		}
}
Output:

Example (InvoiceSectionAlerts)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/InvoiceSectionAlerts.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAlertsClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.AlertsResult = armcostmanagement.AlertsResult{
	// 	Value: []*armcostmanagement.Alert{
	// 		{
	// 			Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 			Type: to.Ptr("Microsoft.CostManagement/alerts"),
	// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/Microsoft.CostManagement/alerts/00000000-0000-0000-0000-000000000000"),
	// 			Properties: &armcostmanagement.AlertProperties{
	// 				Description: to.Ptr(""),
	// 				CloseTime: to.Ptr("0001-01-01T00:00:00"),
	// 				CostEntityID: to.Ptr("budget1"),
	// 				CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"),
	// 				Definition: &armcostmanagement.AlertPropertiesDefinition{
	// 					Type: to.Ptr(armcostmanagement.AlertTypeBudget),
	// 					Category: to.Ptr(armcostmanagement.AlertCategoryCost),
	// 					Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded),
	// 				},
	// 				ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"),
	// 				Source: to.Ptr(armcostmanagement.AlertSourcePreset),
	// 				Status: to.Ptr(armcostmanagement.AlertStatusActive),
	// 				StatusModificationTime: to.Ptr("0001-01-01T00:00:00"),
	// 				Details: &armcostmanagement.AlertPropertiesDetails{
	// 					Amount: to.Ptr[float64](200000),
	// 					ContactEmails: []*string{
	// 						to.Ptr("1234@contoso.com")},
	// 						ContactGroups: []*string{
	// 						},
	// 						ContactRoles: []*string{
	// 						},
	// 						CurrentSpend: to.Ptr[float64](161000.12),
	// 						MeterFilter: []any{
	// 						},
	// 						Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan),
	// 						PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"),
	// 						ResourceFilter: []any{
	// 						},
	// 						ResourceGroupFilter: []any{
	// 						},
	// 						TagFilter: map[string]any{
	// 						},
	// 						Threshold: to.Ptr[float64](0.8),
	// 						TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly),
	// 						TriggeredBy: to.Ptr("00000000-0000-0000-0000-000000000000_1_01"),
	// 						Unit: to.Ptr("USD"),
	// 					},
	// 				},
	// 			},
	// 			{
	// 				Name: to.Ptr("11111111-1111-1111-111111111111"),
	// 				Type: to.Ptr("Microsoft.CostManagement/alerts"),
	// 				ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/Microsoft.CostManagement/alerts/11111111-1111-1111-111111111111"),
	// 				Properties: &armcostmanagement.AlertProperties{
	// 					Description: to.Ptr(""),
	// 					CloseTime: to.Ptr("0001-01-01T00:00:00"),
	// 					CostEntityID: to.Ptr("budget1"),
	// 					CreationTime: to.Ptr("2019-06-24T05:51:52.8713179Z"),
	// 					Definition: &armcostmanagement.AlertPropertiesDefinition{
	// 						Type: to.Ptr(armcostmanagement.AlertTypeBudget),
	// 						Category: to.Ptr(armcostmanagement.AlertCategoryCost),
	// 						Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded),
	// 					},
	// 					ModificationTime: to.Ptr("2019-08-31T17:51:55.1808807Z"),
	// 					Source: to.Ptr(armcostmanagement.AlertSourcePreset),
	// 					Status: to.Ptr(armcostmanagement.AlertStatusActive),
	// 					StatusModificationTime: to.Ptr("0001-01-01T00:00:00"),
	// 					Details: &armcostmanagement.AlertPropertiesDetails{
	// 						Amount: to.Ptr[float64](200000),
	// 						ContactEmails: []*string{
	// 							to.Ptr("1234@contoso.com")},
	// 							ContactGroups: []*string{
	// 							},
	// 							ContactRoles: []*string{
	// 							},
	// 							CurrentSpend: to.Ptr[float64](171000.32),
	// 							MeterFilter: []any{
	// 							},
	// 							Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan),
	// 							PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"),
	// 							ResourceFilter: []any{
	// 							},
	// 							ResourceGroupFilter: []any{
	// 							},
	// 							TagFilter: map[string]any{
	// 							},
	// 							Threshold: to.Ptr[float64](0.8),
	// 							TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly),
	// 							TriggeredBy: to.Ptr("11111111-1111-1111-111111111111_1_01"),
	// 							Unit: to.Ptr("USD"),
	// 						},
	// 					},
	// 			}},
	// 		}
}
Output:

Example (ResourceGroupAlerts)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ResourceGroupAlerts.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAlertsClient().List(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.AlertsResult = armcostmanagement.AlertsResult{
	// 	Value: []*armcostmanagement.Alert{
	// 		{
	// 			Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 			Type: to.Ptr("Microsoft.CostManagement/alerts"),
	// 			ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer/providers/Microsoft.CostManagement/alerts/00000000-0000-0000-0000-000000000000"),
	// 			Properties: &armcostmanagement.AlertProperties{
	// 				Description: to.Ptr(""),
	// 				CloseTime: to.Ptr("0001-01-01T00:00:00"),
	// 				CostEntityID: to.Ptr("budget1"),
	// 				CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"),
	// 				Definition: &armcostmanagement.AlertPropertiesDefinition{
	// 					Type: to.Ptr(armcostmanagement.AlertTypeBudget),
	// 					Category: to.Ptr(armcostmanagement.AlertCategoryCost),
	// 					Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded),
	// 				},
	// 				ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"),
	// 				Source: to.Ptr(armcostmanagement.AlertSourcePreset),
	// 				Status: to.Ptr(armcostmanagement.AlertStatusActive),
	// 				StatusModificationTime: to.Ptr("0001-01-01T00:00:00"),
	// 				Details: &armcostmanagement.AlertPropertiesDetails{
	// 					Amount: to.Ptr[float64](200000),
	// 					ContactEmails: []*string{
	// 						to.Ptr("1234@contoso.com")},
	// 						ContactGroups: []*string{
	// 						},
	// 						ContactRoles: []*string{
	// 						},
	// 						CurrentSpend: to.Ptr[float64](161000.12),
	// 						MeterFilter: []any{
	// 						},
	// 						Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan),
	// 						PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"),
	// 						ResourceFilter: []any{
	// 						},
	// 						ResourceGroupFilter: []any{
	// 						},
	// 						TagFilter: map[string]any{
	// 						},
	// 						Threshold: to.Ptr[float64](0.8),
	// 						TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly),
	// 						TriggeredBy: to.Ptr("00000000-0000-0000-0000-000000000000_1_01"),
	// 						Unit: to.Ptr("USD"),
	// 					},
	// 				},
	// 			},
	// 			{
	// 				Name: to.Ptr("11111111-1111-1111-111111111111"),
	// 				Type: to.Ptr("Microsoft.CostManagement/alerts"),
	// 				ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer/providers/Microsoft.CostManagement/alerts/11111111-1111-1111-111111111111"),
	// 				Properties: &armcostmanagement.AlertProperties{
	// 					Description: to.Ptr(""),
	// 					CloseTime: to.Ptr("0001-01-01T00:00:00"),
	// 					CostEntityID: to.Ptr("budget1"),
	// 					CreationTime: to.Ptr("2019-06-24T05:51:52.8713179Z"),
	// 					Definition: &armcostmanagement.AlertPropertiesDefinition{
	// 						Type: to.Ptr(armcostmanagement.AlertTypeBudget),
	// 						Category: to.Ptr(armcostmanagement.AlertCategoryCost),
	// 						Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded),
	// 					},
	// 					ModificationTime: to.Ptr("2019-08-31T17:51:55.1808807Z"),
	// 					Source: to.Ptr(armcostmanagement.AlertSourcePreset),
	// 					Status: to.Ptr(armcostmanagement.AlertStatusActive),
	// 					StatusModificationTime: to.Ptr("0001-01-01T00:00:00"),
	// 					Details: &armcostmanagement.AlertPropertiesDetails{
	// 						Amount: to.Ptr[float64](200000),
	// 						ContactEmails: []*string{
	// 							to.Ptr("1234@contoso.com")},
	// 							ContactGroups: []*string{
	// 							},
	// 							ContactRoles: []*string{
	// 							},
	// 							CurrentSpend: to.Ptr[float64](171000.32),
	// 							MeterFilter: []any{
	// 							},
	// 							Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan),
	// 							PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"),
	// 							ResourceFilter: []any{
	// 							},
	// 							ResourceGroupFilter: []any{
	// 							},
	// 							TagFilter: map[string]any{
	// 							},
	// 							Threshold: to.Ptr[float64](0.8),
	// 							TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly),
	// 							TriggeredBy: to.Ptr("11111111-1111-1111-111111111111_1_01"),
	// 							Unit: to.Ptr("USD"),
	// 						},
	// 					},
	// 			}},
	// 		}
}
Output:

Example (SubscriptionAlerts)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/SubscriptionAlerts.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAlertsClient().List(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.AlertsResult = armcostmanagement.AlertsResult{
	// 	Value: []*armcostmanagement.Alert{
	// 		{
	// 			Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 			Type: to.Ptr("Microsoft.CostManagement/alerts"),
	// 			ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/alerts/00000000-0000-0000-0000-000000000000"),
	// 			Properties: &armcostmanagement.AlertProperties{
	// 				Description: to.Ptr(""),
	// 				CloseTime: to.Ptr("0001-01-01T00:00:00"),
	// 				CostEntityID: to.Ptr("budget1"),
	// 				CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"),
	// 				Definition: &armcostmanagement.AlertPropertiesDefinition{
	// 					Type: to.Ptr(armcostmanagement.AlertTypeBudget),
	// 					Category: to.Ptr(armcostmanagement.AlertCategoryCost),
	// 					Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded),
	// 				},
	// 				ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"),
	// 				Source: to.Ptr(armcostmanagement.AlertSourcePreset),
	// 				Status: to.Ptr(armcostmanagement.AlertStatusActive),
	// 				StatusModificationTime: to.Ptr("0001-01-01T00:00:00"),
	// 				Details: &armcostmanagement.AlertPropertiesDetails{
	// 					Amount: to.Ptr[float64](200000),
	// 					ContactEmails: []*string{
	// 						to.Ptr("1234@contoso.com")},
	// 						ContactGroups: []*string{
	// 						},
	// 						ContactRoles: []*string{
	// 						},
	// 						CurrentSpend: to.Ptr[float64](161000.12),
	// 						MeterFilter: []any{
	// 						},
	// 						Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan),
	// 						PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"),
	// 						ResourceFilter: []any{
	// 						},
	// 						ResourceGroupFilter: []any{
	// 						},
	// 						TagFilter: map[string]any{
	// 						},
	// 						Threshold: to.Ptr[float64](0.8),
	// 						TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly),
	// 						TriggeredBy: to.Ptr("00000000-0000-0000-0000-000000000000_1_01"),
	// 						Unit: to.Ptr("USD"),
	// 					},
	// 				},
	// 			},
	// 			{
	// 				Name: to.Ptr("11111111-1111-1111-111111111111"),
	// 				Type: to.Ptr("Microsoft.CostManagement/alerts"),
	// 				ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/alerts/11111111-1111-1111-111111111111"),
	// 				Properties: &armcostmanagement.AlertProperties{
	// 					Description: to.Ptr(""),
	// 					CloseTime: to.Ptr("0001-01-01T00:00:00"),
	// 					CostEntityID: to.Ptr("budget1"),
	// 					CreationTime: to.Ptr("2019-06-24T05:51:52.8713179Z"),
	// 					Definition: &armcostmanagement.AlertPropertiesDefinition{
	// 						Type: to.Ptr(armcostmanagement.AlertTypeBudget),
	// 						Category: to.Ptr(armcostmanagement.AlertCategoryCost),
	// 						Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded),
	// 					},
	// 					ModificationTime: to.Ptr("2019-08-31T17:51:55.1808807Z"),
	// 					Source: to.Ptr(armcostmanagement.AlertSourcePreset),
	// 					Status: to.Ptr(armcostmanagement.AlertStatusActive),
	// 					StatusModificationTime: to.Ptr("0001-01-01T00:00:00"),
	// 					Details: &armcostmanagement.AlertPropertiesDetails{
	// 						Amount: to.Ptr[float64](200000),
	// 						ContactEmails: []*string{
	// 							to.Ptr("1234@contoso.com")},
	// 							ContactGroups: []*string{
	// 							},
	// 							ContactRoles: []*string{
	// 							},
	// 							CurrentSpend: to.Ptr[float64](171000.32),
	// 							MeterFilter: []any{
	// 							},
	// 							Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan),
	// 							PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"),
	// 							ResourceFilter: []any{
	// 							},
	// 							ResourceGroupFilter: []any{
	// 							},
	// 							TagFilter: map[string]any{
	// 							},
	// 							Threshold: to.Ptr[float64](0.8),
	// 							TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly),
	// 							TriggeredBy: to.Ptr("11111111-1111-1111-111111111111_1_01"),
	// 							Unit: to.Ptr("USD"),
	// 						},
	// 					},
	// 			}},
	// 		}
}
Output:

func (*AlertsClient) ListExternal

func (client *AlertsClient) ListExternal(ctx context.Context, externalCloudProviderType ExternalCloudProviderType, externalCloudProviderID string, options *AlertsClientListExternalOptions) (AlertsClientListExternalResponse, error)

ListExternal - Lists the Alerts for external cloud provider type defined. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • externalCloudProviderType - The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account.
  • externalCloudProviderID - This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations.
  • options - AlertsClientListExternalOptions contains the optional parameters for the AlertsClient.ListExternal method.
Example (ExternalBillingAccountAlerts)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalBillingAccountAlerts.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAlertsClient().ListExternal(ctx, armcostmanagement.ExternalCloudProviderTypeExternalBillingAccounts, "100", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.AlertsResult = armcostmanagement.AlertsResult{
	// 	Value: []*armcostmanagement.Alert{
	// 		{
	// 			Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 			Type: to.Ptr("Microsoft.CostManagement/alerts"),
	// 			ID: to.Ptr("providers/Microsoft.CostManagement/externalBillingAccounts/100/providers/Microsoft.CostManagement/alerts/00000000-0000-0000-0000-000000000000"),
	// 			Properties: &armcostmanagement.AlertProperties{
	// 				Description: to.Ptr(""),
	// 				CloseTime: to.Ptr("0001-01-01T00:00:00"),
	// 				CostEntityID: to.Ptr("budget1"),
	// 				CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"),
	// 				Definition: &armcostmanagement.AlertPropertiesDefinition{
	// 					Type: to.Ptr(armcostmanagement.AlertTypeBudget),
	// 					Category: to.Ptr(armcostmanagement.AlertCategoryCost),
	// 					Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded),
	// 				},
	// 				ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"),
	// 				Source: to.Ptr(armcostmanagement.AlertSourcePreset),
	// 				Status: to.Ptr(armcostmanagement.AlertStatusActive),
	// 				StatusModificationTime: to.Ptr("0001-01-01T00:00:00"),
	// 				Details: &armcostmanagement.AlertPropertiesDetails{
	// 					Amount: to.Ptr[float64](200000),
	// 					ContactEmails: []*string{
	// 						to.Ptr("1234@contoso.com")},
	// 						ContactGroups: []*string{
	// 						},
	// 						ContactRoles: []*string{
	// 						},
	// 						CurrentSpend: to.Ptr[float64](161000.12),
	// 						MeterFilter: []any{
	// 						},
	// 						Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan),
	// 						PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"),
	// 						ResourceFilter: []any{
	// 						},
	// 						ResourceGroupFilter: []any{
	// 						},
	// 						TagFilter: map[string]any{
	// 						},
	// 						Threshold: to.Ptr[float64](0.8),
	// 						TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly),
	// 						TriggeredBy: to.Ptr("00000000-0000-0000-0000-000000000000_1_01"),
	// 						Unit: to.Ptr("USD"),
	// 					},
	// 				},
	// 			},
	// 			{
	// 				Name: to.Ptr("11111111-1111-1111-111111111111"),
	// 				Type: to.Ptr("Microsoft.CostManagement/alerts"),
	// 				ID: to.Ptr("providers/Microsoft.CostManagement/externalBillingAccounts/100/providers/Microsoft.CostManagement/alerts/11111111-1111-1111-111111111111"),
	// 				Properties: &armcostmanagement.AlertProperties{
	// 					Description: to.Ptr(""),
	// 					CloseTime: to.Ptr("0001-01-01T00:00:00"),
	// 					CostEntityID: to.Ptr("budget1"),
	// 					CreationTime: to.Ptr("2019-06-24T05:51:52.8713179Z"),
	// 					Definition: &armcostmanagement.AlertPropertiesDefinition{
	// 						Type: to.Ptr(armcostmanagement.AlertTypeBudget),
	// 						Category: to.Ptr(armcostmanagement.AlertCategoryCost),
	// 						Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded),
	// 					},
	// 					ModificationTime: to.Ptr("2019-08-31T17:51:55.1808807Z"),
	// 					Source: to.Ptr(armcostmanagement.AlertSourcePreset),
	// 					Status: to.Ptr(armcostmanagement.AlertStatusActive),
	// 					StatusModificationTime: to.Ptr("0001-01-01T00:00:00"),
	// 					Details: &armcostmanagement.AlertPropertiesDetails{
	// 						Amount: to.Ptr[float64](200000),
	// 						ContactEmails: []*string{
	// 							to.Ptr("1234@contoso.com")},
	// 							ContactGroups: []*string{
	// 							},
	// 							ContactRoles: []*string{
	// 							},
	// 							CurrentSpend: to.Ptr[float64](171000.32),
	// 							MeterFilter: []any{
	// 							},
	// 							Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan),
	// 							PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"),
	// 							ResourceFilter: []any{
	// 							},
	// 							ResourceGroupFilter: []any{
	// 							},
	// 							TagFilter: map[string]any{
	// 							},
	// 							Threshold: to.Ptr[float64](0.8),
	// 							TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly),
	// 							TriggeredBy: to.Ptr("11111111-1111-1111-111111111111_1_01"),
	// 							Unit: to.Ptr("USD"),
	// 						},
	// 					},
	// 			}},
	// 		}
}
Output:

Example (ExternalSubscriptionAlerts)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalSubscriptionAlerts.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAlertsClient().ListExternal(ctx, armcostmanagement.ExternalCloudProviderTypeExternalSubscriptions, "100", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.AlertsResult = armcostmanagement.AlertsResult{
	// 	Value: []*armcostmanagement.Alert{
	// 		{
	// 			Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 			Type: to.Ptr("Microsoft.CostManagement/alerts"),
	// 			ID: to.Ptr("providers/Microsoft.CostManagement/externalSubscriptions/100/providers/Microsoft.CostManagement/alerts/00000000-0000-0000-0000-000000000000"),
	// 			Properties: &armcostmanagement.AlertProperties{
	// 				Description: to.Ptr(""),
	// 				CloseTime: to.Ptr("0001-01-01T00:00:00"),
	// 				CostEntityID: to.Ptr("budget1"),
	// 				CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"),
	// 				Definition: &armcostmanagement.AlertPropertiesDefinition{
	// 					Type: to.Ptr(armcostmanagement.AlertTypeBudget),
	// 					Category: to.Ptr(armcostmanagement.AlertCategoryCost),
	// 					Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded),
	// 				},
	// 				ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"),
	// 				Source: to.Ptr(armcostmanagement.AlertSourcePreset),
	// 				Status: to.Ptr(armcostmanagement.AlertStatusActive),
	// 				StatusModificationTime: to.Ptr("0001-01-01T00:00:00"),
	// 				Details: &armcostmanagement.AlertPropertiesDetails{
	// 					Amount: to.Ptr[float64](200000),
	// 					ContactEmails: []*string{
	// 						to.Ptr("1234@contoso.com")},
	// 						ContactGroups: []*string{
	// 						},
	// 						ContactRoles: []*string{
	// 						},
	// 						CurrentSpend: to.Ptr[float64](161000.12),
	// 						MeterFilter: []any{
	// 						},
	// 						Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan),
	// 						PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"),
	// 						ResourceFilter: []any{
	// 						},
	// 						ResourceGroupFilter: []any{
	// 						},
	// 						TagFilter: map[string]any{
	// 						},
	// 						Threshold: to.Ptr[float64](0.8),
	// 						TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly),
	// 						TriggeredBy: to.Ptr("00000000-0000-0000-0000-000000000000_1_01"),
	// 						Unit: to.Ptr("USD"),
	// 					},
	// 				},
	// 			},
	// 			{
	// 				Name: to.Ptr("11111111-1111-1111-111111111111"),
	// 				Type: to.Ptr("Microsoft.CostManagement/alerts"),
	// 				ID: to.Ptr("providers/Microsoft.CostManagement/externalSubscriptions/100/providers/Microsoft.CostManagement/alerts/11111111-1111-1111-111111111111"),
	// 				Properties: &armcostmanagement.AlertProperties{
	// 					Description: to.Ptr(""),
	// 					CloseTime: to.Ptr("0001-01-01T00:00:00"),
	// 					CostEntityID: to.Ptr("budget1"),
	// 					CreationTime: to.Ptr("2019-06-24T05:51:52.8713179Z"),
	// 					Definition: &armcostmanagement.AlertPropertiesDefinition{
	// 						Type: to.Ptr(armcostmanagement.AlertTypeBudget),
	// 						Category: to.Ptr(armcostmanagement.AlertCategoryCost),
	// 						Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded),
	// 					},
	// 					ModificationTime: to.Ptr("2019-08-31T17:51:55.1808807Z"),
	// 					Source: to.Ptr(armcostmanagement.AlertSourcePreset),
	// 					Status: to.Ptr(armcostmanagement.AlertStatusActive),
	// 					StatusModificationTime: to.Ptr("0001-01-01T00:00:00"),
	// 					Details: &armcostmanagement.AlertPropertiesDetails{
	// 						Amount: to.Ptr[float64](200000),
	// 						ContactEmails: []*string{
	// 							to.Ptr("1234@contoso.com")},
	// 							ContactGroups: []*string{
	// 							},
	// 							ContactRoles: []*string{
	// 							},
	// 							CurrentSpend: to.Ptr[float64](171000.32),
	// 							MeterFilter: []any{
	// 							},
	// 							Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan),
	// 							PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"),
	// 							ResourceFilter: []any{
	// 							},
	// 							ResourceGroupFilter: []any{
	// 							},
	// 							TagFilter: map[string]any{
	// 							},
	// 							Threshold: to.Ptr[float64](0.8),
	// 							TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly),
	// 							TriggeredBy: to.Ptr("11111111-1111-1111-111111111111_1_01"),
	// 							Unit: to.Ptr("USD"),
	// 						},
	// 					},
	// 			}},
	// 		}
}
Output:

type AlertsClientDismissOptions added in v0.2.0

type AlertsClientDismissOptions struct {
}

AlertsClientDismissOptions contains the optional parameters for the AlertsClient.Dismiss method.

type AlertsClientDismissResponse added in v0.2.0

type AlertsClientDismissResponse struct {
	Alert
}

AlertsClientDismissResponse contains the response from method AlertsClient.Dismiss.

type AlertsClientGetOptions added in v0.2.0

type AlertsClientGetOptions struct {
}

AlertsClientGetOptions contains the optional parameters for the AlertsClient.Get method.

type AlertsClientGetResponse added in v0.2.0

type AlertsClientGetResponse struct {
	Alert
}

AlertsClientGetResponse contains the response from method AlertsClient.Get.

type AlertsClientListExternalOptions added in v0.2.0

type AlertsClientListExternalOptions struct {
}

AlertsClientListExternalOptions contains the optional parameters for the AlertsClient.ListExternal method.

type AlertsClientListExternalResponse added in v0.2.0

type AlertsClientListExternalResponse struct {
	AlertsResult
}

AlertsClientListExternalResponse contains the response from method AlertsClient.ListExternal.

type AlertsClientListOptions added in v0.2.0

type AlertsClientListOptions struct {
}

AlertsClientListOptions contains the optional parameters for the AlertsClient.List method.

type AlertsClientListResponse added in v0.2.0

type AlertsClientListResponse struct {
	AlertsResult
}

AlertsClientListResponse contains the response from method AlertsClient.List.

type AlertsResult

type AlertsResult struct {
	// READ-ONLY; URL to get the next set of alerts results if there are any.
	NextLink *string

	// READ-ONLY; List of alerts.
	Value []*Alert
}

AlertsResult - Result of alerts.

func (AlertsResult) MarshalJSON

func (a AlertsResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AlertsResult.

func (*AlertsResult) UnmarshalJSON added in v1.1.0

func (a *AlertsResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AlertsResult.

type ChartType

type ChartType string

ChartType - Chart type of the main view in Cost Analysis. Required.

const (
	ChartTypeArea          ChartType = "Area"
	ChartTypeGroupedColumn ChartType = "GroupedColumn"
	ChartTypeLine          ChartType = "Line"
	ChartTypeStackedColumn ChartType = "StackedColumn"
	ChartTypeTable         ChartType = "Table"
)

func PossibleChartTypeValues

func PossibleChartTypeValues() []ChartType

PossibleChartTypeValues returns the possible values for the ChartType const type.

type ClientFactory added in v1.1.0

type ClientFactory struct {
	// contains filtered or unexported fields
}

ClientFactory is a client factory used to create any client in this module. Don't use this type directly, use NewClientFactory instead.

func NewClientFactory added in v1.1.0

func NewClientFactory(credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error)

NewClientFactory creates a new instance of ClientFactory with the specified values. The parameter values will be propagated to any client created from this factory.

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*ClientFactory) NewAlertsClient added in v1.1.0

func (c *ClientFactory) NewAlertsClient() *AlertsClient

func (*ClientFactory) NewDimensionsClient added in v1.1.0

func (c *ClientFactory) NewDimensionsClient() *DimensionsClient

func (*ClientFactory) NewExportsClient added in v1.1.0

func (c *ClientFactory) NewExportsClient() *ExportsClient

func (*ClientFactory) NewForecastClient added in v1.1.0

func (c *ClientFactory) NewForecastClient() *ForecastClient

func (*ClientFactory) NewGenerateDetailedCostReportClient added in v1.1.0

func (c *ClientFactory) NewGenerateDetailedCostReportClient() *GenerateDetailedCostReportClient

func (*ClientFactory) NewGenerateDetailedCostReportOperationResultsClient added in v1.1.0

func (c *ClientFactory) NewGenerateDetailedCostReportOperationResultsClient() *GenerateDetailedCostReportOperationResultsClient

func (*ClientFactory) NewGenerateDetailedCostReportOperationStatusClient added in v1.1.0

func (c *ClientFactory) NewGenerateDetailedCostReportOperationStatusClient() *GenerateDetailedCostReportOperationStatusClient

func (*ClientFactory) NewGenerateReservationDetailsReportClient added in v1.1.0

func (c *ClientFactory) NewGenerateReservationDetailsReportClient() *GenerateReservationDetailsReportClient

func (*ClientFactory) NewOperationsClient added in v1.1.0

func (c *ClientFactory) NewOperationsClient() *OperationsClient

func (*ClientFactory) NewQueryClient added in v1.1.0

func (c *ClientFactory) NewQueryClient() *QueryClient

func (*ClientFactory) NewViewsClient added in v1.1.0

func (c *ClientFactory) NewViewsClient() *ViewsClient

type CommonExportProperties

type CommonExportProperties struct {
	// REQUIRED; Has the definition for the export.
	Definition *ExportDefinition

	// REQUIRED; Has delivery information for the export.
	DeliveryInfo *ExportDeliveryInfo

	// The format of the export being delivered. Currently only 'Csv' is supported.
	Format *FormatType

	// If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file.
	// Note: this option is currently available only for modern commerce scopes.
	PartitionData *bool

	// If requested, has the most recent execution history for the export.
	RunHistory *ExportExecutionListResult

	// READ-ONLY; If the export has an active schedule, provides an estimate of the next execution time.
	NextRunTimeEstimate *time.Time
}

CommonExportProperties - The common properties of the export.

func (CommonExportProperties) MarshalJSON

func (c CommonExportProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CommonExportProperties.

func (*CommonExportProperties) UnmarshalJSON

func (c *CommonExportProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CommonExportProperties.

type Dimension

type Dimension struct {
	// Dimension properties.
	Properties *DimensionProperties

	// READ-ONLY; ETag of the resource.
	ETag *string

	// READ-ONLY; Resource Id.
	ID *string

	// READ-ONLY; Location of the resource.
	Location *string

	// READ-ONLY; Resource name.
	Name *string

	// READ-ONLY; SKU of the resource.
	SKU *string

	// READ-ONLY; Resource tags.
	Tags map[string]*string

	// READ-ONLY; Resource type.
	Type *string
}

Dimension - List of Dimension.

func (Dimension) MarshalJSON

func (d Dimension) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Dimension.

func (*Dimension) UnmarshalJSON added in v1.1.0

func (d *Dimension) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Dimension.

type DimensionProperties

type DimensionProperties struct {
	// Dimension data.
	Data []*string

	// READ-ONLY; Dimension category.
	Category *string

	// READ-ONLY; Dimension description.
	Description *string

	// READ-ONLY; Filter enabled.
	FilterEnabled *bool

	// READ-ONLY; Grouping enabled.
	GroupingEnabled *bool

	// READ-ONLY; The link (url) to the next page of results.
	NextLink *string

	// READ-ONLY; Total number of data for the dimension.
	Total *int32

	// READ-ONLY; Usage end.
	UsageEnd *time.Time

	// READ-ONLY; Usage start.
	UsageStart *time.Time
}

DimensionProperties - Dimension properties.

func (DimensionProperties) MarshalJSON

func (d DimensionProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DimensionProperties.

func (*DimensionProperties) UnmarshalJSON

func (d *DimensionProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DimensionProperties.

type DimensionsClient

type DimensionsClient struct {
	// contains filtered or unexported fields
}

DimensionsClient contains the methods for the Dimensions group. Don't use this type directly, use NewDimensionsClient() instead.

func NewDimensionsClient

func NewDimensionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*DimensionsClient, error)

NewDimensionsClient creates a new instance of DimensionsClient with the specified values.

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*DimensionsClient) NewByExternalCloudProviderTypePager added in v0.4.0

func (client *DimensionsClient) NewByExternalCloudProviderTypePager(externalCloudProviderType ExternalCloudProviderType, externalCloudProviderID string, options *DimensionsClientByExternalCloudProviderTypeOptions) *runtime.Pager[DimensionsClientByExternalCloudProviderTypeResponse]

NewByExternalCloudProviderTypePager - Lists the dimensions by the external cloud provider type.

Generated from API version 2021-10-01

  • externalCloudProviderType - The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account.
  • externalCloudProviderID - This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations.
  • options - DimensionsClientByExternalCloudProviderTypeOptions contains the optional parameters for the DimensionsClient.NewByExternalCloudProviderTypePager method.
Example (ExternalBillingAccountDimensionList)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalBillingAccountsDimensions.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewByExternalCloudProviderTypePager(armcostmanagement.ExternalCloudProviderTypeExternalBillingAccounts, "100", &armcostmanagement.DimensionsClientByExternalCloudProviderTypeOptions{Filter: nil,
		Expand:    nil,
		Skiptoken: nil,
		Top:       nil,
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceType_2019-12-01_2019-12-31"),
		// 			Type: to.Ptr("microsoft.consumption/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.CostManagement/externalBillingAccounts/100/dimensions_ResourceType_2019-12-01_2019-12-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource type"),
		// 				Category: to.Ptr("ResourceType"),
		// 				Data: []*string{
		// 				},
		// 				FilterEnabled: to.Ptr(true),
		// 				GroupingEnabled: to.Ptr(true),
		// 				Total: to.Ptr[int32](0),
		// 				UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-31T00:00:00Z"); return t}()),
		// 				UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T00:00:00Z"); return t}()),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceId_2019-12-01_2019-12-31"),
		// 			Type: to.Ptr("microsoft.consumption/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.CostManagement/externalBillingAccounts/100/dimensions_ResourceId_2019-12-01_2019-12-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource ID"),
		// 				Category: to.Ptr("ResourceId"),
		// 				Data: []*string{
		// 				},
		// 				FilterEnabled: to.Ptr(true),
		// 				GroupingEnabled: to.Ptr(true),
		// 				Total: to.Ptr[int32](0),
		// 				UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-31T00:00:00Z"); return t}()),
		// 				UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T00:00:00Z"); return t}()),
		// 			},
		// 	}},
		// }
	}
}
Output:

Example (ExternalSubscriptionDimensionList)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalSubscriptionsDimensions.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewByExternalCloudProviderTypePager(armcostmanagement.ExternalCloudProviderTypeExternalSubscriptions, "100", &armcostmanagement.DimensionsClientByExternalCloudProviderTypeOptions{Filter: nil,
		Expand:    nil,
		Skiptoken: nil,
		Top:       nil,
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceType_2019-12-01_2019-12-31"),
		// 			Type: to.Ptr("microsoft.consumption/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.CostManagement/externalSubscriptions/123/dimensions_ResourceType_2019-12-01_2019-12-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource type"),
		// 				Category: to.Ptr("ResourceType"),
		// 				Data: []*string{
		// 				},
		// 				FilterEnabled: to.Ptr(true),
		// 				GroupingEnabled: to.Ptr(true),
		// 				Total: to.Ptr[int32](0),
		// 				UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-31T00:00:00Z"); return t}()),
		// 				UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T00:00:00Z"); return t}()),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceId_2019-12-01_2019-12-31"),
		// 			Type: to.Ptr("microsoft.consumption/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.CostManagement/externalSubscriptions/123/dimensions_ResourceId_2019-12-01_2019-12-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource ID"),
		// 				Category: to.Ptr("ResourceId"),
		// 				Data: []*string{
		// 				},
		// 				FilterEnabled: to.Ptr(true),
		// 				GroupingEnabled: to.Ptr(true),
		// 				Total: to.Ptr[int32](0),
		// 				UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-31T00:00:00Z"); return t}()),
		// 				UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T00:00:00Z"); return t}()),
		// 			},
		// 	}},
		// }
	}
}
Output:

func (*DimensionsClient) NewListPager added in v0.4.0

NewListPager - Lists the dimensions by the defined scope.

Generated from API version 2021-10-01

  • scope - The scope associated with dimension operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.
  • options - DimensionsClientListOptions contains the optional parameters for the DimensionsClient.NewListPager method.
Example (BillingAccountDimensionsListExpandAndTopLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingAccountDimensionsListExpandAndTop.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/100", &armcostmanagement.DimensionsClientListOptions{Filter: nil,
		Expand:    to.Ptr("properties/data"),
		Skiptoken: nil,
		Top:       to.Ptr[int32](5),
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceGroup_2018-05-01_2018-05-31_5"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/providers/microsoft.CostManagement/dimensions_ResourceGroup_2018-05-01_2018-05-31_5"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource group"),
		// 				Category: to.Ptr("ResourceGroup"),
		// 				Data: []*string{
		// 					to.Ptr("thoroetrg01"),
		// 					to.Ptr("default-notificationhubs-westus"),
		// 					to.Ptr("jedikeyvaultrg"),
		// 					to.Ptr("contosocodeflow8d4a"),
		// 					to.Ptr("noobaa")},
		// 					FilterEnabled: to.Ptr(true),
		// 					GroupingEnabled: to.Ptr(true),
		// 					Total: to.Ptr[int32](377),
		// 					UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()),
		// 					UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()),
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("dimensions_ResourceType_2018-05-01_2018-05-31_5"),
		// 				Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 				ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/providers/microsoft.CostManagement/dimensions_ResourceType_2018-05-01_2018-05-31_5"),
		// 				Properties: &armcostmanagement.DimensionProperties{
		// 					Description: to.Ptr("Resource type"),
		// 					Category: to.Ptr("ResourceType"),
		// 					Data: []*string{
		// 						to.Ptr("microsoft.automation/automationaccounts"),
		// 						to.Ptr("microsoft.databricks/workspaces"),
		// 						to.Ptr("microsoft.dbformysql/servers"),
		// 						to.Ptr("microsoft.containerregistry/registries"),
		// 						to.Ptr("microsoft.search/searchservices")},
		// 						FilterEnabled: to.Ptr(true),
		// 						GroupingEnabled: to.Ptr(true),
		// 						Total: to.Ptr[int32](37),
		// 						UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()),
		// 						UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()),
		// 					},
		// 			}},
		// 		}
	}
}
Output:

Example (BillingAccountDimensionsListExpandAndTopModern)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCABillingAccountDimensionsListExpandAndTop.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:6789", &armcostmanagement.DimensionsClientListOptions{Filter: nil,
		Expand:    to.Ptr("properties/data"),
		Skiptoken: nil,
		Top:       to.Ptr[int32](5),
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceGroup_2019-10-01_2019-10-31"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/providers/microsoft.CostManagement/dimensions_ResourceGroup_2019-10-01_2019-10-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource group"),
		// 				Category: to.Ptr("ResourceGroup"),
		// 				Data: []*string{
		// 					to.Ptr("thoroetrg01"),
		// 					to.Ptr("default-notificationhubs-westus"),
		// 					to.Ptr("jedikeyvaultrg"),
		// 					to.Ptr("contosocodeflow8d4a"),
		// 					to.Ptr("noobaa")},
		// 					FilterEnabled: to.Ptr(true),
		// 					GroupingEnabled: to.Ptr(true),
		// 					Total: to.Ptr[int32](377),
		// 					UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()),
		// 					UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()),
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("dimensions_ResourceType_2019-10-01_2019-10-31"),
		// 				Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 				ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/providers/microsoft.CostManagement/dimensions_ResourceType_2019-10-01_2019-10-31"),
		// 				Properties: &armcostmanagement.DimensionProperties{
		// 					Description: to.Ptr("Resource type"),
		// 					Category: to.Ptr("ResourceType"),
		// 					Data: []*string{
		// 						to.Ptr("microsoft.automation/automationaccounts"),
		// 						to.Ptr("microsoft.databricks/workspaces"),
		// 						to.Ptr("microsoft.dbformysql/servers"),
		// 						to.Ptr("microsoft.containerregistry/registries"),
		// 						to.Ptr("microsoft.search/searchservices")},
		// 						FilterEnabled: to.Ptr(true),
		// 						GroupingEnabled: to.Ptr(true),
		// 						Total: to.Ptr[int32](37),
		// 						UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()),
		// 						UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()),
		// 					},
		// 			}},
		// 		}
	}
}
Output:

Example (BillingAccountDimensionsListLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingAccountDimensionsList.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/100", &armcostmanagement.DimensionsClientListOptions{Filter: nil,
		Expand:    nil,
		Skiptoken: nil,
		Top:       nil,
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceGroup_2018-05-01_2018-05-31"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/providers/microsoft.CostManagement/dimensions_ResourceGroup_2018-05-01_2018-05-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource group"),
		// 				Category: to.Ptr("ResourceGroup"),
		// 				Data: []*string{
		// 				},
		// 				FilterEnabled: to.Ptr(true),
		// 				GroupingEnabled: to.Ptr(true),
		// 				Total: to.Ptr[int32](377),
		// 				UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()),
		// 				UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceType_2018-05-01_2018-05-31"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/providers/microsoft.CostManagement/dimensions_ResourceType_2018-05-01_2018-05-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource type"),
		// 				Category: to.Ptr("ResourceType"),
		// 				Data: []*string{
		// 				},
		// 				FilterEnabled: to.Ptr(true),
		// 				GroupingEnabled: to.Ptr(true),
		// 				Total: to.Ptr[int32](37),
		// 				UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()),
		// 				UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()),
		// 			},
		// 	}},
		// }
	}
}
Output:

Example (BillingAccountDimensionsListModern)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCABillingAccountDimensionsList.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:6789", &armcostmanagement.DimensionsClientListOptions{Filter: nil,
		Expand:    nil,
		Skiptoken: nil,
		Top:       nil,
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceGroup_2019-10-01_2019-10-31"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/providers/microsoft.CostManagement/dimensions_ResourceGroup_2019-10-01_2019-10-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource group"),
		// 				Category: to.Ptr("ResourceGroup"),
		// 				Data: []*string{
		// 				},
		// 				FilterEnabled: to.Ptr(true),
		// 				GroupingEnabled: to.Ptr(true),
		// 				Total: to.Ptr[int32](377),
		// 				UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()),
		// 				UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceType_2019-10-01_2019-10-31"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/providers/microsoft.CostManagement/dimensions_ResourceType_2019-10-01_2019-10-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource type"),
		// 				Category: to.Ptr("ResourceType"),
		// 				Data: []*string{
		// 				},
		// 				FilterEnabled: to.Ptr(true),
		// 				GroupingEnabled: to.Ptr(true),
		// 				Total: to.Ptr[int32](37),
		// 				UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()),
		// 				UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()),
		// 			},
		// 	}},
		// }
	}
}
Output:

Example (BillingAccountDimensionsListWithFilterLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingAccountDimensionsListWithFilter.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/100", &armcostmanagement.DimensionsClientListOptions{Filter: to.Ptr("properties/category eq 'resourceId'"),
		Expand:    to.Ptr("properties/data"),
		Skiptoken: nil,
		Top:       to.Ptr[int32](5),
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceId_2018-05-01_2018-05-31_5"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/providers/microsoft.CostManagement/dimensions_ResourceId_2018-05-01_2018-05-31_5"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource Id"),
		// 				Category: to.Ptr("ResourceId"),
		// 				Data: []*string{
		// 					to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/urphealthaccount"),
		// 					to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/srphytenaccount"),
		// 					to.Ptr("/subscriptions/67e24f6b-1ec2-4c90-993a-dc2d25b00b6c/resourcegroups/defaultresourcegroup-eus/providers/microsoft.operationalinsights/workspaces/defaultworkspace-67e24f6b-1ec2-4c90-993a-dc2d25b00b6c-eus"),
		// 					to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg-sql-ha/providers/microsoft.compute/virtualmachines/sql-4qqp1"),
		// 					to.Ptr("/subscriptions/a98d6dc5-eb8f-46cf-8938-f1fb08f03706/resourcegroups/databricks-rg-testwsp-xijmsdubneexm/providers/microsoft.compute/disks/488cdb42bf74474a98075415be3f806c-containerrootvolume")},
		// 					FilterEnabled: to.Ptr(true),
		// 					GroupingEnabled: to.Ptr(true),
		// 					Total: to.Ptr[int32](1409),
		// 					UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()),
		// 					UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()),
		// 				},
		// 		}},
		// 	}
	}
}
Output:

Example (BillingAccountDimensionsListWithFilterModern)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCABillingAccountDimensionsListWithFilter.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:6789", &armcostmanagement.DimensionsClientListOptions{Filter: to.Ptr("properties/category eq 'resourceId'"),
		Expand:    to.Ptr("properties/data"),
		Skiptoken: nil,
		Top:       to.Ptr[int32](5),
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceId_2019-10-01_2019-10-31"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/providers/microsoft.CostManagement/dimensions_ResourceId_2019-10-01_2019-10-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource Id"),
		// 				Category: to.Ptr("ResourceId"),
		// 				Data: []*string{
		// 					to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/urphealthaccount"),
		// 					to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/srphytenaccount"),
		// 					to.Ptr("/subscriptions/67e24f6b-1ec2-4c90-993a-dc2d25b00b6c/resourcegroups/defaultresourcegroup-eus/providers/microsoft.operationalinsights/workspaces/defaultworkspace-67e24f6b-1ec2-4c90-993a-dc2d25b00b6c-eus"),
		// 					to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg-sql-ha/providers/microsoft.compute/virtualmachines/sql-4qqp1"),
		// 					to.Ptr("/subscriptions/a98d6dc5-eb8f-46cf-8938-f1fb08f03706/resourcegroups/databricks-rg-testwsp-xijmsdubneexm/providers/microsoft.compute/disks/488cdb42bf74474a98075415be3f806c-containerrootvolume")},
		// 					FilterEnabled: to.Ptr(true),
		// 					GroupingEnabled: to.Ptr(true),
		// 					Total: to.Ptr[int32](1409),
		// 					UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()),
		// 					UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()),
		// 				},
		// 		}},
		// 	}
	}
}
Output:

Example (BillingProfileDimensionsListExpandAndTopModern)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCABillingProfileDimensionsListExpandAndTop.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", &armcostmanagement.DimensionsClientListOptions{Filter: nil,
		Expand:    to.Ptr("properties/data"),
		Skiptoken: nil,
		Top:       to.Ptr[int32](5),
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceGroup_2019-10-01_2019-10-31"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/microsoft.CostManagement/dimensions_ResourceGroup_2019-10-01_2019-10-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource group"),
		// 				Category: to.Ptr("ResourceGroup"),
		// 				Data: []*string{
		// 					to.Ptr("thoroetrg01"),
		// 					to.Ptr("default-notificationhubs-westus"),
		// 					to.Ptr("jedikeyvaultrg"),
		// 					to.Ptr("contosocodeflow8d4a"),
		// 					to.Ptr("noobaa")},
		// 					FilterEnabled: to.Ptr(true),
		// 					GroupingEnabled: to.Ptr(true),
		// 					Total: to.Ptr[int32](377),
		// 					UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()),
		// 					UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()),
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("dimensions_ResourceType_2019-10-01_2019-10-31"),
		// 				Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 				ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/microsoft.CostManagement/dimensions_ResourceType_2019-10-01_2019-10-31"),
		// 				Properties: &armcostmanagement.DimensionProperties{
		// 					Description: to.Ptr("Resource type"),
		// 					Category: to.Ptr("ResourceType"),
		// 					Data: []*string{
		// 						to.Ptr("microsoft.automation/automationaccounts"),
		// 						to.Ptr("microsoft.databricks/workspaces"),
		// 						to.Ptr("microsoft.dbformysql/servers"),
		// 						to.Ptr("microsoft.containerregistry/registries"),
		// 						to.Ptr("microsoft.search/searchservices")},
		// 						FilterEnabled: to.Ptr(true),
		// 						GroupingEnabled: to.Ptr(true),
		// 						Total: to.Ptr[int32](37),
		// 						UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()),
		// 						UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()),
		// 					},
		// 			}},
		// 		}
	}
}
Output:

Example (BillingProfileDimensionsListModern)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCABillingProfileDimensionsList.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", &armcostmanagement.DimensionsClientListOptions{Filter: nil,
		Expand:    nil,
		Skiptoken: nil,
		Top:       nil,
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceGroup_2019-10-01_2019-10-31"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/microsoft.CostManagement/dimensions_ResourceGroup_2019-10-01_2019-10-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource group"),
		// 				Category: to.Ptr("ResourceGroup"),
		// 				Data: []*string{
		// 				},
		// 				FilterEnabled: to.Ptr(true),
		// 				GroupingEnabled: to.Ptr(true),
		// 				Total: to.Ptr[int32](377),
		// 				UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()),
		// 				UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceType_2019-10-01_2019-10-31"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/microsoft.CostManagement/dimensions_ResourceType_2019-10-01_2019-10-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource type"),
		// 				Category: to.Ptr("ResourceType"),
		// 				Data: []*string{
		// 				},
		// 				FilterEnabled: to.Ptr(true),
		// 				GroupingEnabled: to.Ptr(true),
		// 				Total: to.Ptr[int32](37),
		// 				UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()),
		// 				UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()),
		// 			},
		// 	}},
		// }
	}
}
Output:

Example (BillingProfileDimensionsListWithFilterModern)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCABillingProfileDimensionsListWithFilter.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", &armcostmanagement.DimensionsClientListOptions{Filter: to.Ptr("properties/category eq 'resourceId'"),
		Expand:    to.Ptr("properties/data"),
		Skiptoken: nil,
		Top:       to.Ptr[int32](5),
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceId_2019-10-01_2019-10-31"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/microsoft.CostManagement/dimensions_ResourceId_2019-10-01_2019-10-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource Id"),
		// 				Category: to.Ptr("ResourceId"),
		// 				Data: []*string{
		// 					to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/urphealthaccount"),
		// 					to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/srphytenaccount"),
		// 					to.Ptr("/subscriptions/67e24f6b-1ec2-4c90-993a-dc2d25b00b6c/resourcegroups/defaultresourcegroup-eus/providers/microsoft.operationalinsights/workspaces/defaultworkspace-67e24f6b-1ec2-4c90-993a-dc2d25b00b6c-eus"),
		// 					to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg-sql-ha/providers/microsoft.compute/virtualmachines/sql-4qqp1"),
		// 					to.Ptr("/subscriptions/a98d6dc5-eb8f-46cf-8938-f1fb08f03706/resourcegroups/databricks-rg-testwsp-xijmsdubneexm/providers/microsoft.compute/disks/488cdb42bf74474a98075415be3f806c-containerrootvolume")},
		// 					FilterEnabled: to.Ptr(true),
		// 					GroupingEnabled: to.Ptr(true),
		// 					Total: to.Ptr[int32](1409),
		// 					UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()),
		// 					UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()),
		// 				},
		// 		}},
		// 	}
	}
}
Output:

Example (CustomerDimensionsListExpandAndTopModern)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCACustomerDimensionsListExpandAndTop.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", &armcostmanagement.DimensionsClientListOptions{Filter: nil,
		Expand:    to.Ptr("properties/data"),
		Skiptoken: nil,
		Top:       to.Ptr[int32](5),
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceGroup_2019-10-01_2019-10-31"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678/providers/microsoft.CostManagement/dimensions_ResourceGroup_2019-10-01_2019-10-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource group"),
		// 				Category: to.Ptr("ResourceGroup"),
		// 				Data: []*string{
		// 					to.Ptr("thoroetrg01"),
		// 					to.Ptr("default-notificationhubs-westus"),
		// 					to.Ptr("jedikeyvaultrg"),
		// 					to.Ptr("contosocodeflow8d4a"),
		// 					to.Ptr("noobaa")},
		// 					FilterEnabled: to.Ptr(true),
		// 					GroupingEnabled: to.Ptr(true),
		// 					Total: to.Ptr[int32](377),
		// 					UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()),
		// 					UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()),
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("dimensions_ResourceType_2019-10-01_2019-10-31"),
		// 				Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 				ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678/providers/microsoft.CostManagement/dimensions_ResourceType_2019-10-01_2019-10-31"),
		// 				Properties: &armcostmanagement.DimensionProperties{
		// 					Description: to.Ptr("Resource type"),
		// 					Category: to.Ptr("ResourceType"),
		// 					Data: []*string{
		// 						to.Ptr("microsoft.automation/automationaccounts"),
		// 						to.Ptr("microsoft.databricks/workspaces"),
		// 						to.Ptr("microsoft.dbformysql/servers"),
		// 						to.Ptr("microsoft.containerregistry/registries"),
		// 						to.Ptr("microsoft.search/searchservices")},
		// 						FilterEnabled: to.Ptr(true),
		// 						GroupingEnabled: to.Ptr(true),
		// 						Total: to.Ptr[int32](37),
		// 						UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()),
		// 						UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()),
		// 					},
		// 			}},
		// 		}
	}
}
Output:

Example (CustomerDimensionsListModern)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCACustomerDimensionsList.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", &armcostmanagement.DimensionsClientListOptions{Filter: nil,
		Expand:    nil,
		Skiptoken: nil,
		Top:       nil,
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceGroup_2019-10-01_2019-10-31"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678/providers/microsoft.CostManagement/dimensions_ResourceGroup_2019-10-01_2019-10-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource group"),
		// 				Category: to.Ptr("ResourceGroup"),
		// 				Data: []*string{
		// 				},
		// 				FilterEnabled: to.Ptr(true),
		// 				GroupingEnabled: to.Ptr(true),
		// 				Total: to.Ptr[int32](377),
		// 				UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()),
		// 				UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceType_2019-10-01_2019-10-31"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678/providers/microsoft.CostManagement/dimensions_ResourceType_2019-10-01_2019-10-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource type"),
		// 				Category: to.Ptr("ResourceType"),
		// 				Data: []*string{
		// 				},
		// 				FilterEnabled: to.Ptr(true),
		// 				GroupingEnabled: to.Ptr(true),
		// 				Total: to.Ptr[int32](37),
		// 				UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()),
		// 				UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()),
		// 			},
		// 	}},
		// }
	}
}
Output:

Example (CustomerDimensionsListWithFilterModern)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCACustomerDimensionsListWithFilter.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", &armcostmanagement.DimensionsClientListOptions{Filter: to.Ptr("properties/category eq 'resourceId'"),
		Expand:    to.Ptr("properties/data"),
		Skiptoken: nil,
		Top:       to.Ptr[int32](5),
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceId_2019-10-01_2019-10-31"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678/providers/microsoft.CostManagement/dimensions_ResourceId_2019-10-01_2019-10-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource Id"),
		// 				Category: to.Ptr("ResourceId"),
		// 				Data: []*string{
		// 					to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/urphealthaccount"),
		// 					to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/srphytenaccount"),
		// 					to.Ptr("/subscriptions/67e24f6b-1ec2-4c90-993a-dc2d25b00b6c/resourcegroups/defaultresourcegroup-eus/providers/microsoft.operationalinsights/workspaces/defaultworkspace-67e24f6b-1ec2-4c90-993a-dc2d25b00b6c-eus"),
		// 					to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg-sql-ha/providers/microsoft.compute/virtualmachines/sql-4qqp1"),
		// 					to.Ptr("/subscriptions/a98d6dc5-eb8f-46cf-8938-f1fb08f03706/resourcegroups/databricks-rg-testwsp-xijmsdubneexm/providers/microsoft.compute/disks/488cdb42bf74474a98075415be3f806c-containerrootvolume")},
		// 					FilterEnabled: to.Ptr(true),
		// 					GroupingEnabled: to.Ptr(true),
		// 					Total: to.Ptr[int32](1409),
		// 					UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()),
		// 					UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()),
		// 				},
		// 		}},
		// 	}
	}
}
Output:

Example (DepartmentDimensionsListExpandAndTopLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/DepartmentDimensionsListExpandAndTop.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/100/departments/123", &armcostmanagement.DimensionsClientListOptions{Filter: nil,
		Expand:    to.Ptr("properties/data"),
		Skiptoken: nil,
		Top:       to.Ptr[int32](5),
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceGroup_2018-05-01_2018-05-31_5"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/departments/123/providers/microsoft.CostManagement/dimensions_ResourceGroup_2018-05-01_2018-05-31_5"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource group"),
		// 				Category: to.Ptr("ResourceGroup"),
		// 				Data: []*string{
		// 					to.Ptr("thoroetrg01"),
		// 					to.Ptr("default-notificationhubs-westus"),
		// 					to.Ptr("jedikeyvaultrg"),
		// 					to.Ptr("contosocodeflow8d4a"),
		// 					to.Ptr("noobaa")},
		// 					FilterEnabled: to.Ptr(true),
		// 					GroupingEnabled: to.Ptr(true),
		// 					Total: to.Ptr[int32](377),
		// 					UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()),
		// 					UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()),
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("dimensions_ResourceType_2018-05-01_2018-05-31_5"),
		// 				Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 				ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/departments/123/providers/microsoft.CostManagement/dimensions_ResourceType_2018-05-01_2018-05-31_5"),
		// 				Properties: &armcostmanagement.DimensionProperties{
		// 					Description: to.Ptr("Resource type"),
		// 					Category: to.Ptr("ResourceType"),
		// 					Data: []*string{
		// 						to.Ptr("microsoft.automation/automationaccounts"),
		// 						to.Ptr("microsoft.databricks/workspaces"),
		// 						to.Ptr("microsoft.dbformysql/servers"),
		// 						to.Ptr("microsoft.containerregistry/registries"),
		// 						to.Ptr("microsoft.search/searchservices")},
		// 						FilterEnabled: to.Ptr(true),
		// 						GroupingEnabled: to.Ptr(true),
		// 						Total: to.Ptr[int32](37),
		// 						UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()),
		// 						UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()),
		// 					},
		// 			}},
		// 		}
	}
}
Output:

Example (DepartmentDimensionsListLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/DepartmentDimensionsList.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/100/departments/123", &armcostmanagement.DimensionsClientListOptions{Filter: nil,
		Expand:    nil,
		Skiptoken: nil,
		Top:       nil,
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceGroup_2018-05-01_2018-05-31"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/departments/123/providers/microsoft.CostManagement/dimensions_ResourceGroup_2018-05-01_2018-05-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource group"),
		// 				Category: to.Ptr("ResourceGroup"),
		// 				Data: []*string{
		// 				},
		// 				FilterEnabled: to.Ptr(true),
		// 				GroupingEnabled: to.Ptr(true),
		// 				Total: to.Ptr[int32](377),
		// 				UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()),
		// 				UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceType_2018-05-01_2018-05-31"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/departments/123/providers/microsoft.CostManagement/dimensions_ResourceType_2018-05-01_2018-05-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource type"),
		// 				Category: to.Ptr("ResourceType"),
		// 				Data: []*string{
		// 				},
		// 				FilterEnabled: to.Ptr(true),
		// 				GroupingEnabled: to.Ptr(true),
		// 				Total: to.Ptr[int32](37),
		// 				UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()),
		// 				UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()),
		// 			},
		// 	}},
		// }
	}
}
Output:

Example (DepartmentDimensionsListWithFilterLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/DepartmentDimensionsListWithFilter.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/100/departments/123", &armcostmanagement.DimensionsClientListOptions{Filter: to.Ptr("properties/category eq 'resourceId'"),
		Expand:    to.Ptr("properties/data"),
		Skiptoken: nil,
		Top:       to.Ptr[int32](5),
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceId_2018-05-01_2018-05-31_5"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/departments/123/providers/microsoft.CostManagement/dimensions_ResourceId_2018-05-01_2018-05-31_5"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource Id"),
		// 				Category: to.Ptr("ResourceId"),
		// 				Data: []*string{
		// 					to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/urphealthaccount"),
		// 					to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/srphytenaccount"),
		// 					to.Ptr("/subscriptions/67e24f6b-1ec2-4c90-993a-dc2d25b00b6c/resourcegroups/defaultresourcegroup-eus/providers/microsoft.operationalinsights/workspaces/defaultworkspace-67e24f6b-1ec2-4c90-993a-dc2d25b00b6c-eus"),
		// 					to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg-sql-ha/providers/microsoft.compute/virtualmachines/sql-4qqp1"),
		// 					to.Ptr("/subscriptions/a98d6dc5-eb8f-46cf-8938-f1fb08f03706/resourcegroups/databricks-rg-testwsp-xijmsdubneexm/providers/microsoft.compute/disks/488cdb42bf74474a98075415be3f806c-containerrootvolume")},
		// 					FilterEnabled: to.Ptr(true),
		// 					GroupingEnabled: to.Ptr(true),
		// 					Total: to.Ptr[int32](1409),
		// 					UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()),
		// 					UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()),
		// 				},
		// 		}},
		// 	}
	}
}
Output:

Example (EnrollmentAccountDimensionsListExpandAndTopLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/EnrollmentAccountDimensionsListExpandAndTop.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", &armcostmanagement.DimensionsClientListOptions{Filter: nil,
		Expand:    to.Ptr("properties/data"),
		Skiptoken: nil,
		Top:       to.Ptr[int32](5),
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceGroup_2018-05-01_2018-05-31_5"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/microsoft.CostManagement/dimensions_ResourceGroup_2018-05-01_2018-05-31_5"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource group"),
		// 				Category: to.Ptr("ResourceGroup"),
		// 				Data: []*string{
		// 					to.Ptr("thoroetrg01"),
		// 					to.Ptr("default-notificationhubs-westus"),
		// 					to.Ptr("jedikeyvaultrg"),
		// 					to.Ptr("contosocodeflow8d4a"),
		// 					to.Ptr("noobaa")},
		// 					FilterEnabled: to.Ptr(true),
		// 					GroupingEnabled: to.Ptr(true),
		// 					Total: to.Ptr[int32](377),
		// 					UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()),
		// 					UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()),
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("dimensions_ResourceType_2018-05-01_2018-05-31_5"),
		// 				Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 				ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/microsoft.CostManagement/dimensions_ResourceType_2018-05-01_2018-05-31_5"),
		// 				Properties: &armcostmanagement.DimensionProperties{
		// 					Description: to.Ptr("Resource type"),
		// 					Category: to.Ptr("ResourceType"),
		// 					Data: []*string{
		// 						to.Ptr("microsoft.automation/automationaccounts"),
		// 						to.Ptr("microsoft.databricks/workspaces"),
		// 						to.Ptr("microsoft.dbformysql/servers"),
		// 						to.Ptr("microsoft.containerregistry/registries"),
		// 						to.Ptr("microsoft.search/searchservices")},
		// 						FilterEnabled: to.Ptr(true),
		// 						GroupingEnabled: to.Ptr(true),
		// 						Total: to.Ptr[int32](37),
		// 						UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()),
		// 						UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()),
		// 					},
		// 			}},
		// 		}
	}
}
Output:

Example (EnrollmentAccountDimensionsListLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/EnrollmentAccountDimensionsList.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", &armcostmanagement.DimensionsClientListOptions{Filter: nil,
		Expand:    nil,
		Skiptoken: nil,
		Top:       nil,
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceGroup_2018-05-01_2018-05-31"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/microsoft.CostManagement/dimensions_ResourceGroup_2018-05-01_2018-05-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource group"),
		// 				Category: to.Ptr("ResourceGroup"),
		// 				Data: []*string{
		// 				},
		// 				FilterEnabled: to.Ptr(true),
		// 				GroupingEnabled: to.Ptr(true),
		// 				Total: to.Ptr[int32](377),
		// 				UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()),
		// 				UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceType_2018-05-01_2018-05-31"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/microsoft.CostManagement/dimensions_ResourceType_2018-05-01_2018-05-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource type"),
		// 				Category: to.Ptr("ResourceType"),
		// 				Data: []*string{
		// 				},
		// 				FilterEnabled: to.Ptr(true),
		// 				GroupingEnabled: to.Ptr(true),
		// 				Total: to.Ptr[int32](37),
		// 				UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()),
		// 				UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()),
		// 			},
		// 	}},
		// }
	}
}
Output:

Example (EnrollmentAccountDimensionsListWithFilterLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/EnrollmentAccountDimensionsListWithFilter.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", &armcostmanagement.DimensionsClientListOptions{Filter: to.Ptr("properties/category eq 'resourceId'"),
		Expand:    to.Ptr("properties/data"),
		Skiptoken: nil,
		Top:       to.Ptr[int32](5),
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceId_2018-05-01_2018-05-31_5"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/microsoft.CostManagement/dimensions_ResourceId_2018-05-01_2018-05-31_5"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource Id"),
		// 				Category: to.Ptr("ResourceId"),
		// 				Data: []*string{
		// 					to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/urphealthaccount"),
		// 					to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/srphytenaccount"),
		// 					to.Ptr("/subscriptions/67e24f6b-1ec2-4c90-993a-dc2d25b00b6c/resourcegroups/defaultresourcegroup-eus/providers/microsoft.operationalinsights/workspaces/defaultworkspace-67e24f6b-1ec2-4c90-993a-dc2d25b00b6c-eus"),
		// 					to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg-sql-ha/providers/microsoft.compute/virtualmachines/sql-4qqp1"),
		// 					to.Ptr("/subscriptions/a98d6dc5-eb8f-46cf-8938-f1fb08f03706/resourcegroups/databricks-rg-testwsp-xijmsdubneexm/providers/microsoft.compute/disks/488cdb42bf74474a98075415be3f806c-containerrootvolume")},
		// 					FilterEnabled: to.Ptr(true),
		// 					GroupingEnabled: to.Ptr(true),
		// 					Total: to.Ptr[int32](1409),
		// 					UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()),
		// 					UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()),
		// 				},
		// 		}},
		// 	}
	}
}
Output:

Example (InvoiceSectionDimensionsListExpandAndTopModern)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCAInvoiceSectionDimensionsListExpandAndTop.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", &armcostmanagement.DimensionsClientListOptions{Filter: nil,
		Expand:    to.Ptr("properties/data"),
		Skiptoken: nil,
		Top:       to.Ptr[int32](5),
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceGroup_2019-10-01_2019-10-31"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/microsoft.CostManagement/dimensions_ResourceGroup_2019-10-01_2019-10-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource group"),
		// 				Category: to.Ptr("ResourceGroup"),
		// 				Data: []*string{
		// 					to.Ptr("thoroetrg01"),
		// 					to.Ptr("default-notificationhubs-westus"),
		// 					to.Ptr("jedikeyvaultrg"),
		// 					to.Ptr("contosocodeflow8d4a"),
		// 					to.Ptr("noobaa")},
		// 					FilterEnabled: to.Ptr(true),
		// 					GroupingEnabled: to.Ptr(true),
		// 					Total: to.Ptr[int32](377),
		// 					UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()),
		// 					UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()),
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("dimensions_ResourceType_2019-10-01_2019-10-31"),
		// 				Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 				ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/microsoft.CostManagement/dimensions_ResourceType_2019-10-01_2019-10-31"),
		// 				Properties: &armcostmanagement.DimensionProperties{
		// 					Description: to.Ptr("Resource type"),
		// 					Category: to.Ptr("ResourceType"),
		// 					Data: []*string{
		// 						to.Ptr("microsoft.automation/automationaccounts"),
		// 						to.Ptr("microsoft.databricks/workspaces"),
		// 						to.Ptr("microsoft.dbformysql/servers"),
		// 						to.Ptr("microsoft.containerregistry/registries"),
		// 						to.Ptr("microsoft.search/searchservices")},
		// 						FilterEnabled: to.Ptr(true),
		// 						GroupingEnabled: to.Ptr(true),
		// 						Total: to.Ptr[int32](37),
		// 						UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()),
		// 						UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()),
		// 					},
		// 			}},
		// 		}
	}
}
Output:

Example (InvoiceSectionDimensionsListModern)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCAInvoiceSectionDimensionsList.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", &armcostmanagement.DimensionsClientListOptions{Filter: nil,
		Expand:    nil,
		Skiptoken: nil,
		Top:       nil,
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceGroup_2019-10-01_2019-10-31"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/microsoft.CostManagement/dimensions_ResourceGroup_2019-10-01_2019-10-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource group"),
		// 				Category: to.Ptr("ResourceGroup"),
		// 				Data: []*string{
		// 				},
		// 				FilterEnabled: to.Ptr(true),
		// 				GroupingEnabled: to.Ptr(true),
		// 				Total: to.Ptr[int32](377),
		// 				UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()),
		// 				UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceType_2019-10-01_2019-10-31"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/microsoft.CostManagement/dimensions_ResourceType_2019-10-01_2019-10-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource type"),
		// 				Category: to.Ptr("ResourceType"),
		// 				Data: []*string{
		// 				},
		// 				FilterEnabled: to.Ptr(true),
		// 				GroupingEnabled: to.Ptr(true),
		// 				Total: to.Ptr[int32](37),
		// 				UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()),
		// 				UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()),
		// 			},
		// 	}},
		// }
	}
}
Output:

Example (InvoiceSectionDimensionsListWithFilterModern)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCAInvoiceSectionDimensionsListWithFilter.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", &armcostmanagement.DimensionsClientListOptions{Filter: to.Ptr("properties/category eq 'resourceId'"),
		Expand:    to.Ptr("properties/data"),
		Skiptoken: nil,
		Top:       to.Ptr[int32](5),
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceId_2019-10-01_2019-10-31"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/microsoft.CostManagement/dimensions_ResourceId_2019-10-01_2019-10-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource Id"),
		// 				Category: to.Ptr("ResourceId"),
		// 				Data: []*string{
		// 					to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/urphealthaccount"),
		// 					to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/srphytenaccount"),
		// 					to.Ptr("/subscriptions/67e24f6b-1ec2-4c90-993a-dc2d25b00b6c/resourcegroups/defaultresourcegroup-eus/providers/microsoft.operationalinsights/workspaces/defaultworkspace-67e24f6b-1ec2-4c90-993a-dc2d25b00b6c-eus"),
		// 					to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg-sql-ha/providers/microsoft.compute/virtualmachines/sql-4qqp1"),
		// 					to.Ptr("/subscriptions/a98d6dc5-eb8f-46cf-8938-f1fb08f03706/resourcegroups/databricks-rg-testwsp-xijmsdubneexm/providers/microsoft.compute/disks/488cdb42bf74474a98075415be3f806c-containerrootvolume")},
		// 					FilterEnabled: to.Ptr(true),
		// 					GroupingEnabled: to.Ptr(true),
		// 					Total: to.Ptr[int32](1409),
		// 					UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()),
		// 					UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()),
		// 				},
		// 		}},
		// 	}
	}
}
Output:

Example (ManagementGroupDimensionsListExpandAndTopLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ManagementGroupDimensionsListExpandAndTop.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Management/managementGroups/MyMgId", &armcostmanagement.DimensionsClientListOptions{Filter: nil,
		Expand:    to.Ptr("properties/data"),
		Skiptoken: nil,
		Top:       to.Ptr[int32](5),
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceGroup_2018-05-01_2018-05-31_5"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Management/managementGroups/MyMgId/providers/microsoft.CostManagement/dimensions_ResourceGroup_2018-05-01_2018-05-31_5"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource group"),
		// 				Category: to.Ptr("ResourceGroup"),
		// 				Data: []*string{
		// 					to.Ptr("thoroetrg01"),
		// 					to.Ptr("default-notificationhubs-westus"),
		// 					to.Ptr("jedikeyvaultrg"),
		// 					to.Ptr("contosocodeflow8d4a"),
		// 					to.Ptr("noobaa")},
		// 					FilterEnabled: to.Ptr(true),
		// 					GroupingEnabled: to.Ptr(true),
		// 					Total: to.Ptr[int32](377),
		// 					UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()),
		// 					UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()),
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("dimensions_ResourceType_2018-05-01_2018-05-31_5"),
		// 				Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 				ID: to.Ptr("providers/Microsoft.Management/managementGroups/MyMgId/providers/microsoft.CostManagement/dimensions_ResourceType_2018-05-01_2018-05-31_5"),
		// 				Properties: &armcostmanagement.DimensionProperties{
		// 					Description: to.Ptr("Resource type"),
		// 					Category: to.Ptr("ResourceType"),
		// 					Data: []*string{
		// 						to.Ptr("microsoft.automation/automationaccounts"),
		// 						to.Ptr("microsoft.databricks/workspaces"),
		// 						to.Ptr("microsoft.dbformysql/servers"),
		// 						to.Ptr("microsoft.containerregistry/registries"),
		// 						to.Ptr("microsoft.search/searchservices")},
		// 						FilterEnabled: to.Ptr(true),
		// 						GroupingEnabled: to.Ptr(true),
		// 						Total: to.Ptr[int32](37),
		// 						UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()),
		// 						UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()),
		// 					},
		// 			}},
		// 		}
	}
}
Output:

Example (ManagementGroupDimensionsListLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ManagementGroupDimensionsList.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Management/managementGroups/MyMgId", &armcostmanagement.DimensionsClientListOptions{Filter: nil,
		Expand:    nil,
		Skiptoken: nil,
		Top:       nil,
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceGroup_2018-05-01_2018-05-31"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Management/managementGroups/MyMgId/providers/microsoft.CostManagement/dimensions_ResourceGroup_2018-05-01_2018-05-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource group"),
		// 				Category: to.Ptr("ResourceGroup"),
		// 				Data: []*string{
		// 				},
		// 				FilterEnabled: to.Ptr(true),
		// 				GroupingEnabled: to.Ptr(true),
		// 				Total: to.Ptr[int32](377),
		// 				UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()),
		// 				UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceType_2018-05-01_2018-05-31"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Management/managementGroups/MyMgId/providers/microsoft.CostManagement/dimensions_ResourceType_2018-05-01_2018-05-31"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource type"),
		// 				Category: to.Ptr("ResourceType"),
		// 				Data: []*string{
		// 				},
		// 				FilterEnabled: to.Ptr(true),
		// 				GroupingEnabled: to.Ptr(true),
		// 				Total: to.Ptr[int32](37),
		// 				UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()),
		// 				UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()),
		// 			},
		// 	}},
		// }
	}
}
Output:

Example (ManagementGroupDimensionsListWithFilterLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ManagementGroupDimensionsListWithFilter.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Management/managementGroups/MyMgId", &armcostmanagement.DimensionsClientListOptions{Filter: to.Ptr("properties/category eq 'resourceId'"),
		Expand:    to.Ptr("properties/data"),
		Skiptoken: nil,
		Top:       to.Ptr[int32](5),
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceId_2018-05-01_2018-05-31_5"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("providers/Microsoft.Management/managementGroups/MyMgId/providers/microsoft.CostManagement/dimensions_ResourceId_2018-05-01_2018-05-31_5"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource Id"),
		// 				Category: to.Ptr("ResourceId"),
		// 				Data: []*string{
		// 					to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/urphealthaccount"),
		// 					to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/srphytenaccount"),
		// 					to.Ptr("/subscriptions/67e24f6b-1ec2-4c90-993a-dc2d25b00b6c/resourcegroups/defaultresourcegroup-eus/providers/microsoft.operationalinsights/workspaces/defaultworkspace-67e24f6b-1ec2-4c90-993a-dc2d25b00b6c-eus"),
		// 					to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg-sql-ha/providers/microsoft.compute/virtualmachines/sql-4qqp1"),
		// 					to.Ptr("/subscriptions/a98d6dc5-eb8f-46cf-8938-f1fb08f03706/resourcegroups/databricks-rg-testwsp-xijmsdubneexm/providers/microsoft.compute/disks/488cdb42bf74474a98075415be3f806c-containerrootvolume")},
		// 					FilterEnabled: to.Ptr(true),
		// 					GroupingEnabled: to.Ptr(true),
		// 					Total: to.Ptr[int32](1409),
		// 					UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()),
		// 					UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()),
		// 				},
		// 		}},
		// 	}
	}
}
Output:

Example (ResourceGroupDimensionsListLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ResourceGroupDimensionsList.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/system.orlando", &armcostmanagement.DimensionsClientListOptions{Filter: nil,
		Expand:    to.Ptr("properties/data"),
		Skiptoken: nil,
		Top:       to.Ptr[int32](5),
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceType_2018-05-01_2018-05-31_5"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/system.orlando/providers/microsoft.CostManagement/dimensions_ResourceType_2018-05-01_2018-05-31_5"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource type"),
		// 				Category: to.Ptr("ResourceType"),
		// 				Data: []*string{
		// 					to.Ptr("microsoft.storage/storageaccounts")},
		// 					FilterEnabled: to.Ptr(true),
		// 					GroupingEnabled: to.Ptr(true),
		// 					Total: to.Ptr[int32](1),
		// 					UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()),
		// 					UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()),
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("dimensions_ResourceId_2018-05-01_2018-05-31_5"),
		// 				Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 				ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/system.orlando/providers/microsoft.CostManagement/dimensions_ResourceId_2018-05-01_2018-05-31_5"),
		// 				Properties: &armcostmanagement.DimensionProperties{
		// 					Description: to.Ptr("Resource Id"),
		// 					Category: to.Ptr("ResourceId"),
		// 					Data: []*string{
		// 						to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/authprod"),
		// 						to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/systemevents"),
		// 						to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/armadminprod"),
		// 						to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/srphytenaccount"),
		// 						to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/publicsystemportal")},
		// 						FilterEnabled: to.Ptr(true),
		// 						GroupingEnabled: to.Ptr(true),
		// 						Total: to.Ptr[int32](27),
		// 						UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()),
		// 						UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()),
		// 					},
		// 			}},
		// 		}
	}
}
Output:

Example (SubscriptionDimensionsListLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/SubscriptionDimensionsList.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDimensionsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armcostmanagement.DimensionsClientListOptions{Filter: nil,
		Expand:    to.Ptr("properties/data"),
		Skiptoken: nil,
		Top:       to.Ptr[int32](5),
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.DimensionsListResult = armcostmanagement.DimensionsListResult{
		// 	Value: []*armcostmanagement.Dimension{
		// 		{
		// 			Name: to.Ptr("dimensions_ResourceGroup_2018-05-01_2018-05-31_5"),
		// 			Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 			ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/dimensions_ResourceGroup_2018-05-01_2018-05-31_5"),
		// 			Properties: &armcostmanagement.DimensionProperties{
		// 				Description: to.Ptr("Resource group"),
		// 				Category: to.Ptr("ResourceGroup"),
		// 				Data: []*string{
		// 					to.Ptr("dcrg"),
		// 					to.Ptr("rg"),
		// 					to.Ptr("offlinegalleryrg"),
		// 					to.Ptr("system.orlando.adminkeyvault"),
		// 					to.Ptr("system.orlando.keyvault")},
		// 					FilterEnabled: to.Ptr(true),
		// 					GroupingEnabled: to.Ptr(true),
		// 					Total: to.Ptr[int32](68),
		// 					UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()),
		// 					UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()),
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("dimensions_ResourceType_2018-05-01_2018-05-31_5"),
		// 				Type: to.Ptr("microsoft.CostManagement/dimensions"),
		// 				ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/dimensions_ResourceType_2018-05-01_2018-05-31_5"),
		// 				Properties: &armcostmanagement.DimensionProperties{
		// 					Description: to.Ptr("Resource type"),
		// 					Category: to.Ptr("ResourceType"),
		// 					Data: []*string{
		// 						to.Ptr("microsoft.storage/storageaccounts"),
		// 						to.Ptr("microsoft.web.admin/role"),
		// 						to.Ptr("microsoft.sql/servers"),
		// 						to.Ptr("microsoft.compute/virtualmachines")},
		// 						FilterEnabled: to.Ptr(true),
		// 						GroupingEnabled: to.Ptr(true),
		// 						Total: to.Ptr[int32](4),
		// 						UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()),
		// 						UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()),
		// 					},
		// 			}},
		// 		}
	}
}
Output:

type DimensionsClientByExternalCloudProviderTypeOptions added in v0.2.0

type DimensionsClientByExternalCloudProviderTypeOptions struct {
	// May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions.
	Expand *string
	// May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators
	// are 'eq','lt', 'gt', 'le', 'ge'.
	Filter *string
	// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element,
	// the value of the nextLink element will include a skiptoken parameter that
	// specifies a starting point to use for subsequent calls.
	Skiptoken *string
	// May be used to limit the number of results to the most recent N dimension data.
	Top *int32
}

DimensionsClientByExternalCloudProviderTypeOptions contains the optional parameters for the DimensionsClient.NewByExternalCloudProviderTypePager method.

type DimensionsClientByExternalCloudProviderTypeResponse added in v0.2.0

type DimensionsClientByExternalCloudProviderTypeResponse struct {
	DimensionsListResult
}

DimensionsClientByExternalCloudProviderTypeResponse contains the response from method DimensionsClient.NewByExternalCloudProviderTypePager.

type DimensionsClientListOptions added in v0.2.0

type DimensionsClientListOptions struct {
	// May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions.
	Expand *string
	// May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators
	// are 'eq','lt', 'gt', 'le', 'ge'.
	Filter *string
	// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element,
	// the value of the nextLink element will include a skiptoken parameter that
	// specifies a starting point to use for subsequent calls.
	Skiptoken *string
	// May be used to limit the number of results to the most recent N dimension data.
	Top *int32
}

DimensionsClientListOptions contains the optional parameters for the DimensionsClient.NewListPager method.

type DimensionsClientListResponse added in v0.2.0

type DimensionsClientListResponse struct {
	DimensionsListResult
}

DimensionsClientListResponse contains the response from method DimensionsClient.NewListPager.

type DimensionsListResult

type DimensionsListResult struct {
	// READ-ONLY; The list of dimensions.
	Value []*Dimension
}

DimensionsListResult - Result of listing dimensions. It contains a list of available dimensions.

func (DimensionsListResult) MarshalJSON

func (d DimensionsListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DimensionsListResult.

func (*DimensionsListResult) UnmarshalJSON added in v1.1.0

func (d *DimensionsListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DimensionsListResult.

type DismissAlertPayload

type DismissAlertPayload struct {
	// Alert properties.
	Properties *AlertProperties
}

DismissAlertPayload - The request payload to update an alert

func (DismissAlertPayload) MarshalJSON

func (d DismissAlertPayload) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DismissAlertPayload.

func (*DismissAlertPayload) UnmarshalJSON added in v1.1.0

func (d *DismissAlertPayload) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DismissAlertPayload.

type DownloadURL

type DownloadURL struct {
	// The URL to download the generated report.
	DownloadURL *string

	// The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z.
	ValidTill *time.Time
}

DownloadURL - The URL to download the generated report.

func (DownloadURL) MarshalJSON

func (d DownloadURL) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DownloadURL.

func (*DownloadURL) UnmarshalJSON

func (d *DownloadURL) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DownloadURL.

type ErrorDetails

type ErrorDetails struct {
	// READ-ONLY; Error code.
	Code *string

	// READ-ONLY; Error message indicating why the operation failed.
	Message *string
}

ErrorDetails - The details of the error.

func (ErrorDetails) MarshalJSON added in v1.1.0

func (e ErrorDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ErrorDetails.

func (*ErrorDetails) UnmarshalJSON added in v1.1.0

func (e *ErrorDetails) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetails.

type ErrorResponse

type ErrorResponse struct {
	// The details of the error.
	Error *ErrorDetails
}

ErrorResponse - Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. Some Error responses: * 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" header.

* 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" header.

func (ErrorResponse) MarshalJSON added in v1.1.0

func (e ErrorResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ErrorResponse.

func (*ErrorResponse) UnmarshalJSON added in v1.1.0

func (e *ErrorResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse.

type ExecutionStatus

type ExecutionStatus string

ExecutionStatus - The last known status of the export execution.

const (
	ExecutionStatusCompleted           ExecutionStatus = "Completed"
	ExecutionStatusDataNotAvailable    ExecutionStatus = "DataNotAvailable"
	ExecutionStatusFailed              ExecutionStatus = "Failed"
	ExecutionStatusInProgress          ExecutionStatus = "InProgress"
	ExecutionStatusNewDataNotAvailable ExecutionStatus = "NewDataNotAvailable"
	ExecutionStatusQueued              ExecutionStatus = "Queued"
	ExecutionStatusTimeout             ExecutionStatus = "Timeout"
)

func PossibleExecutionStatusValues

func PossibleExecutionStatusValues() []ExecutionStatus

PossibleExecutionStatusValues returns the possible values for the ExecutionStatus const type.

type ExecutionType

type ExecutionType string

ExecutionType - The type of the export execution.

const (
	ExecutionTypeOnDemand  ExecutionType = "OnDemand"
	ExecutionTypeScheduled ExecutionType = "Scheduled"
)

func PossibleExecutionTypeValues

func PossibleExecutionTypeValues() []ExecutionType

PossibleExecutionTypeValues returns the possible values for the ExecutionType const type.

type Export

type Export struct {
	// eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating
	// the latest version or not.
	ETag *string

	// The properties of the export.
	Properties *ExportProperties

	// READ-ONLY; Resource Id.
	ID *string

	// READ-ONLY; Resource name.
	Name *string

	// READ-ONLY; Resource type.
	Type *string
}

Export - An export resource.

func (Export) MarshalJSON added in v1.1.0

func (e Export) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Export.

func (*Export) UnmarshalJSON added in v1.1.0

func (e *Export) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Export.

type ExportDataset

type ExportDataset struct {
	// The export dataset configuration.
	Configuration *ExportDatasetConfiguration

	// The granularity of rows in the export. Currently only 'Daily' is supported.
	Granularity *GranularityType
}

ExportDataset - The definition for data in the export.

func (ExportDataset) MarshalJSON added in v1.1.0

func (e ExportDataset) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ExportDataset.

func (*ExportDataset) UnmarshalJSON added in v1.1.0

func (e *ExportDataset) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ExportDataset.

type ExportDatasetConfiguration

type ExportDatasetConfiguration struct {
	// Array of column names to be included in the export. If not provided then the export will include all available columns.
	// The available columns can vary by customer channel (see examples).
	Columns []*string
}

ExportDatasetConfiguration - The export dataset configuration. Allows columns to be selected for the export. If not provided then the export will include all available columns.

func (ExportDatasetConfiguration) MarshalJSON

func (e ExportDatasetConfiguration) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ExportDatasetConfiguration.

func (*ExportDatasetConfiguration) UnmarshalJSON added in v1.1.0

func (e *ExportDatasetConfiguration) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ExportDatasetConfiguration.

type ExportDefinition

type ExportDefinition struct {
	// REQUIRED; The time frame for pulling data for the export. If custom, then a specific time period must be provided.
	Timeframe *TimeframeType

	// REQUIRED; The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that do
	// not yet provide data for charges or amortization for service reservations.
	Type *ExportType

	// The definition for data in the export.
	DataSet *ExportDataset

	// Has time period for pulling data for the export.
	TimePeriod *ExportTimePeriod
}

ExportDefinition - The definition of an export.

func (ExportDefinition) MarshalJSON added in v1.1.0

func (e ExportDefinition) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ExportDefinition.

func (*ExportDefinition) UnmarshalJSON added in v1.1.0

func (e *ExportDefinition) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ExportDefinition.

type ExportDeliveryDestination

type ExportDeliveryDestination struct {
	// REQUIRED; The name of the container where exports will be uploaded. If the container does not exist it will be created.
	Container *string

	// The resource id of the storage account where exports will be delivered. This is not required if a sasToken and storageAccount
	// are specified.
	ResourceID *string

	// The name of the directory where exports will be uploaded.
	RootFolderPath *string

	// A SAS token for the storage account. For a restricted set of Azure customers this together with storageAccount can be specified
	// instead of resourceId. Note: the value returned by the API for this
	// property will always be obfuscated. Returning this same obfuscated value will not result in the SAS token being updated.
	// To update this value a new SAS token must be specified.
	SasToken *string

	// The storage account where exports will be uploaded. For a restricted set of Azure customers this together with sasToken
	// can be specified instead of resourceId.
	StorageAccount *string
}

ExportDeliveryDestination - This represents the blob storage account location where exports of costs will be delivered. There are two ways to configure the destination. The approach recommended for most customers is to specify the resourceId of the storage account. This requires a one-time registration of the account's subscription with the Microsoft.CostManagementExports resource provider in order to give Cost Management services access to the storage. When creating an export in the Azure portal this registration is performed automatically but API users may need to register the subscription explicitly (for more information see https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-supported-services ). Another way to configure the destination is available ONLY to Partners with a Microsoft Partner Agreement plan who are global admins of their billing account. These Partners, instead of specifying the resourceId of a storage account, can specify the storage account name along with a SAS token for the account. This allows exports of costs to a storage account in any tenant. The SAS token should be created for the blob service with Service/Container/Object resource types and with Read/Write/Delete/List/Add/Create permissions (for more information see https://docs.microsoft.com/en-us/azure/cost-management-billing/costs/export-cost-data-storage-account-sas-key ).

func (ExportDeliveryDestination) MarshalJSON added in v1.1.0

func (e ExportDeliveryDestination) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ExportDeliveryDestination.

func (*ExportDeliveryDestination) UnmarshalJSON added in v1.1.0

func (e *ExportDeliveryDestination) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ExportDeliveryDestination.

type ExportDeliveryInfo

type ExportDeliveryInfo struct {
	// REQUIRED; Has destination for the export being delivered.
	Destination *ExportDeliveryDestination
}

ExportDeliveryInfo - The delivery information associated with a export.

func (ExportDeliveryInfo) MarshalJSON added in v1.1.0

func (e ExportDeliveryInfo) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ExportDeliveryInfo.

func (*ExportDeliveryInfo) UnmarshalJSON added in v1.1.0

func (e *ExportDeliveryInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ExportDeliveryInfo.

type ExportExecution

type ExportExecution struct {
	// eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating
	// the latest version or not.
	ETag *string

	// The properties of the export execution.
	Properties *ExportExecutionProperties

	// READ-ONLY; Resource Id.
	ID *string

	// READ-ONLY; Resource name.
	Name *string

	// READ-ONLY; Resource type.
	Type *string
}

ExportExecution - An export execution.

func (ExportExecution) MarshalJSON added in v1.1.0

func (e ExportExecution) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ExportExecution.

func (*ExportExecution) UnmarshalJSON added in v1.1.0

func (e *ExportExecution) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ExportExecution.

type ExportExecutionListResult

type ExportExecutionListResult struct {
	// READ-ONLY; A list of export executions.
	Value []*ExportExecution
}

ExportExecutionListResult - Result of listing the execution history of an export.

func (ExportExecutionListResult) MarshalJSON

func (e ExportExecutionListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ExportExecutionListResult.

func (*ExportExecutionListResult) UnmarshalJSON added in v1.1.0

func (e *ExportExecutionListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ExportExecutionListResult.

type ExportExecutionProperties

type ExportExecutionProperties struct {
	// The details of any error.
	Error *ErrorDetails

	// The type of the export execution.
	ExecutionType *ExecutionType

	// The name of the exported file.
	FileName *string

	// The time when the export execution finished.
	ProcessingEndTime *time.Time

	// The time when export was picked up to be executed.
	ProcessingStartTime *time.Time

	// The export settings that were in effect for this execution.
	RunSettings *CommonExportProperties

	// The last known status of the export execution.
	Status *ExecutionStatus

	// The identifier for the entity that executed the export. For OnDemand executions it is the user email. For scheduled executions
	// it is 'System'.
	SubmittedBy *string

	// The time when export was queued to be executed.
	SubmittedTime *time.Time
}

ExportExecutionProperties - The properties of the export execution.

func (ExportExecutionProperties) MarshalJSON

func (e ExportExecutionProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ExportExecutionProperties.

func (*ExportExecutionProperties) UnmarshalJSON

func (e *ExportExecutionProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ExportExecutionProperties.

type ExportListResult

type ExportListResult struct {
	// READ-ONLY; The list of exports.
	Value []*Export
}

ExportListResult - Result of listing exports. It contains a list of available exports in the scope provided.

func (ExportListResult) MarshalJSON

func (e ExportListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ExportListResult.

func (*ExportListResult) UnmarshalJSON added in v1.1.0

func (e *ExportListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ExportListResult.

type ExportProperties

type ExportProperties struct {
	// REQUIRED; Has the definition for the export.
	Definition *ExportDefinition

	// REQUIRED; Has delivery information for the export.
	DeliveryInfo *ExportDeliveryInfo

	// The format of the export being delivered. Currently only 'Csv' is supported.
	Format *FormatType

	// If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file.
	// Note: this option is currently available only for modern commerce scopes.
	PartitionData *bool

	// If requested, has the most recent execution history for the export.
	RunHistory *ExportExecutionListResult

	// Has schedule information for the export.
	Schedule *ExportSchedule

	// READ-ONLY; If the export has an active schedule, provides an estimate of the next execution time.
	NextRunTimeEstimate *time.Time
}

ExportProperties - The properties of the export.

func (ExportProperties) MarshalJSON

func (e ExportProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ExportProperties.

func (*ExportProperties) UnmarshalJSON

func (e *ExportProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ExportProperties.

type ExportRecurrencePeriod

type ExportRecurrencePeriod struct {
	// REQUIRED; The start date of recurrence.
	From *time.Time

	// The end date of recurrence.
	To *time.Time
}

ExportRecurrencePeriod - The start and end date for recurrence schedule.

func (ExportRecurrencePeriod) MarshalJSON

func (e ExportRecurrencePeriod) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ExportRecurrencePeriod.

func (*ExportRecurrencePeriod) UnmarshalJSON

func (e *ExportRecurrencePeriod) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ExportRecurrencePeriod.

type ExportSchedule

type ExportSchedule struct {
	// The schedule recurrence.
	Recurrence *RecurrenceType

	// Has start and end date of the recurrence. The start date must be in future. If present, the end date must be greater than
	// start date.
	RecurrencePeriod *ExportRecurrencePeriod

	// The status of the export's schedule. If 'Inactive', the export's schedule is paused.
	Status *StatusType
}

ExportSchedule - The schedule associated with the export.

func (ExportSchedule) MarshalJSON added in v1.1.0

func (e ExportSchedule) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ExportSchedule.

func (*ExportSchedule) UnmarshalJSON added in v1.1.0

func (e *ExportSchedule) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ExportSchedule.

type ExportTimePeriod

type ExportTimePeriod struct {
	// REQUIRED; The start date for export data.
	From *time.Time

	// REQUIRED; The end date for export data.
	To *time.Time
}

ExportTimePeriod - The date range for data in the export. This should only be specified with timeFrame set to 'Custom'. The maximum date range is 3 months.

func (ExportTimePeriod) MarshalJSON

func (e ExportTimePeriod) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ExportTimePeriod.

func (*ExportTimePeriod) UnmarshalJSON

func (e *ExportTimePeriod) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ExportTimePeriod.

type ExportType

type ExportType string

ExportType - The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that do not yet provide data for charges or amortization for service reservations.

const (
	ExportTypeActualCost    ExportType = "ActualCost"
	ExportTypeAmortizedCost ExportType = "AmortizedCost"
	ExportTypeUsage         ExportType = "Usage"
)

func PossibleExportTypeValues

func PossibleExportTypeValues() []ExportType

PossibleExportTypeValues returns the possible values for the ExportType const type.

type ExportsClient

type ExportsClient struct {
	// contains filtered or unexported fields
}

ExportsClient contains the methods for the Exports group. Don't use this type directly, use NewExportsClient() instead.

func NewExportsClient

func NewExportsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ExportsClient, error)

NewExportsClient creates a new instance of ExportsClient with the specified values.

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*ExportsClient) CreateOrUpdate

func (client *ExportsClient) CreateOrUpdate(ctx context.Context, scope string, exportName string, parameters Export, options *ExportsClientCreateOrUpdateOptions) (ExportsClientCreateOrUpdateResponse, error)

CreateOrUpdate - The operation to create or update a export. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.
  • exportName - Export Name.
  • parameters - Parameters supplied to the CreateOrUpdate Export operation.
  • options - ExportsClientCreateOrUpdateOptions contains the optional parameters for the ExportsClient.CreateOrUpdate method.
Example (ExportCreateOrUpdateByBillingAccount)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportCreateOrUpdateByBillingAccount.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExportsClient().CreateOrUpdate(ctx, "providers/Microsoft.Billing/billingAccounts/123456", "TestExport", armcostmanagement.Export{
		Properties: &armcostmanagement.ExportProperties{
			Format: to.Ptr(armcostmanagement.FormatTypeCSV),
			Definition: &armcostmanagement.ExportDefinition{
				Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
				DataSet: &armcostmanagement.ExportDataset{
					Configuration: &armcostmanagement.ExportDatasetConfiguration{
						Columns: []*string{
							to.Ptr("Date"),
							to.Ptr("MeterId"),
							to.Ptr("ResourceId"),
							to.Ptr("ResourceLocation"),
							to.Ptr("Quantity")},
					},
					Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
				},
				Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
			},
			DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
				Destination: &armcostmanagement.ExportDeliveryDestination{
					Container:      to.Ptr("exports"),
					ResourceID:     to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
					RootFolderPath: to.Ptr("ad-hoc"),
				},
			},
			Schedule: &armcostmanagement.ExportSchedule{
				Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly),
				RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{
					From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t }()),
					To:   to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t }()),
				},
				Status: to.Ptr(armcostmanagement.StatusTypeActive),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.Export = armcostmanagement.Export{
	// 	Name: to.Ptr("TestExport"),
	// 	Type: to.Ptr("Microsoft.CostManagement/exports"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/123456/providers/Microsoft.CostManagement/exports/TestExport"),
	// 	Properties: &armcostmanagement.ExportProperties{
	// 		Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 		Definition: &armcostmanagement.ExportDefinition{
	// 			Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 			DataSet: &armcostmanagement.ExportDataset{
	// 				Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 					Columns: []*string{
	// 						to.Ptr("Date"),
	// 						to.Ptr("MeterId"),
	// 						to.Ptr("ResourceId"),
	// 						to.Ptr("ResourceLocation"),
	// 						to.Ptr("Quantity")},
	// 					},
	// 					Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 				},
	// 				Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
	// 			},
	// 			DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 				Destination: &armcostmanagement.ExportDeliveryDestination{
	// 					Container: to.Ptr("exports"),
	// 					ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 					RootFolderPath: to.Ptr("ad-hoc"),
	// 				},
	// 			},
	// 			Schedule: &armcostmanagement.ExportSchedule{
	// 				Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly),
	// 				RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{
	// 					From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 					To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 				},
	// 				Status: to.Ptr(armcostmanagement.StatusTypeActive),
	// 			},
	// 		},
	// 	}
}
Output:

Example (ExportCreateOrUpdateByDepartment)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportCreateOrUpdateByDepartment.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExportsClient().CreateOrUpdate(ctx, "providers/Microsoft.Billing/billingAccounts/12/departments/1234", "TestExport", armcostmanagement.Export{
		Properties: &armcostmanagement.ExportProperties{
			Format: to.Ptr(armcostmanagement.FormatTypeCSV),
			Definition: &armcostmanagement.ExportDefinition{
				Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
				DataSet: &armcostmanagement.ExportDataset{
					Configuration: &armcostmanagement.ExportDatasetConfiguration{
						Columns: []*string{
							to.Ptr("Date"),
							to.Ptr("MeterId"),
							to.Ptr("ResourceId"),
							to.Ptr("ResourceLocation"),
							to.Ptr("Quantity")},
					},
					Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
				},
				Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
			},
			DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
				Destination: &armcostmanagement.ExportDeliveryDestination{
					Container:      to.Ptr("exports"),
					ResourceID:     to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
					RootFolderPath: to.Ptr("ad-hoc"),
				},
			},
			Schedule: &armcostmanagement.ExportSchedule{
				Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly),
				RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{
					From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t }()),
					To:   to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t }()),
				},
				Status: to.Ptr(armcostmanagement.StatusTypeActive),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.Export = armcostmanagement.Export{
	// 	Name: to.Ptr("TestExport"),
	// 	Type: to.Ptr("Microsoft.CostManagement/exports"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12/departments/1234/providers/Microsoft.CostManagement/exports/TestExport"),
	// 	Properties: &armcostmanagement.ExportProperties{
	// 		Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 		Definition: &armcostmanagement.ExportDefinition{
	// 			Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 			DataSet: &armcostmanagement.ExportDataset{
	// 				Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 					Columns: []*string{
	// 						to.Ptr("Date"),
	// 						to.Ptr("MeterId"),
	// 						to.Ptr("ResourceId"),
	// 						to.Ptr("ResourceLocation"),
	// 						to.Ptr("Quantity")},
	// 					},
	// 					Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 				},
	// 				Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
	// 			},
	// 			DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 				Destination: &armcostmanagement.ExportDeliveryDestination{
	// 					Container: to.Ptr("exports"),
	// 					ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 					RootFolderPath: to.Ptr("ad-hoc"),
	// 				},
	// 			},
	// 			Schedule: &armcostmanagement.ExportSchedule{
	// 				Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly),
	// 				RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{
	// 					From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 					To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 				},
	// 				Status: to.Ptr(armcostmanagement.StatusTypeActive),
	// 			},
	// 		},
	// 	}
}
Output:

Example (ExportCreateOrUpdateByEnrollmentAccount)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportCreateOrUpdateByEnrollmentAccount.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExportsClient().CreateOrUpdate(ctx, "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", "TestExport", armcostmanagement.Export{
		Properties: &armcostmanagement.ExportProperties{
			Format: to.Ptr(armcostmanagement.FormatTypeCSV),
			Definition: &armcostmanagement.ExportDefinition{
				Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
				DataSet: &armcostmanagement.ExportDataset{
					Configuration: &armcostmanagement.ExportDatasetConfiguration{
						Columns: []*string{
							to.Ptr("Date"),
							to.Ptr("MeterId"),
							to.Ptr("ResourceId"),
							to.Ptr("ResourceLocation"),
							to.Ptr("Quantity")},
					},
					Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
				},
				Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
			},
			DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
				Destination: &armcostmanagement.ExportDeliveryDestination{
					Container:      to.Ptr("exports"),
					ResourceID:     to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
					RootFolderPath: to.Ptr("ad-hoc"),
				},
			},
			Schedule: &armcostmanagement.ExportSchedule{
				Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly),
				RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{
					From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t }()),
					To:   to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t }()),
				},
				Status: to.Ptr(armcostmanagement.StatusTypeActive),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.Export = armcostmanagement.Export{
	// 	Name: to.Ptr("TestExport"),
	// 	Type: to.Ptr("Microsoft.CostManagement/exports"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/Microsoft.CostManagement/exports/TestExport"),
	// 	Properties: &armcostmanagement.ExportProperties{
	// 		Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 		Definition: &armcostmanagement.ExportDefinition{
	// 			Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 			DataSet: &armcostmanagement.ExportDataset{
	// 				Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 					Columns: []*string{
	// 						to.Ptr("Date"),
	// 						to.Ptr("MeterId"),
	// 						to.Ptr("ResourceId"),
	// 						to.Ptr("ResourceLocation"),
	// 						to.Ptr("Quantity")},
	// 					},
	// 					Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 				},
	// 				Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
	// 			},
	// 			DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 				Destination: &armcostmanagement.ExportDeliveryDestination{
	// 					Container: to.Ptr("exports"),
	// 					ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 					RootFolderPath: to.Ptr("ad-hoc"),
	// 				},
	// 			},
	// 			Schedule: &armcostmanagement.ExportSchedule{
	// 				Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly),
	// 				RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{
	// 					From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 					To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 				},
	// 				Status: to.Ptr(armcostmanagement.StatusTypeActive),
	// 			},
	// 		},
	// 	}
}
Output:

Example (ExportCreateOrUpdateByManagementGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportCreateOrUpdateByManagementGroup.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExportsClient().CreateOrUpdate(ctx, "providers/Microsoft.Management/managementGroups/TestMG", "TestExport", armcostmanagement.Export{
		Properties: &armcostmanagement.ExportProperties{
			Format: to.Ptr(armcostmanagement.FormatTypeCSV),
			Definition: &armcostmanagement.ExportDefinition{
				Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
				DataSet: &armcostmanagement.ExportDataset{
					Configuration: &armcostmanagement.ExportDatasetConfiguration{
						Columns: []*string{
							to.Ptr("Date"),
							to.Ptr("MeterId"),
							to.Ptr("ResourceId"),
							to.Ptr("ResourceLocation"),
							to.Ptr("Quantity")},
					},
					Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
				},
				Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
			},
			DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
				Destination: &armcostmanagement.ExportDeliveryDestination{
					Container:      to.Ptr("exports"),
					ResourceID:     to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
					RootFolderPath: to.Ptr("ad-hoc"),
				},
			},
			Schedule: &armcostmanagement.ExportSchedule{
				Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly),
				RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{
					From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t }()),
					To:   to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t }()),
				},
				Status: to.Ptr(armcostmanagement.StatusTypeActive),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.Export = armcostmanagement.Export{
	// 	Name: to.Ptr("TestExport"),
	// 	Type: to.Ptr("Microsoft.CostManagement/exports"),
	// 	ID: to.Ptr("providers/Microsoft.Management/managementGroups/TestMG/providers/Microsoft.CostManagement/exports/TestExport"),
	// 	Properties: &armcostmanagement.ExportProperties{
	// 		Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 		Definition: &armcostmanagement.ExportDefinition{
	// 			Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 			DataSet: &armcostmanagement.ExportDataset{
	// 				Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 					Columns: []*string{
	// 						to.Ptr("Date"),
	// 						to.Ptr("MeterId"),
	// 						to.Ptr("ResourceId"),
	// 						to.Ptr("ResourceLocation"),
	// 						to.Ptr("Quantity")},
	// 					},
	// 					Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 				},
	// 				Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
	// 			},
	// 			DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 				Destination: &armcostmanagement.ExportDeliveryDestination{
	// 					Container: to.Ptr("exports"),
	// 					ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 					RootFolderPath: to.Ptr("ad-hoc"),
	// 				},
	// 			},
	// 			Schedule: &armcostmanagement.ExportSchedule{
	// 				Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly),
	// 				RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{
	// 					From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 					To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 				},
	// 				Status: to.Ptr(armcostmanagement.StatusTypeActive),
	// 			},
	// 		},
	// 	}
}
Output:

Example (ExportCreateOrUpdateByResourceGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportCreateOrUpdateByResourceGroup.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExportsClient().CreateOrUpdate(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", "TestExport", armcostmanagement.Export{
		Properties: &armcostmanagement.ExportProperties{
			Format: to.Ptr(armcostmanagement.FormatTypeCSV),
			Definition: &armcostmanagement.ExportDefinition{
				Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
				DataSet: &armcostmanagement.ExportDataset{
					Configuration: &armcostmanagement.ExportDatasetConfiguration{
						Columns: []*string{
							to.Ptr("Date"),
							to.Ptr("MeterId"),
							to.Ptr("ResourceId"),
							to.Ptr("ResourceLocation"),
							to.Ptr("Quantity")},
					},
					Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
				},
				Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
			},
			DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
				Destination: &armcostmanagement.ExportDeliveryDestination{
					Container:      to.Ptr("exports"),
					ResourceID:     to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
					RootFolderPath: to.Ptr("ad-hoc"),
				},
			},
			Schedule: &armcostmanagement.ExportSchedule{
				Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly),
				RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{
					From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t }()),
					To:   to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t }()),
				},
				Status: to.Ptr(armcostmanagement.StatusTypeActive),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.Export = armcostmanagement.Export{
	// 	Name: to.Ptr("TestExport"),
	// 	Type: to.Ptr("Microsoft.CostManagement/exports"),
	// 	ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/exports/TestExport"),
	// 	Properties: &armcostmanagement.ExportProperties{
	// 		Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 		Definition: &armcostmanagement.ExportDefinition{
	// 			Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 			DataSet: &armcostmanagement.ExportDataset{
	// 				Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 					Columns: []*string{
	// 						to.Ptr("Date"),
	// 						to.Ptr("MeterId"),
	// 						to.Ptr("ResourceId"),
	// 						to.Ptr("ResourceLocation"),
	// 						to.Ptr("Quantity")},
	// 					},
	// 					Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 				},
	// 				Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
	// 			},
	// 			DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 				Destination: &armcostmanagement.ExportDeliveryDestination{
	// 					Container: to.Ptr("exports"),
	// 					ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 					RootFolderPath: to.Ptr("ad-hoc"),
	// 				},
	// 			},
	// 			Schedule: &armcostmanagement.ExportSchedule{
	// 				Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly),
	// 				RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{
	// 					From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 					To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 				},
	// 				Status: to.Ptr(armcostmanagement.StatusTypeActive),
	// 			},
	// 		},
	// 	}
}
Output:

Example (ExportCreateOrUpdateBySubscription)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportCreateOrUpdateBySubscription.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExportsClient().CreateOrUpdate(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "TestExport", armcostmanagement.Export{
		Properties: &armcostmanagement.ExportProperties{
			Format: to.Ptr(armcostmanagement.FormatTypeCSV),
			Definition: &armcostmanagement.ExportDefinition{
				Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
				DataSet: &armcostmanagement.ExportDataset{
					Configuration: &armcostmanagement.ExportDatasetConfiguration{
						Columns: []*string{
							to.Ptr("Date"),
							to.Ptr("MeterId"),
							to.Ptr("ResourceId"),
							to.Ptr("ResourceLocation"),
							to.Ptr("Quantity")},
					},
					Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
				},
				Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
			},
			DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
				Destination: &armcostmanagement.ExportDeliveryDestination{
					Container:      to.Ptr("exports"),
					ResourceID:     to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
					RootFolderPath: to.Ptr("ad-hoc"),
				},
			},
			Schedule: &armcostmanagement.ExportSchedule{
				Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly),
				RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{
					From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t }()),
					To:   to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t }()),
				},
				Status: to.Ptr(armcostmanagement.StatusTypeActive),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.Export = armcostmanagement.Export{
	// 	Name: to.Ptr("TestExport"),
	// 	Type: to.Ptr("Microsoft.CostManagement/exports"),
	// 	ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/exports/TestExport"),
	// 	Properties: &armcostmanagement.ExportProperties{
	// 		Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 		Definition: &armcostmanagement.ExportDefinition{
	// 			Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 			DataSet: &armcostmanagement.ExportDataset{
	// 				Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 					Columns: []*string{
	// 						to.Ptr("Date"),
	// 						to.Ptr("MeterId"),
	// 						to.Ptr("ResourceId"),
	// 						to.Ptr("ResourceLocation"),
	// 						to.Ptr("Quantity")},
	// 					},
	// 					Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 				},
	// 				Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
	// 			},
	// 			DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 				Destination: &armcostmanagement.ExportDeliveryDestination{
	// 					Container: to.Ptr("exports"),
	// 					ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 					RootFolderPath: to.Ptr("ad-hoc"),
	// 				},
	// 			},
	// 			Schedule: &armcostmanagement.ExportSchedule{
	// 				Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly),
	// 				RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{
	// 					From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 					To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 				},
	// 				Status: to.Ptr(armcostmanagement.StatusTypeActive),
	// 			},
	// 		},
	// 	}
}
Output:

func (*ExportsClient) Delete

func (client *ExportsClient) Delete(ctx context.Context, scope string, exportName string, options *ExportsClientDeleteOptions) (ExportsClientDeleteResponse, error)

Delete - The operation to delete a export. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.
  • exportName - Export Name.
  • options - ExportsClientDeleteOptions contains the optional parameters for the ExportsClient.Delete method.
Example (ExportDeleteByBillingAccount)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportDeleteByBillingAccount.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewExportsClient().Delete(ctx, "providers/Microsoft.Billing/billingAccounts/123456", "TestExport", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

Example (ExportDeleteByDepartment)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportDeleteByDepartment.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewExportsClient().Delete(ctx, "providers/Microsoft.Billing/billingAccounts/12/departments/1234", "TestExport", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

Example (ExportDeleteByEnrollmentAccount)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportDeleteByEnrollmentAccount.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewExportsClient().Delete(ctx, "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", "TestExport", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

Example (ExportDeleteByManagementGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportDeleteByManagementGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewExportsClient().Delete(ctx, "providers/Microsoft.Management/managementGroups/TestMG", "TestExport", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

Example (ExportDeleteByResourceGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportDeleteByResourceGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewExportsClient().Delete(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", "TestExport", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

Example (ExportDeleteBySubscription)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportDeleteBySubscription.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewExportsClient().Delete(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "TestExport", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

func (*ExportsClient) Execute

func (client *ExportsClient) Execute(ctx context.Context, scope string, exportName string, options *ExportsClientExecuteOptions) (ExportsClientExecuteResponse, error)

Execute - The operation to execute an export. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.
  • exportName - Export Name.
  • options - ExportsClientExecuteOptions contains the optional parameters for the ExportsClient.Execute method.
Example (ExportRunByBillingAccount)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunByBillingAccount.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewExportsClient().Execute(ctx, "providers/Microsoft.Billing/billingAccounts/123456", "TestExport", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

Example (ExportRunByDepartment)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunByDepartment.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewExportsClient().Execute(ctx, "providers/Microsoft.Billing/billingAccounts/12/departments/1234", "TestExport", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

Example (ExportRunByEnrollmentAccount)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunByEnrollmentAccount.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewExportsClient().Execute(ctx, "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", "TestExport", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

Example (ExportRunByManagementGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunByManagementGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewExportsClient().Execute(ctx, "providers/Microsoft.Management/managementGroups/TestMG", "TestExport", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

Example (ExportRunByResourceGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunByResourceGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewExportsClient().Execute(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", "TestExport", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

Example (ExportRunBySubscription)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunBySubscription.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewExportsClient().Execute(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "TestExport", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

func (*ExportsClient) Get

func (client *ExportsClient) Get(ctx context.Context, scope string, exportName string, options *ExportsClientGetOptions) (ExportsClientGetResponse, error)

Get - The operation to get the export for the defined scope by export name. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.
  • exportName - Export Name.
  • options - ExportsClientGetOptions contains the optional parameters for the ExportsClient.Get method.
Example (ExportGetByBillingAccount)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportGetByBillingAccount.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExportsClient().Get(ctx, "providers/Microsoft.Billing/billingAccounts/123456", "TestExport", &armcostmanagement.ExportsClientGetOptions{Expand: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.Export = armcostmanagement.Export{
	// 	Name: to.Ptr("TestExport"),
	// 	Type: to.Ptr("Microsoft.CostManagement/exports"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/{billingAccount-Id}/providers/Microsoft.CostManagement/exports/TestExport"),
	// 	Properties: &armcostmanagement.ExportProperties{
	// 		Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 		Definition: &armcostmanagement.ExportDefinition{
	// 			Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 			DataSet: &armcostmanagement.ExportDataset{
	// 				Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 					Columns: []*string{
	// 						to.Ptr("Date"),
	// 						to.Ptr("MeterId"),
	// 						to.Ptr("ResourceId"),
	// 						to.Ptr("ResourceLocation"),
	// 						to.Ptr("Quantity")},
	// 					},
	// 					Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 				},
	// 				TimePeriod: &armcostmanagement.ExportTimePeriod{
	// 					From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T00:00:00Z"); return t}()),
	// 					To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-31T00:00:00Z"); return t}()),
	// 				},
	// 				Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom),
	// 			},
	// 			DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 				Destination: &armcostmanagement.ExportDeliveryDestination{
	// 					Container: to.Ptr("exports"),
	// 					ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 					RootFolderPath: to.Ptr("ad-hoc"),
	// 				},
	// 			},
	// 		},
	// 	}
}
Output:

Example (ExportGetByDepartment)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportGetByDepartment.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExportsClient().Get(ctx, "providers/Microsoft.Billing/billingAccounts/12/departments/1234", "TestExport", &armcostmanagement.ExportsClientGetOptions{Expand: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.Export = armcostmanagement.Export{
	// 	Name: to.Ptr("TestExport"),
	// 	Type: to.Ptr("Microsoft.CostManagement/exports"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12/departments/1234/providers/Microsoft.CostManagement/exports/TestExport"),
	// 	Properties: &armcostmanagement.ExportProperties{
	// 		Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 		Definition: &armcostmanagement.ExportDefinition{
	// 			Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 			DataSet: &armcostmanagement.ExportDataset{
	// 				Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 					Columns: []*string{
	// 						to.Ptr("Date"),
	// 						to.Ptr("MeterId"),
	// 						to.Ptr("ResourceId"),
	// 						to.Ptr("ResourceLocation"),
	// 						to.Ptr("Quantity")},
	// 					},
	// 					Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 				},
	// 				TimePeriod: &armcostmanagement.ExportTimePeriod{
	// 					From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 					To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-30T00:00:00Z"); return t}()),
	// 				},
	// 				Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom),
	// 			},
	// 			DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 				Destination: &armcostmanagement.ExportDeliveryDestination{
	// 					Container: to.Ptr("exports"),
	// 					ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 					RootFolderPath: to.Ptr("ad-hoc"),
	// 				},
	// 			},
	// 		},
	// 	}
}
Output:

Example (ExportGetByEnrollmentAccount)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportGetByEnrollmentAccount.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExportsClient().Get(ctx, "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", "TestExport", &armcostmanagement.ExportsClientGetOptions{Expand: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.Export = armcostmanagement.Export{
	// 	Name: to.Ptr("TestExport"),
	// 	Type: to.Ptr("Microsoft.CostManagement/exports"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/Microsoft.CostManagement/exports/TestExport"),
	// 	Properties: &armcostmanagement.ExportProperties{
	// 		Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 		Definition: &armcostmanagement.ExportDefinition{
	// 			Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 			DataSet: &armcostmanagement.ExportDataset{
	// 				Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 					Columns: []*string{
	// 						to.Ptr("Date"),
	// 						to.Ptr("MeterId"),
	// 						to.Ptr("ResourceId"),
	// 						to.Ptr("ResourceLocation"),
	// 						to.Ptr("Quantity")},
	// 					},
	// 					Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 				},
	// 				TimePeriod: &armcostmanagement.ExportTimePeriod{
	// 					From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-01T00:00:00Z"); return t}()),
	// 					To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00Z"); return t}()),
	// 				},
	// 				Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom),
	// 			},
	// 			DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 				Destination: &armcostmanagement.ExportDeliveryDestination{
	// 					Container: to.Ptr("exports"),
	// 					ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 					RootFolderPath: to.Ptr("ad-hoc"),
	// 				},
	// 			},
	// 		},
	// 	}
}
Output:

Example (ExportGetByManagementGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportGetByManagementGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExportsClient().Get(ctx, "providers/Microsoft.Management/managementGroups/TestMG", "TestExport", &armcostmanagement.ExportsClientGetOptions{Expand: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.Export = armcostmanagement.Export{
	// 	Name: to.Ptr("TestExport"),
	// 	Type: to.Ptr("Microsoft.CostManagement/exports"),
	// 	ID: to.Ptr("providers/Microsoft.Management/managementGroups/TestMG/providers/Microsoft.CostManagement/exports/TestExport"),
	// 	Properties: &armcostmanagement.ExportProperties{
	// 		Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 		Definition: &armcostmanagement.ExportDefinition{
	// 			Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 			DataSet: &armcostmanagement.ExportDataset{
	// 				Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 					Columns: []*string{
	// 						to.Ptr("UsageDate"),
	// 						to.Ptr("MeterId"),
	// 						to.Ptr("InstanceId"),
	// 						to.Ptr("ResourceLocation"),
	// 						to.Ptr("UsageQuantity")},
	// 					},
	// 					Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 				},
	// 				TimePeriod: &armcostmanagement.ExportTimePeriod{
	// 					From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-01T00:00:00Z"); return t}()),
	// 					To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 				},
	// 				Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom),
	// 			},
	// 			DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 				Destination: &armcostmanagement.ExportDeliveryDestination{
	// 					Container: to.Ptr("exports"),
	// 					ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 					RootFolderPath: to.Ptr("ad-hoc"),
	// 				},
	// 			},
	// 		},
	// 	}
}
Output:

Example (ExportGetByResourceGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportGetByResourceGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExportsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", "TestExport", &armcostmanagement.ExportsClientGetOptions{Expand: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.Export = armcostmanagement.Export{
	// 	Name: to.Ptr("TestExport"),
	// 	Type: to.Ptr("Microsoft.CostManagement/exports"),
	// 	ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/exports/TestExport"),
	// 	Properties: &armcostmanagement.ExportProperties{
	// 		Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 		Definition: &armcostmanagement.ExportDefinition{
	// 			Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 			DataSet: &armcostmanagement.ExportDataset{
	// 				Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 					Columns: []*string{
	// 						to.Ptr("Date"),
	// 						to.Ptr("MeterId"),
	// 						to.Ptr("ResourceId"),
	// 						to.Ptr("ResourceLocation"),
	// 						to.Ptr("Quantity")},
	// 					},
	// 					Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 				},
	// 				TimePeriod: &armcostmanagement.ExportTimePeriod{
	// 					From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 					To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-30T00:00:00Z"); return t}()),
	// 				},
	// 				Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom),
	// 			},
	// 			DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 				Destination: &armcostmanagement.ExportDeliveryDestination{
	// 					Container: to.Ptr("exports"),
	// 					ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 					RootFolderPath: to.Ptr("ad-hoc"),
	// 				},
	// 			},
	// 		},
	// 	}
}
Output:

Example (ExportGetBySubscription)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportGetBySubscription.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExportsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "TestExport", &armcostmanagement.ExportsClientGetOptions{Expand: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.Export = armcostmanagement.Export{
	// 	Name: to.Ptr("TestExport"),
	// 	Type: to.Ptr("Microsoft.CostManagement/exports"),
	// 	ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/exports/TestExport"),
	// 	Properties: &armcostmanagement.ExportProperties{
	// 		Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 		Definition: &armcostmanagement.ExportDefinition{
	// 			Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 			DataSet: &armcostmanagement.ExportDataset{
	// 				Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 					Columns: []*string{
	// 						to.Ptr("Date"),
	// 						to.Ptr("MeterId"),
	// 						to.Ptr("ResourceId"),
	// 						to.Ptr("ResourceLocation"),
	// 						to.Ptr("Quantity")},
	// 					},
	// 					Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 				},
	// 				TimePeriod: &armcostmanagement.ExportTimePeriod{
	// 					From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-01T00:00:00Z"); return t}()),
	// 					To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-31T00:00:00Z"); return t}()),
	// 				},
	// 				Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom),
	// 			},
	// 			DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 				Destination: &armcostmanagement.ExportDeliveryDestination{
	// 					Container: to.Ptr("exports"),
	// 					ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 					RootFolderPath: to.Ptr("ad-hoc"),
	// 				},
	// 			},
	// 		},
	// 	}
}
Output:

func (*ExportsClient) GetExecutionHistory

GetExecutionHistory - The operation to get the execution history of an export for the defined scope and export name. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.
  • exportName - Export Name.
  • options - ExportsClientGetExecutionHistoryOptions contains the optional parameters for the ExportsClient.GetExecutionHistory method.
Example (ExportRunHistoryGetByBillingAccount)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunHistoryGetByBillingAccount.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExportsClient().GetExecutionHistory(ctx, "providers/Microsoft.Billing/billingAccounts/123456", "TestExport", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.ExportExecutionListResult = armcostmanagement.ExportExecutionListResult{
	// 	Value: []*armcostmanagement.ExportExecution{
	// 		{
	// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/{billingAccount-id}/providers/Microsoft.CostManagement/exports/JohnDoeSchedule/Run/1e25d58a-a3b0-4916-9542-6e04a89bc100"),
	// 			Properties: &armcostmanagement.ExportExecutionProperties{
	// 				ExecutionType: to.Ptr(armcostmanagement.ExecutionTypeOnDemand),
	// 				FileName: to.Ptr("ScheduledTestsForJohnDoe/JohnDoeSchedule/20180729-20180804/JohnDoeSchedule_1e25d58a-a3b0-4916-9542-6e04a89bc100.csv"),
	// 				ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:28.0373318Z"); return t}()),
	// 				ProcessingStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:16.9123797Z"); return t}()),
	// 				RunSettings: &armcostmanagement.CommonExportProperties{
	// 					Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 					Definition: &armcostmanagement.ExportDefinition{
	// 						Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 						DataSet: &armcostmanagement.ExportDataset{
	// 							Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 								Columns: []*string{
	// 									to.Ptr("Date"),
	// 									to.Ptr("MeterId"),
	// 									to.Ptr("ResourceId"),
	// 									to.Ptr("ResourceLocation"),
	// 									to.Ptr("Quantity")},
	// 								},
	// 								Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 							},
	// 							TimePeriod: &armcostmanagement.ExportTimePeriod{
	// 								From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 								To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 							},
	// 							Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom),
	// 						},
	// 						DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 							Destination: &armcostmanagement.ExportDeliveryDestination{
	// 								Container: to.Ptr("exports"),
	// 								ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 								RootFolderPath: to.Ptr("ScheduledTestsForJohnDoe"),
	// 							},
	// 						},
	// 					},
	// 					Status: to.Ptr(armcostmanagement.ExecutionStatusCompleted),
	// 					SubmittedBy: to.Ptr("john.doe@gmail.com"),
	// 					SubmittedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:15.6016681Z"); return t}()),
	// 				},
	// 			},
	// 			{
	// 				ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/{billingAccount-id}/providers/Microsoft.CostManagement/exports/JohnDoeSchedule/Run/11ac6811-dca3-46ad-b326-4704cf0c58ef"),
	// 				Properties: &armcostmanagement.ExportExecutionProperties{
	// 					ExecutionType: to.Ptr(armcostmanagement.ExecutionTypeScheduled),
	// 					FileName: to.Ptr("ScheduledTestsForJohnDoe/JohnDoeSchedule/20180729-20180804/JohnDoeSchedule_11ac6811-dca3-46ad-b326-4704cf0c58ef.csv"),
	// 					ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:04:19.7223808Z"); return t}()),
	// 					ProcessingStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:03:58.5710244Z"); return t}()),
	// 					RunSettings: &armcostmanagement.CommonExportProperties{
	// 						Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 						Definition: &armcostmanagement.ExportDefinition{
	// 							Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 							DataSet: &armcostmanagement.ExportDataset{
	// 								Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 									Columns: []*string{
	// 										to.Ptr("Date"),
	// 										to.Ptr("MeterId"),
	// 										to.Ptr("ResourceId"),
	// 										to.Ptr("ResourceLocation"),
	// 										to.Ptr("Quantity")},
	// 									},
	// 									Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 								},
	// 								TimePeriod: &armcostmanagement.ExportTimePeriod{
	// 									From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 									To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 								},
	// 								Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom),
	// 							},
	// 							DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 								Destination: &armcostmanagement.ExportDeliveryDestination{
	// 									Container: to.Ptr("exports"),
	// 									ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 									RootFolderPath: to.Ptr("ScheduledTestsForJohnDoe"),
	// 								},
	// 							},
	// 						},
	// 						Status: to.Ptr(armcostmanagement.ExecutionStatusCompleted),
	// 						SubmittedBy: to.Ptr("System"),
	// 						SubmittedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:03:58.5710244Z"); return t}()),
	// 					},
	// 			}},
	// 		}
}
Output:

Example (ExportRunHistoryGetByDepartment)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunHistoryGetByDepartment.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExportsClient().GetExecutionHistory(ctx, "providers/Microsoft.Billing/billingAccounts/12/departments/1234", "TestExport", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.ExportExecutionListResult = armcostmanagement.ExportExecutionListResult{
	// 	Value: []*armcostmanagement.ExportExecution{
	// 		{
	// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12/departments/1234/providers/Microsoft.CostManagement/exports/JohnDoeSchedule/Run/1e25d58a-a3b0-4916-9542-6e04a89bc100"),
	// 			Properties: &armcostmanagement.ExportExecutionProperties{
	// 				ExecutionType: to.Ptr(armcostmanagement.ExecutionTypeOnDemand),
	// 				FileName: to.Ptr("ScheduledTestsForJohnDoe/JohnDoeSchedule/20180729-20180804/JohnDoeSchedule_1e25d58a-a3b0-4916-9542-6e04a89bc100.csv"),
	// 				ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:28.0373318Z"); return t}()),
	// 				ProcessingStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:16.9123797Z"); return t}()),
	// 				RunSettings: &armcostmanagement.CommonExportProperties{
	// 					Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 					Definition: &armcostmanagement.ExportDefinition{
	// 						Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 						DataSet: &armcostmanagement.ExportDataset{
	// 							Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 								Columns: []*string{
	// 									to.Ptr("Date"),
	// 									to.Ptr("MeterId"),
	// 									to.Ptr("ResourceId"),
	// 									to.Ptr("ResourceLocation"),
	// 									to.Ptr("Quantity")},
	// 								},
	// 								Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 							},
	// 							TimePeriod: &armcostmanagement.ExportTimePeriod{
	// 								From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 								To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 							},
	// 							Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom),
	// 						},
	// 						DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 							Destination: &armcostmanagement.ExportDeliveryDestination{
	// 								Container: to.Ptr("exports"),
	// 								ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 								RootFolderPath: to.Ptr("ScheduledTestsForJohnDoe"),
	// 							},
	// 						},
	// 					},
	// 					Status: to.Ptr(armcostmanagement.ExecutionStatusCompleted),
	// 					SubmittedBy: to.Ptr("john.doe@gmail.com"),
	// 					SubmittedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:15.6016681Z"); return t}()),
	// 				},
	// 			},
	// 			{
	// 				ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12/departments/1234/providers/Microsoft.CostManagement/exports/JohnDoeSchedule/Run/11ac6811-dca3-46ad-b326-4704cf0c58ef"),
	// 				Properties: &armcostmanagement.ExportExecutionProperties{
	// 					ExecutionType: to.Ptr(armcostmanagement.ExecutionTypeScheduled),
	// 					FileName: to.Ptr("ScheduledTestsForJohnDoe/JohnDoeSchedule/20180729-20180804/JohnDoeSchedule_11ac6811-dca3-46ad-b326-4704cf0c58ef.csv"),
	// 					ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:04:19.7223808Z"); return t}()),
	// 					ProcessingStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:03:58.5710244Z"); return t}()),
	// 					RunSettings: &armcostmanagement.CommonExportProperties{
	// 						Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 						Definition: &armcostmanagement.ExportDefinition{
	// 							Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 							DataSet: &armcostmanagement.ExportDataset{
	// 								Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 									Columns: []*string{
	// 										to.Ptr("Date"),
	// 										to.Ptr("MeterId"),
	// 										to.Ptr("ResourceId"),
	// 										to.Ptr("ResourceLocation"),
	// 										to.Ptr("Quantity")},
	// 									},
	// 									Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 								},
	// 								TimePeriod: &armcostmanagement.ExportTimePeriod{
	// 									From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 									To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 								},
	// 								Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom),
	// 							},
	// 							DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 								Destination: &armcostmanagement.ExportDeliveryDestination{
	// 									Container: to.Ptr("exports"),
	// 									ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 									RootFolderPath: to.Ptr("ScheduledTestsForJohnDoe"),
	// 								},
	// 							},
	// 						},
	// 						Status: to.Ptr(armcostmanagement.ExecutionStatusCompleted),
	// 						SubmittedBy: to.Ptr("System"),
	// 						SubmittedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:03:58.5710244Z"); return t}()),
	// 					},
	// 			}},
	// 		}
}
Output:

Example (ExportRunHistoryGetByEnrollmentAccount)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunHistoryGetByEnrollmentAccount.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExportsClient().GetExecutionHistory(ctx, "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", "TestExport", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.ExportExecutionListResult = armcostmanagement.ExportExecutionListResult{
	// 	Value: []*armcostmanagement.ExportExecution{
	// 		{
	// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/Microsoft.CostManagement/exports/JohnDoeSchedule/Run/1e25d58a-a3b0-4916-9542-6e04a89bc100"),
	// 			Properties: &armcostmanagement.ExportExecutionProperties{
	// 				ExecutionType: to.Ptr(armcostmanagement.ExecutionTypeOnDemand),
	// 				FileName: to.Ptr("ScheduledTestsForJohnDoe/JohnDoeSchedule/20180729-20180804/JohnDoeSchedule_1e25d58a-a3b0-4916-9542-6e04a89bc100.csv"),
	// 				ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:28.0373318Z"); return t}()),
	// 				ProcessingStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:16.9123797Z"); return t}()),
	// 				RunSettings: &armcostmanagement.CommonExportProperties{
	// 					Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 					Definition: &armcostmanagement.ExportDefinition{
	// 						Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 						DataSet: &armcostmanagement.ExportDataset{
	// 							Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 								Columns: []*string{
	// 									to.Ptr("Date"),
	// 									to.Ptr("MeterId"),
	// 									to.Ptr("ResourceId"),
	// 									to.Ptr("ResourceLocation"),
	// 									to.Ptr("Quantity")},
	// 								},
	// 								Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 							},
	// 							TimePeriod: &armcostmanagement.ExportTimePeriod{
	// 								From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 								To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 							},
	// 							Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom),
	// 						},
	// 						DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 							Destination: &armcostmanagement.ExportDeliveryDestination{
	// 								Container: to.Ptr("exports"),
	// 								ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 								RootFolderPath: to.Ptr("ScheduledTestsForJohnDoe"),
	// 							},
	// 						},
	// 					},
	// 					Status: to.Ptr(armcostmanagement.ExecutionStatusCompleted),
	// 					SubmittedBy: to.Ptr("john.doe@gmail.com"),
	// 					SubmittedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:15.6016681Z"); return t}()),
	// 				},
	// 			},
	// 			{
	// 				ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/Microsoft.CostManagement/exports/JohnDoeSchedule/Run/11ac6811-dca3-46ad-b326-4704cf0c58ef"),
	// 				Properties: &armcostmanagement.ExportExecutionProperties{
	// 					ExecutionType: to.Ptr(armcostmanagement.ExecutionTypeScheduled),
	// 					FileName: to.Ptr("ScheduledTestsForJohnDoe/JohnDoeSchedule/20180729-20180804/JohnDoeSchedule_11ac6811-dca3-46ad-b326-4704cf0c58ef.csv"),
	// 					ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:04:19.7223808Z"); return t}()),
	// 					ProcessingStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:03:58.5710244Z"); return t}()),
	// 					RunSettings: &armcostmanagement.CommonExportProperties{
	// 						Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 						Definition: &armcostmanagement.ExportDefinition{
	// 							Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 							DataSet: &armcostmanagement.ExportDataset{
	// 								Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 									Columns: []*string{
	// 										to.Ptr("Date"),
	// 										to.Ptr("MeterId"),
	// 										to.Ptr("ResourceId"),
	// 										to.Ptr("ResourceLocation"),
	// 										to.Ptr("Quantity")},
	// 									},
	// 									Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 								},
	// 								TimePeriod: &armcostmanagement.ExportTimePeriod{
	// 									From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 									To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 								},
	// 								Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom),
	// 							},
	// 							DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 								Destination: &armcostmanagement.ExportDeliveryDestination{
	// 									Container: to.Ptr("exports"),
	// 									ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 									RootFolderPath: to.Ptr("ScheduledTestsForJohnDoe"),
	// 								},
	// 							},
	// 						},
	// 						Status: to.Ptr(armcostmanagement.ExecutionStatusCompleted),
	// 						SubmittedBy: to.Ptr("System"),
	// 						SubmittedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:03:58.5710244Z"); return t}()),
	// 					},
	// 			}},
	// 		}
}
Output:

Example (ExportRunHistoryGetByManagementGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunHistoryGetByManagementGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExportsClient().GetExecutionHistory(ctx, "providers/Microsoft.Management/managementGroups/TestMG", "TestExport", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.ExportExecutionListResult = armcostmanagement.ExportExecutionListResult{
	// 	Value: []*armcostmanagement.ExportExecution{
	// 		{
	// 			ID: to.Ptr("providers/Microsoft.Management/managementGroups/TestMG/providers/Microsoft.CostManagement/exports/TestExport/Run/1e25d58a-a3b0-4916-9542-6e04a89bc100"),
	// 			Properties: &armcostmanagement.ExportExecutionProperties{
	// 				ExecutionType: to.Ptr(armcostmanagement.ExecutionTypeOnDemand),
	// 				FileName: to.Ptr("ScheduledForTestExport/TestExportSchedule/20180729-20180804/TestExportSchedule_1e25d58a-a3b0-4916-9542-6e04a89bc100.csv"),
	// 				ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:28.0373318Z"); return t}()),
	// 				ProcessingStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:16.9123797Z"); return t}()),
	// 				RunSettings: &armcostmanagement.CommonExportProperties{
	// 					Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 					Definition: &armcostmanagement.ExportDefinition{
	// 						Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 						DataSet: &armcostmanagement.ExportDataset{
	// 							Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 								Columns: []*string{
	// 									to.Ptr("Date"),
	// 									to.Ptr("MeterId"),
	// 									to.Ptr("ResourceId"),
	// 									to.Ptr("ResourceLocation"),
	// 									to.Ptr("Quantity")},
	// 								},
	// 								Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 							},
	// 							TimePeriod: &armcostmanagement.ExportTimePeriod{
	// 								From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 								To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 							},
	// 							Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom),
	// 						},
	// 						DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 							Destination: &armcostmanagement.ExportDeliveryDestination{
	// 								Container: to.Ptr("exports"),
	// 								ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 								RootFolderPath: to.Ptr("ScheduledTestsForJohnDoe"),
	// 							},
	// 						},
	// 					},
	// 					Status: to.Ptr(armcostmanagement.ExecutionStatusCompleted),
	// 					SubmittedBy: to.Ptr("john.doe@gmail.com"),
	// 					SubmittedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:15.6016681Z"); return t}()),
	// 				},
	// 			},
	// 			{
	// 				ID: to.Ptr("providers/Microsoft.Management/managementGroups/TestMG/providers/Microsoft.CostManagement/exports/TestExport/Run/11ac6811-dca3-46ad-b326-4704cf0c58ef"),
	// 				Properties: &armcostmanagement.ExportExecutionProperties{
	// 					ExecutionType: to.Ptr(armcostmanagement.ExecutionTypeScheduled),
	// 					FileName: to.Ptr("ScheduledForTestExport/TestExportSchedule/20180729-20180804/TestExportSchedule_11ac6811-dca3-46ad-b326-4704cf0c58ef.csv"),
	// 					ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:04:19.7223808Z"); return t}()),
	// 					ProcessingStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:03:58.5710244Z"); return t}()),
	// 					RunSettings: &armcostmanagement.CommonExportProperties{
	// 						Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 						Definition: &armcostmanagement.ExportDefinition{
	// 							Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 							DataSet: &armcostmanagement.ExportDataset{
	// 								Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 									Columns: []*string{
	// 										to.Ptr("Date"),
	// 										to.Ptr("MeterId"),
	// 										to.Ptr("ResourceId"),
	// 										to.Ptr("ResourceLocation"),
	// 										to.Ptr("Quantity")},
	// 									},
	// 									Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 								},
	// 								TimePeriod: &armcostmanagement.ExportTimePeriod{
	// 									From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 									To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 								},
	// 								Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom),
	// 							},
	// 							DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 								Destination: &armcostmanagement.ExportDeliveryDestination{
	// 									Container: to.Ptr("exports"),
	// 									ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 									RootFolderPath: to.Ptr("ScheduledTestsForJohnDoe"),
	// 								},
	// 							},
	// 						},
	// 						Status: to.Ptr(armcostmanagement.ExecutionStatusCompleted),
	// 						SubmittedBy: to.Ptr("System"),
	// 						SubmittedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:03:58.5710244Z"); return t}()),
	// 					},
	// 			}},
	// 		}
}
Output:

Example (ExportRunHistoryGetByResourceGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunHistoryGetByResourceGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExportsClient().GetExecutionHistory(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", "TestExport", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.ExportExecutionListResult = armcostmanagement.ExportExecutionListResult{
	// 	Value: []*armcostmanagement.ExportExecution{
	// 		{
	// 			ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/exports/JohnDoeSchedule/Run/1e25d58a-a3b0-4916-9542-6e04a89bc100"),
	// 			Properties: &armcostmanagement.ExportExecutionProperties{
	// 				ExecutionType: to.Ptr(armcostmanagement.ExecutionTypeOnDemand),
	// 				FileName: to.Ptr("ScheduledTestsForJohnDoe/JohnDoeSchedule/20180729-20180804/JohnDoeSchedule_1e25d58a-a3b0-4916-9542-6e04a89bc100.csv"),
	// 				ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:28.0373318Z"); return t}()),
	// 				ProcessingStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:16.9123797Z"); return t}()),
	// 				RunSettings: &armcostmanagement.CommonExportProperties{
	// 					Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 					Definition: &armcostmanagement.ExportDefinition{
	// 						Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 						DataSet: &armcostmanagement.ExportDataset{
	// 							Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 								Columns: []*string{
	// 									to.Ptr("Date"),
	// 									to.Ptr("MeterId"),
	// 									to.Ptr("ResourceId"),
	// 									to.Ptr("ResourceLocation"),
	// 									to.Ptr("Quantity")},
	// 								},
	// 								Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 							},
	// 							TimePeriod: &armcostmanagement.ExportTimePeriod{
	// 								From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 								To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 							},
	// 							Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom),
	// 						},
	// 						DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 							Destination: &armcostmanagement.ExportDeliveryDestination{
	// 								Container: to.Ptr("exports"),
	// 								ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 								RootFolderPath: to.Ptr("ScheduledTestsForJohnDoe"),
	// 							},
	// 						},
	// 					},
	// 					Status: to.Ptr(armcostmanagement.ExecutionStatusCompleted),
	// 					SubmittedBy: to.Ptr("john.doe@gmail.com"),
	// 					SubmittedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:15.6016681Z"); return t}()),
	// 				},
	// 			},
	// 			{
	// 				ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/exports/JohnDoeSchedule/Run/11ac6811-dca3-46ad-b326-4704cf0c58ef"),
	// 				Properties: &armcostmanagement.ExportExecutionProperties{
	// 					ExecutionType: to.Ptr(armcostmanagement.ExecutionTypeScheduled),
	// 					FileName: to.Ptr("ScheduledTestsForJohnDoe/JohnDoeSchedule/20180729-20180804/JohnDoeSchedule_11ac6811-dca3-46ad-b326-4704cf0c58ef.csv"),
	// 					ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:04:19.7223808Z"); return t}()),
	// 					ProcessingStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:03:58.5710244Z"); return t}()),
	// 					RunSettings: &armcostmanagement.CommonExportProperties{
	// 						Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 						Definition: &armcostmanagement.ExportDefinition{
	// 							Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 							DataSet: &armcostmanagement.ExportDataset{
	// 								Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 									Columns: []*string{
	// 										to.Ptr("Date"),
	// 										to.Ptr("MeterId"),
	// 										to.Ptr("ResourceId"),
	// 										to.Ptr("ResourceLocation"),
	// 										to.Ptr("Quantity")},
	// 									},
	// 									Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 								},
	// 								TimePeriod: &armcostmanagement.ExportTimePeriod{
	// 									From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 									To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 								},
	// 								Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom),
	// 							},
	// 							DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 								Destination: &armcostmanagement.ExportDeliveryDestination{
	// 									Container: to.Ptr("exports"),
	// 									ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 									RootFolderPath: to.Ptr("ScheduledTestsForJohnDoe"),
	// 								},
	// 							},
	// 						},
	// 						Status: to.Ptr(armcostmanagement.ExecutionStatusCompleted),
	// 						SubmittedBy: to.Ptr("System"),
	// 						SubmittedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:03:58.5710244Z"); return t}()),
	// 					},
	// 			}},
	// 		}
}
Output:

Example (ExportRunHistoryGetBySubscription)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunHistoryGetBySubscription.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExportsClient().GetExecutionHistory(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "TestExport", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.ExportExecutionListResult = armcostmanagement.ExportExecutionListResult{
	// 	Value: []*armcostmanagement.ExportExecution{
	// 		{
	// 			ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/exports/JohnDoeSchedule/Run/1e25d58a-a3b0-4916-9542-6e04a89bc100"),
	// 			Properties: &armcostmanagement.ExportExecutionProperties{
	// 				ExecutionType: to.Ptr(armcostmanagement.ExecutionTypeOnDemand),
	// 				FileName: to.Ptr("ScheduledTestsForJohnDoe/JohnDoeSchedule/20180729-20180804/JohnDoeSchedule_1e25d58a-a3b0-4916-9542-6e04a89bc100.csv"),
	// 				ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:28.0373318Z"); return t}()),
	// 				ProcessingStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:16.9123797Z"); return t}()),
	// 				RunSettings: &armcostmanagement.CommonExportProperties{
	// 					Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 					Definition: &armcostmanagement.ExportDefinition{
	// 						Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 						DataSet: &armcostmanagement.ExportDataset{
	// 							Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 								Columns: []*string{
	// 									to.Ptr("Date"),
	// 									to.Ptr("MeterId"),
	// 									to.Ptr("ResourceId"),
	// 									to.Ptr("ResourceLocation"),
	// 									to.Ptr("Quantity")},
	// 								},
	// 								Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 							},
	// 							TimePeriod: &armcostmanagement.ExportTimePeriod{
	// 								From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 								To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 							},
	// 							Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom),
	// 						},
	// 						DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 							Destination: &armcostmanagement.ExportDeliveryDestination{
	// 								Container: to.Ptr("exports"),
	// 								ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 								RootFolderPath: to.Ptr("ScheduledTestsForJohnDoe"),
	// 							},
	// 						},
	// 					},
	// 					Status: to.Ptr(armcostmanagement.ExecutionStatusCompleted),
	// 					SubmittedBy: to.Ptr("john.doe@gmail.com"),
	// 					SubmittedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:15.6016681Z"); return t}()),
	// 				},
	// 			},
	// 			{
	// 				ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/exports/JohnDoeSchedule/Run/11ac6811-dca3-46ad-b326-4704cf0c58ef"),
	// 				Properties: &armcostmanagement.ExportExecutionProperties{
	// 					ExecutionType: to.Ptr(armcostmanagement.ExecutionTypeScheduled),
	// 					FileName: to.Ptr("ScheduledTestsForJohnDoe/JohnDoeSchedule/20180729-20180804/JohnDoeSchedule_11ac6811-dca3-46ad-b326-4704cf0c58ef.csv"),
	// 					ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:04:19.7223808Z"); return t}()),
	// 					ProcessingStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:03:58.5710244Z"); return t}()),
	// 					RunSettings: &armcostmanagement.CommonExportProperties{
	// 						Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 						Definition: &armcostmanagement.ExportDefinition{
	// 							Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 							DataSet: &armcostmanagement.ExportDataset{
	// 								Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 									Columns: []*string{
	// 										to.Ptr("Date"),
	// 										to.Ptr("MeterId"),
	// 										to.Ptr("ResourceId"),
	// 										to.Ptr("ResourceLocation"),
	// 										to.Ptr("Quantity")},
	// 									},
	// 									Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 								},
	// 								TimePeriod: &armcostmanagement.ExportTimePeriod{
	// 									From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 									To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 								},
	// 								Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom),
	// 							},
	// 							DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 								Destination: &armcostmanagement.ExportDeliveryDestination{
	// 									Container: to.Ptr("exports"),
	// 									ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 									RootFolderPath: to.Ptr("ScheduledTestsForJohnDoe"),
	// 								},
	// 							},
	// 						},
	// 						Status: to.Ptr(armcostmanagement.ExecutionStatusCompleted),
	// 						SubmittedBy: to.Ptr("System"),
	// 						SubmittedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:03:58.5710244Z"); return t}()),
	// 					},
	// 			}},
	// 		}
}
Output:

func (*ExportsClient) List

List - The operation to list all exports at the given scope. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.
  • options - ExportsClientListOptions contains the optional parameters for the ExportsClient.List method.
Example (ExportsGetByBillingAccount)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportsGetByBillingAccount.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExportsClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/123456", &armcostmanagement.ExportsClientListOptions{Expand: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.ExportListResult = armcostmanagement.ExportListResult{
	// 	Value: []*armcostmanagement.Export{
	// 		{
	// 			Name: to.Ptr("TestExport1"),
	// 			Type: to.Ptr("Microsoft.CostManagement/exports"),
	// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/123456/providers/Microsoft.CostManagement/exports/TestExport1"),
	// 			Properties: &armcostmanagement.ExportProperties{
	// 				Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 				Definition: &armcostmanagement.ExportDefinition{
	// 					Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 					DataSet: &armcostmanagement.ExportDataset{
	// 						Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 							Columns: []*string{
	// 								to.Ptr("Date"),
	// 								to.Ptr("MeterId"),
	// 								to.Ptr("ResourceId"),
	// 								to.Ptr("ResourceLocation"),
	// 								to.Ptr("Quantity")},
	// 							},
	// 							Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 						},
	// 						TimePeriod: &armcostmanagement.ExportTimePeriod{
	// 							From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 							To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 						},
	// 						Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom),
	// 					},
	// 					DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 						Destination: &armcostmanagement.ExportDeliveryDestination{
	// 							Container: to.Ptr("exports"),
	// 							ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 							RootFolderPath: to.Ptr("ad-hoc"),
	// 						},
	// 					},
	// 				},
	// 			},
	// 			{
	// 				Name: to.Ptr("TestExport2"),
	// 				Type: to.Ptr("Microsoft.CostManagement/exports"),
	// 				ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/123456/providers/Microsoft.CostManagement/exports/TestExport2"),
	// 				Properties: &armcostmanagement.ExportProperties{
	// 					Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 					Definition: &armcostmanagement.ExportDefinition{
	// 						Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 						DataSet: &armcostmanagement.ExportDataset{
	// 							Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 								Columns: []*string{
	// 									to.Ptr("Date"),
	// 									to.Ptr("MeterId"),
	// 									to.Ptr("ResourceId"),
	// 									to.Ptr("ResourceLocation"),
	// 									to.Ptr("Quantity")},
	// 								},
	// 								Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 							},
	// 							Timeframe: to.Ptr(armcostmanagement.TimeframeTypeWeekToDate),
	// 						},
	// 						DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 							Destination: &armcostmanagement.ExportDeliveryDestination{
	// 								Container: to.Ptr("exports"),
	// 								ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 								RootFolderPath: to.Ptr("ad-hoc"),
	// 							},
	// 						},
	// 						Schedule: &armcostmanagement.ExportSchedule{
	// 							Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly),
	// 							RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{
	// 								From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 								To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 							},
	// 							Status: to.Ptr(armcostmanagement.StatusTypeActive),
	// 						},
	// 					},
	// 			}},
	// 		}
}
Output:

Example (ExportsGetByDepartment)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportsGetByDepartment.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExportsClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/12/departments/123", &armcostmanagement.ExportsClientListOptions{Expand: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.ExportListResult = armcostmanagement.ExportListResult{
	// 	Value: []*armcostmanagement.Export{
	// 		{
	// 			Name: to.Ptr("TestExport1"),
	// 			Type: to.Ptr("Microsoft.CostManagement/exports"),
	// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12/departments/1234/providers/Microsoft.CostManagement/exports/TestExport1"),
	// 			Properties: &armcostmanagement.ExportProperties{
	// 				Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 				Definition: &armcostmanagement.ExportDefinition{
	// 					Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 					DataSet: &armcostmanagement.ExportDataset{
	// 						Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 							Columns: []*string{
	// 								to.Ptr("Date"),
	// 								to.Ptr("MeterId"),
	// 								to.Ptr("ResourceId"),
	// 								to.Ptr("ResourceLocation"),
	// 								to.Ptr("Quantity")},
	// 							},
	// 							Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 						},
	// 						TimePeriod: &armcostmanagement.ExportTimePeriod{
	// 							From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 							To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 						},
	// 						Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom),
	// 					},
	// 					DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 						Destination: &armcostmanagement.ExportDeliveryDestination{
	// 							Container: to.Ptr("exports"),
	// 							ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 							RootFolderPath: to.Ptr("ad-hoc"),
	// 						},
	// 					},
	// 				},
	// 			},
	// 			{
	// 				Name: to.Ptr("TestExport2"),
	// 				Type: to.Ptr("Microsoft.CostManagement/exports"),
	// 				ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12/departments/1234/providers/Microsoft.CostManagement/exports/TestExport2"),
	// 				Properties: &armcostmanagement.ExportProperties{
	// 					Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 					Definition: &armcostmanagement.ExportDefinition{
	// 						Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 						DataSet: &armcostmanagement.ExportDataset{
	// 							Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 								Columns: []*string{
	// 									to.Ptr("Date"),
	// 									to.Ptr("MeterId"),
	// 									to.Ptr("ResourceId"),
	// 									to.Ptr("ResourceLocation"),
	// 									to.Ptr("Quantity")},
	// 								},
	// 								Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 							},
	// 							Timeframe: to.Ptr(armcostmanagement.TimeframeTypeWeekToDate),
	// 						},
	// 						DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 							Destination: &armcostmanagement.ExportDeliveryDestination{
	// 								Container: to.Ptr("exports"),
	// 								ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 								RootFolderPath: to.Ptr("ad-hoc"),
	// 							},
	// 						},
	// 						Schedule: &armcostmanagement.ExportSchedule{
	// 							Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly),
	// 							RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{
	// 								From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 								To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 							},
	// 							Status: to.Ptr(armcostmanagement.StatusTypeActive),
	// 						},
	// 					},
	// 			}},
	// 		}
}
Output:

Example (ExportsGetByEnrollmentAccount)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportsGetByEnrollmentAccount.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExportsClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", &armcostmanagement.ExportsClientListOptions{Expand: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.ExportListResult = armcostmanagement.ExportListResult{
	// 	Value: []*armcostmanagement.Export{
	// 		{
	// 			Name: to.Ptr("TestExport1"),
	// 			Type: to.Ptr("Microsoft.CostManagement/exports"),
	// 			ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/Microsoft.CostManagement/exports/TestExport1"),
	// 			Properties: &armcostmanagement.ExportProperties{
	// 				Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 				Definition: &armcostmanagement.ExportDefinition{
	// 					Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 					DataSet: &armcostmanagement.ExportDataset{
	// 						Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 							Columns: []*string{
	// 								to.Ptr("Date"),
	// 								to.Ptr("MeterId"),
	// 								to.Ptr("ResourceId"),
	// 								to.Ptr("ResourceLocation"),
	// 								to.Ptr("Quantity")},
	// 							},
	// 							Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 						},
	// 						TimePeriod: &armcostmanagement.ExportTimePeriod{
	// 							From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 							To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 						},
	// 						Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom),
	// 					},
	// 					DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 						Destination: &armcostmanagement.ExportDeliveryDestination{
	// 							Container: to.Ptr("exports"),
	// 							ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 							RootFolderPath: to.Ptr("ad-hoc"),
	// 						},
	// 					},
	// 				},
	// 			},
	// 			{
	// 				Name: to.Ptr("TestExport2"),
	// 				Type: to.Ptr("Microsoft.CostManagement/exports"),
	// 				ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/Microsoft.CostManagement/exports/TestExport2"),
	// 				Properties: &armcostmanagement.ExportProperties{
	// 					Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 					Definition: &armcostmanagement.ExportDefinition{
	// 						Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 						DataSet: &armcostmanagement.ExportDataset{
	// 							Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 								Columns: []*string{
	// 									to.Ptr("Date"),
	// 									to.Ptr("MeterId"),
	// 									to.Ptr("ResourceId"),
	// 									to.Ptr("ResourceLocation"),
	// 									to.Ptr("Quantity")},
	// 								},
	// 								Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 							},
	// 							Timeframe: to.Ptr(armcostmanagement.TimeframeTypeWeekToDate),
	// 						},
	// 						DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 							Destination: &armcostmanagement.ExportDeliveryDestination{
	// 								Container: to.Ptr("exports"),
	// 								ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 								RootFolderPath: to.Ptr("ad-hoc"),
	// 							},
	// 						},
	// 						Schedule: &armcostmanagement.ExportSchedule{
	// 							Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly),
	// 							RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{
	// 								From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 								To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 							},
	// 							Status: to.Ptr(armcostmanagement.StatusTypeActive),
	// 						},
	// 					},
	// 			}},
	// 		}
}
Output:

Example (ExportsGetByManagementGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportsGetByManagementGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExportsClient().List(ctx, "providers/Microsoft.Management/managementGroups/TestMG", &armcostmanagement.ExportsClientListOptions{Expand: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.ExportListResult = armcostmanagement.ExportListResult{
	// 	Value: []*armcostmanagement.Export{
	// 		{
	// 			Name: to.Ptr("TestExport1"),
	// 			Type: to.Ptr("Microsoft.CostManagement/exports"),
	// 			ID: to.Ptr("providers/Microsoft.Management/managementGroups/TestMG/providers/Microsoft.CostManagement/exports/TestExport1"),
	// 			Properties: &armcostmanagement.ExportProperties{
	// 				Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 				Definition: &armcostmanagement.ExportDefinition{
	// 					Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 					DataSet: &armcostmanagement.ExportDataset{
	// 						Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 							Columns: []*string{
	// 								to.Ptr("Date"),
	// 								to.Ptr("MeterId"),
	// 								to.Ptr("ResourceId"),
	// 								to.Ptr("ResourceLocation"),
	// 								to.Ptr("Quantity")},
	// 							},
	// 							Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 						},
	// 						TimePeriod: &armcostmanagement.ExportTimePeriod{
	// 							From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 							To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 						},
	// 						Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom),
	// 					},
	// 					DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 						Destination: &armcostmanagement.ExportDeliveryDestination{
	// 							Container: to.Ptr("exports"),
	// 							ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 							RootFolderPath: to.Ptr("ad-hoc"),
	// 						},
	// 					},
	// 				},
	// 			},
	// 			{
	// 				Name: to.Ptr("TestExport2"),
	// 				Type: to.Ptr("Microsoft.CostManagement/exports"),
	// 				ID: to.Ptr("providers/Microsoft.Management/managementGroups/TestMG/providers/Microsoft.CostManagement/exports/TestExport2"),
	// 				Properties: &armcostmanagement.ExportProperties{
	// 					Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 					Definition: &armcostmanagement.ExportDefinition{
	// 						Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 						DataSet: &armcostmanagement.ExportDataset{
	// 							Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 								Columns: []*string{
	// 									to.Ptr("Date"),
	// 									to.Ptr("MeterId"),
	// 									to.Ptr("ResourceId"),
	// 									to.Ptr("ResourceLocation"),
	// 									to.Ptr("Quantity")},
	// 								},
	// 								Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 							},
	// 							Timeframe: to.Ptr(armcostmanagement.TimeframeTypeWeekToDate),
	// 						},
	// 						DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 							Destination: &armcostmanagement.ExportDeliveryDestination{
	// 								Container: to.Ptr("exports"),
	// 								ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 								RootFolderPath: to.Ptr("ad-hoc"),
	// 							},
	// 						},
	// 						Schedule: &armcostmanagement.ExportSchedule{
	// 							Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly),
	// 							RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{
	// 								From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 								To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 							},
	// 							Status: to.Ptr(armcostmanagement.StatusTypeActive),
	// 						},
	// 					},
	// 			}},
	// 		}
}
Output:

Example (ExportsGetByResourceGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportsGetByResourceGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExportsClient().List(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", &armcostmanagement.ExportsClientListOptions{Expand: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.ExportListResult = armcostmanagement.ExportListResult{
	// 	Value: []*armcostmanagement.Export{
	// 		{
	// 			Name: to.Ptr("TestExport1"),
	// 			Type: to.Ptr("Microsoft.CostManagement/exports"),
	// 			ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/exports/TestExport1"),
	// 			Properties: &armcostmanagement.ExportProperties{
	// 				Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 				Definition: &armcostmanagement.ExportDefinition{
	// 					Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 					DataSet: &armcostmanagement.ExportDataset{
	// 						Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 							Columns: []*string{
	// 								to.Ptr("Date"),
	// 								to.Ptr("MeterId"),
	// 								to.Ptr("ResourceId"),
	// 								to.Ptr("ResourceLocation"),
	// 								to.Ptr("Quantity")},
	// 							},
	// 							Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 						},
	// 						TimePeriod: &armcostmanagement.ExportTimePeriod{
	// 							From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 							To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 						},
	// 						Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom),
	// 					},
	// 					DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 						Destination: &armcostmanagement.ExportDeliveryDestination{
	// 							Container: to.Ptr("exports"),
	// 							ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 							RootFolderPath: to.Ptr("ad-hoc"),
	// 						},
	// 					},
	// 				},
	// 			},
	// 			{
	// 				Name: to.Ptr("TestExport2"),
	// 				Type: to.Ptr("Microsoft.CostManagement/exports"),
	// 				ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/exports/TestExport2"),
	// 				Properties: &armcostmanagement.ExportProperties{
	// 					Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 					Definition: &armcostmanagement.ExportDefinition{
	// 						Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 						DataSet: &armcostmanagement.ExportDataset{
	// 							Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 								Columns: []*string{
	// 									to.Ptr("Date"),
	// 									to.Ptr("MeterId"),
	// 									to.Ptr("ResourceId"),
	// 									to.Ptr("ResourceLocation"),
	// 									to.Ptr("Quantity")},
	// 								},
	// 								Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 							},
	// 							Timeframe: to.Ptr(armcostmanagement.TimeframeTypeWeekToDate),
	// 						},
	// 						DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 							Destination: &armcostmanagement.ExportDeliveryDestination{
	// 								Container: to.Ptr("exports"),
	// 								ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 								RootFolderPath: to.Ptr("ad-hoc"),
	// 							},
	// 						},
	// 						Schedule: &armcostmanagement.ExportSchedule{
	// 							Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly),
	// 							RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{
	// 								From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 								To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 							},
	// 							Status: to.Ptr(armcostmanagement.StatusTypeActive),
	// 						},
	// 					},
	// 			}},
	// 		}
}
Output:

Example (ExportsGetBySubscription)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportsGetBySubscription.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExportsClient().List(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", &armcostmanagement.ExportsClientListOptions{Expand: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.ExportListResult = armcostmanagement.ExportListResult{
	// 	Value: []*armcostmanagement.Export{
	// 		{
	// 			Name: to.Ptr("TestExport1"),
	// 			Type: to.Ptr("Microsoft.CostManagement/exports"),
	// 			ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/exports/TestExport1"),
	// 			Properties: &armcostmanagement.ExportProperties{
	// 				Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 				Definition: &armcostmanagement.ExportDefinition{
	// 					Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 					DataSet: &armcostmanagement.ExportDataset{
	// 						Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 							Columns: []*string{
	// 								to.Ptr("Date"),
	// 								to.Ptr("MeterId"),
	// 								to.Ptr("ResourceId"),
	// 								to.Ptr("ResourceLocation"),
	// 								to.Ptr("Quantity")},
	// 							},
	// 							Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 						},
	// 						TimePeriod: &armcostmanagement.ExportTimePeriod{
	// 							From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 							To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 						},
	// 						Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom),
	// 					},
	// 					DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 						Destination: &armcostmanagement.ExportDeliveryDestination{
	// 							Container: to.Ptr("exports"),
	// 							ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 							RootFolderPath: to.Ptr("ad-hoc"),
	// 						},
	// 					},
	// 				},
	// 			},
	// 			{
	// 				Name: to.Ptr("TestExport2"),
	// 				Type: to.Ptr("Microsoft.CostManagement/exports"),
	// 				ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/exports/TestExport2"),
	// 				Properties: &armcostmanagement.ExportProperties{
	// 					Format: to.Ptr(armcostmanagement.FormatTypeCSV),
	// 					Definition: &armcostmanagement.ExportDefinition{
	// 						Type: to.Ptr(armcostmanagement.ExportTypeActualCost),
	// 						DataSet: &armcostmanagement.ExportDataset{
	// 							Configuration: &armcostmanagement.ExportDatasetConfiguration{
	// 								Columns: []*string{
	// 									to.Ptr("Date"),
	// 									to.Ptr("MeterId"),
	// 									to.Ptr("ResourceId"),
	// 									to.Ptr("ResourceLocation"),
	// 									to.Ptr("Quantity")},
	// 								},
	// 								Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
	// 							},
	// 							Timeframe: to.Ptr(armcostmanagement.TimeframeTypeWeekToDate),
	// 						},
	// 						DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{
	// 							Destination: &armcostmanagement.ExportDeliveryDestination{
	// 								Container: to.Ptr("exports"),
	// 								ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"),
	// 								RootFolderPath: to.Ptr("ad-hoc"),
	// 							},
	// 						},
	// 						Schedule: &armcostmanagement.ExportSchedule{
	// 							Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly),
	// 							RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{
	// 								From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()),
	// 								To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()),
	// 							},
	// 							Status: to.Ptr(armcostmanagement.StatusTypeActive),
	// 						},
	// 					},
	// 			}},
	// 		}
}
Output:

type ExportsClientCreateOrUpdateOptions added in v0.2.0

type ExportsClientCreateOrUpdateOptions struct {
}

ExportsClientCreateOrUpdateOptions contains the optional parameters for the ExportsClient.CreateOrUpdate method.

type ExportsClientCreateOrUpdateResponse added in v0.2.0

type ExportsClientCreateOrUpdateResponse struct {
	Export
}

ExportsClientCreateOrUpdateResponse contains the response from method ExportsClient.CreateOrUpdate.

type ExportsClientDeleteOptions added in v0.2.0

type ExportsClientDeleteOptions struct {
}

ExportsClientDeleteOptions contains the optional parameters for the ExportsClient.Delete method.

type ExportsClientDeleteResponse added in v0.2.0

type ExportsClientDeleteResponse struct {
}

ExportsClientDeleteResponse contains the response from method ExportsClient.Delete.

type ExportsClientExecuteOptions added in v0.2.0

type ExportsClientExecuteOptions struct {
}

ExportsClientExecuteOptions contains the optional parameters for the ExportsClient.Execute method.

type ExportsClientExecuteResponse added in v0.2.0

type ExportsClientExecuteResponse struct {
}

ExportsClientExecuteResponse contains the response from method ExportsClient.Execute.

type ExportsClientGetExecutionHistoryOptions added in v0.2.0

type ExportsClientGetExecutionHistoryOptions struct {
}

ExportsClientGetExecutionHistoryOptions contains the optional parameters for the ExportsClient.GetExecutionHistory method.

type ExportsClientGetExecutionHistoryResponse added in v0.2.0

type ExportsClientGetExecutionHistoryResponse struct {
	ExportExecutionListResult
}

ExportsClientGetExecutionHistoryResponse contains the response from method ExportsClient.GetExecutionHistory.

type ExportsClientGetOptions added in v0.2.0

type ExportsClientGetOptions struct {
	// May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information
	// for the last 10 executions of the export.
	Expand *string
}

ExportsClientGetOptions contains the optional parameters for the ExportsClient.Get method.

type ExportsClientGetResponse added in v0.2.0

type ExportsClientGetResponse struct {
	Export
}

ExportsClientGetResponse contains the response from method ExportsClient.Get.

type ExportsClientListOptions added in v0.2.0

type ExportsClientListOptions struct {
	// May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information
	// for the last execution of each export.
	Expand *string
}

ExportsClientListOptions contains the optional parameters for the ExportsClient.List method.

type ExportsClientListResponse added in v0.2.0

type ExportsClientListResponse struct {
	ExportListResult
}

ExportsClientListResponse contains the response from method ExportsClient.List.

type ExternalCloudProviderType

type ExternalCloudProviderType string
const (
	ExternalCloudProviderTypeExternalBillingAccounts ExternalCloudProviderType = "externalBillingAccounts"
	ExternalCloudProviderTypeExternalSubscriptions   ExternalCloudProviderType = "externalSubscriptions"
)

func PossibleExternalCloudProviderTypeValues

func PossibleExternalCloudProviderTypeValues() []ExternalCloudProviderType

PossibleExternalCloudProviderTypeValues returns the possible values for the ExternalCloudProviderType const type.

type ForecastClient

type ForecastClient struct {
	// contains filtered or unexported fields
}

ForecastClient contains the methods for the Forecast group. Don't use this type directly, use NewForecastClient() instead.

func NewForecastClient

func NewForecastClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ForecastClient, error)

NewForecastClient creates a new instance of ForecastClient with the specified values.

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*ForecastClient) ExternalCloudProviderUsage

func (client *ForecastClient) ExternalCloudProviderUsage(ctx context.Context, externalCloudProviderType ExternalCloudProviderType, externalCloudProviderID string, parameters ForecastDefinition, options *ForecastClientExternalCloudProviderUsageOptions) (ForecastClientExternalCloudProviderUsageResponse, error)

ExternalCloudProviderUsage - Lists the forecast charges for external cloud provider type defined. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • externalCloudProviderType - The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account.
  • externalCloudProviderID - This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations.
  • parameters - Parameters supplied to the CreateOrUpdate Forecast Config operation.
  • options - ForecastClientExternalCloudProviderUsageOptions contains the optional parameters for the ForecastClient.ExternalCloudProviderUsage method.
Example (ExternalBillingAccountForecast)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalBillingAccountForecast.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewForecastClient().ExternalCloudProviderUsage(ctx, armcostmanagement.ExternalCloudProviderTypeExternalBillingAccounts, "100", armcostmanagement.ForecastDefinition{
		Type: to.Ptr(armcostmanagement.ForecastTypeUsage),
		Dataset: &armcostmanagement.ForecastDataset{
			Filter: &armcostmanagement.QueryFilter{
				And: []*armcostmanagement.QueryFilter{
					{
						Or: []*armcostmanagement.QueryFilter{
							{
								Dimensions: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("ResourceLocation"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("East US"),
										to.Ptr("West Europe")},
								},
							},
							{
								Tags: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("Environment"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("UAT"),
										to.Ptr("Prod")},
								},
							}},
					},
					{
						Dimensions: &armcostmanagement.QueryComparisonExpression{
							Name:     to.Ptr("ResourceGroup"),
							Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
							Values: []*string{
								to.Ptr("API")},
						},
					}},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
		},
		Timeframe: to.Ptr(armcostmanagement.ForecastTimeframeTypeMonthToDate),
	}, &armcostmanagement.ForecastClientExternalCloudProviderUsageOptions{Filter: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("6dc7b06a-d90a-4df5-b655-ce6cf1c0814d"),
	// 	Type: to.Ptr("Microsoft.CostManagement/query"),
	// 	ID: to.Ptr("providers/Microsoft.CostManagement/externalBillingAccounts/100/query/6dc7b06a-d90a-4df5-b655-ce6cf1c0814d"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("CostStatus"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(0),
	// 				"Forecast",
	// 				"USD"},
	// 				[]any{
	// 					float64(30.2572751438),
	// 					"Forecast",
	// 					"USD"},
	// 					[]any{
	// 						float64(0.07675760200000002),
	// 						"Forecast",
	// 						"USD"},
	// 						[]any{
	// 							float64(50.43096419040001),
	// 							"Forecast",
	// 							"USD"}},
	// 						},
	// 					}
}
Output:

Example (ExternalSubscriptionForecast)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalSubscriptionForecast.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewForecastClient().ExternalCloudProviderUsage(ctx, armcostmanagement.ExternalCloudProviderTypeExternalSubscriptions, "100", armcostmanagement.ForecastDefinition{
		Type: to.Ptr(armcostmanagement.ForecastTypeUsage),
		Dataset: &armcostmanagement.ForecastDataset{
			Filter: &armcostmanagement.QueryFilter{
				And: []*armcostmanagement.QueryFilter{
					{
						Or: []*armcostmanagement.QueryFilter{
							{
								Dimensions: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("ResourceLocation"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("East US"),
										to.Ptr("West Europe")},
								},
							},
							{
								Tags: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("Environment"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("UAT"),
										to.Ptr("Prod")},
								},
							}},
					},
					{
						Dimensions: &armcostmanagement.QueryComparisonExpression{
							Name:     to.Ptr("ResourceGroup"),
							Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
							Values: []*string{
								to.Ptr("API")},
						},
					}},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
		},
		Timeframe: to.Ptr(armcostmanagement.ForecastTimeframeTypeMonthToDate),
	}, &armcostmanagement.ForecastClientExternalCloudProviderUsageOptions{Filter: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("d99477af-7510-40ee-aca2-e59bdca0d10d"),
	// 	Type: to.Ptr("Microsoft.CostManagement/query"),
	// 	ID: to.Ptr("providers/Microsoft.CostManagement/externalSubscriptions/100/query/d99477af-7510-40ee-aca2-e59bdca0d10d"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("UsageDate"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("CostStatus"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 		},
	// 	},
	// }
}
Output:

func (*ForecastClient) Usage

Usage - Lists the forecast charges for scope defined. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • scope - The scope associated with forecast operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.
  • parameters - Parameters supplied to the CreateOrUpdate Forecast Config operation.
  • options - ForecastClientUsageOptions contains the optional parameters for the ForecastClient.Usage method.
Example (BillingAccountForecast)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingAccountForecast.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewForecastClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789", armcostmanagement.ForecastDefinition{
		Type: to.Ptr(armcostmanagement.ForecastTypeUsage),
		Dataset: &armcostmanagement.ForecastDataset{
			Filter: &armcostmanagement.QueryFilter{
				And: []*armcostmanagement.QueryFilter{
					{
						Or: []*armcostmanagement.QueryFilter{
							{
								Dimensions: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("ResourceLocation"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("East US"),
										to.Ptr("West Europe")},
								},
							},
							{
								Tags: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("Environment"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("UAT"),
										to.Ptr("Prod")},
								},
							}},
					},
					{
						Dimensions: &armcostmanagement.QueryComparisonExpression{
							Name:     to.Ptr("ResourceGroup"),
							Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
							Values: []*string{
								to.Ptr("API")},
						},
					}},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
		},
		IncludeActualCost:       to.Ptr(false),
		IncludeFreshPartialCost: to.Ptr(false),
		Timeframe:               to.Ptr(armcostmanagement.ForecastTimeframeTypeMonthToDate),
	}, &armcostmanagement.ForecastClientUsageOptions{Filter: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/providers/Microsoft.CostManagement/query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("UsageDate"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("CostStatus"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(2.10333307059661),
	// 				float64(20180331),
	// 				"Forecast",
	// 				"USD"},
	// 				[]any{
	// 					float64(218.68795741935486),
	// 					float64(20180331),
	// 					"Forecast",
	// 					"USD"},
	// 					[]any{
	// 						float64(0.14384913581657052),
	// 						float64(20180401),
	// 						"Forecast",
	// 						"USD"},
	// 						[]any{
	// 							float64(0.009865586851323632),
	// 							float64(20180429),
	// 							"Forecast",
	// 							"USD"}},
	// 						},
	// 					}
}
Output:

Example (BillingProfileForecast)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingProfileForecast.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewForecastClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", armcostmanagement.ForecastDefinition{
		Type: to.Ptr(armcostmanagement.ForecastTypeUsage),
		Dataset: &armcostmanagement.ForecastDataset{
			Filter: &armcostmanagement.QueryFilter{
				And: []*armcostmanagement.QueryFilter{
					{
						Or: []*armcostmanagement.QueryFilter{
							{
								Dimensions: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("ResourceLocation"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("East US"),
										to.Ptr("West Europe")},
								},
							},
							{
								Tags: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("Environment"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("UAT"),
										to.Ptr("Prod")},
								},
							}},
					},
					{
						Dimensions: &armcostmanagement.QueryComparisonExpression{
							Name:     to.Ptr("ResourceGroup"),
							Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
							Values: []*string{
								to.Ptr("API")},
						},
					}},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
		},
		IncludeActualCost:       to.Ptr(false),
		IncludeFreshPartialCost: to.Ptr(false),
		Timeframe:               to.Ptr(armcostmanagement.ForecastTimeframeTypeMonthToDate),
	}, &armcostmanagement.ForecastClientUsageOptions{Filter: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("UsageDate"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("CostStatus"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(2.10333307059661),
	// 				float64(20180331),
	// 				"Forecast",
	// 				"USD"},
	// 				[]any{
	// 					float64(218.68795741935486),
	// 					float64(20180331),
	// 					"Forecast",
	// 					"USD"},
	// 					[]any{
	// 						float64(0.14384913581657052),
	// 						float64(20180401),
	// 						"Forecast",
	// 						"USD"},
	// 						[]any{
	// 							float64(0.009865586851323632),
	// 							float64(20180429),
	// 							"Forecast",
	// 							"USD"}},
	// 						},
	// 					}
}
Output:

Example (DepartmentForecast)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/DepartmentForecast.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewForecastClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123", armcostmanagement.ForecastDefinition{
		Type: to.Ptr(armcostmanagement.ForecastTypeUsage),
		Dataset: &armcostmanagement.ForecastDataset{
			Filter: &armcostmanagement.QueryFilter{
				And: []*armcostmanagement.QueryFilter{
					{
						Or: []*armcostmanagement.QueryFilter{
							{
								Dimensions: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("ResourceLocation"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("East US"),
										to.Ptr("West Europe")},
								},
							},
							{
								Tags: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("Environment"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("UAT"),
										to.Ptr("Prod")},
								},
							}},
					},
					{
						Dimensions: &armcostmanagement.QueryComparisonExpression{
							Name:     to.Ptr("ResourceGroup"),
							Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
							Values: []*string{
								to.Ptr("API")},
						},
					}},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
		},
		IncludeActualCost:       to.Ptr(false),
		IncludeFreshPartialCost: to.Ptr(false),
		Timeframe:               to.Ptr(armcostmanagement.ForecastTimeframeTypeMonthToDate),
	}, &armcostmanagement.ForecastClientUsageOptions{Filter: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123/providers/Microsoft.CostManagement/query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("UsageDate"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("CostStatus"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(2.10333307059661),
	// 				float64(20180331),
	// 				"Forecast",
	// 				"USD"},
	// 				[]any{
	// 					float64(218.68795741935486),
	// 					float64(20180331),
	// 					"Forecast",
	// 					"USD"},
	// 					[]any{
	// 						float64(0.14384913581657052),
	// 						float64(20180401),
	// 						"Forecast",
	// 						"USD"},
	// 						[]any{
	// 							float64(0.009865586851323632),
	// 							float64(20180429),
	// 							"Forecast",
	// 							"USD"}},
	// 						},
	// 					}
}
Output:

Example (EnrollmentAccountForecast)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/EnrollmentAccountForecast.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewForecastClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456", armcostmanagement.ForecastDefinition{
		Type: to.Ptr(armcostmanagement.ForecastTypeUsage),
		Dataset: &armcostmanagement.ForecastDataset{
			Filter: &armcostmanagement.QueryFilter{
				And: []*armcostmanagement.QueryFilter{
					{
						Or: []*armcostmanagement.QueryFilter{
							{
								Dimensions: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("ResourceLocation"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("East US"),
										to.Ptr("West Europe")},
								},
							},
							{
								Tags: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("Environment"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("UAT"),
										to.Ptr("Prod")},
								},
							}},
					},
					{
						Dimensions: &armcostmanagement.QueryComparisonExpression{
							Name:     to.Ptr("ResourceGroup"),
							Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
							Values: []*string{
								to.Ptr("API")},
						},
					}},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
		},
		IncludeActualCost:       to.Ptr(false),
		IncludeFreshPartialCost: to.Ptr(false),
		Timeframe:               to.Ptr(armcostmanagement.ForecastTimeframeTypeMonthToDate),
	}, &armcostmanagement.ForecastClientUsageOptions{Filter: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456/providers/Microsoft.CostManagement/query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("UsageDate"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("CostStatus"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(2.10333307059661),
	// 				float64(20180331),
	// 				"Forecast",
	// 				"USD"},
	// 				[]any{
	// 					float64(218.68795741935486),
	// 					float64(20180331),
	// 					"Forecast",
	// 					"USD"},
	// 					[]any{
	// 						float64(0.14384913581657052),
	// 						float64(20180401),
	// 						"Forecast",
	// 						"USD"},
	// 						[]any{
	// 							float64(0.009865586851323632),
	// 							float64(20180429),
	// 							"Forecast",
	// 							"USD"}},
	// 						},
	// 					}
}
Output:

Example (InvoiceSectionForecast)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/InvoiceSectionForecast.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewForecastClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", armcostmanagement.ForecastDefinition{
		Type: to.Ptr(armcostmanagement.ForecastTypeUsage),
		Dataset: &armcostmanagement.ForecastDataset{
			Filter: &armcostmanagement.QueryFilter{
				And: []*armcostmanagement.QueryFilter{
					{
						Or: []*armcostmanagement.QueryFilter{
							{
								Dimensions: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("ResourceLocation"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("East US"),
										to.Ptr("West Europe")},
								},
							},
							{
								Tags: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("Environment"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("UAT"),
										to.Ptr("Prod")},
								},
							}},
					},
					{
						Dimensions: &armcostmanagement.QueryComparisonExpression{
							Name:     to.Ptr("ResourceGroup"),
							Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
							Values: []*string{
								to.Ptr("API")},
						},
					}},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
		},
		IncludeActualCost:       to.Ptr(false),
		IncludeFreshPartialCost: to.Ptr(false),
		Timeframe:               to.Ptr(armcostmanagement.ForecastTimeframeTypeMonthToDate),
	}, &armcostmanagement.ForecastClientUsageOptions{Filter: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/Microsoft.CostManagement/query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("UsageDate"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("CostStatus"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(2.10333307059661),
	// 				float64(20180331),
	// 				"Forecast",
	// 				"USD"},
	// 				[]any{
	// 					float64(218.68795741935486),
	// 					float64(20180331),
	// 					"Forecast",
	// 					"USD"},
	// 					[]any{
	// 						float64(0.14384913581657052),
	// 						float64(20180401),
	// 						"Forecast",
	// 						"USD"},
	// 						[]any{
	// 							float64(0.009865586851323632),
	// 							float64(20180429),
	// 							"Forecast",
	// 							"USD"}},
	// 						},
	// 					}
}
Output:

Example (ResourceGroupForecast)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ResourceGroupForecast.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewForecastClient().Usage(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", armcostmanagement.ForecastDefinition{
		Type: to.Ptr(armcostmanagement.ForecastTypeUsage),
		Dataset: &armcostmanagement.ForecastDataset{
			Filter: &armcostmanagement.QueryFilter{
				And: []*armcostmanagement.QueryFilter{
					{
						Or: []*armcostmanagement.QueryFilter{
							{
								Dimensions: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("ResourceLocation"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("East US"),
										to.Ptr("West Europe")},
								},
							},
							{
								Tags: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("Environment"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("UAT"),
										to.Ptr("Prod")},
								},
							}},
					},
					{
						Dimensions: &armcostmanagement.QueryComparisonExpression{
							Name:     to.Ptr("ResourceGroup"),
							Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
							Values: []*string{
								to.Ptr("API")},
						},
					}},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
		},
		IncludeActualCost:       to.Ptr(false),
		IncludeFreshPartialCost: to.Ptr(false),
		Timeframe:               to.Ptr(armcostmanagement.ForecastTimeframeTypeMonthToDate),
	}, &armcostmanagement.ForecastClientUsageOptions{Filter: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("55312978-ba1b-415c-9304-cfd9c43c0481"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer/providers/Microsoft.CostManagement/query/00000000-0000-0000-0000-000000000000"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("UsageDate"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("CostStatus"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(2.10333307059661),
	// 				float64(20180331),
	// 				"Forecast",
	// 				"USD"}},
	// 			},
	// 		}
}
Output:

Example (SubscriptionForecast)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/SubscriptionForecast.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewForecastClient().Usage(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", armcostmanagement.ForecastDefinition{
		Type: to.Ptr(armcostmanagement.ForecastTypeUsage),
		Dataset: &armcostmanagement.ForecastDataset{
			Filter: &armcostmanagement.QueryFilter{
				And: []*armcostmanagement.QueryFilter{
					{
						Or: []*armcostmanagement.QueryFilter{
							{
								Dimensions: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("ResourceLocation"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("East US"),
										to.Ptr("West Europe")},
								},
							},
							{
								Tags: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("Environment"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("UAT"),
										to.Ptr("Prod")},
								},
							}},
					},
					{
						Dimensions: &armcostmanagement.QueryComparisonExpression{
							Name:     to.Ptr("ResourceGroup"),
							Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
							Values: []*string{
								to.Ptr("API")},
						},
					}},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
		},
		IncludeActualCost:       to.Ptr(false),
		IncludeFreshPartialCost: to.Ptr(false),
		Timeframe:               to.Ptr(armcostmanagement.ForecastTimeframeTypeMonthToDate),
	}, &armcostmanagement.ForecastClientUsageOptions{Filter: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("55312978-ba1b-415c-9304-cfd9c43c0481"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/query/00000000-0000-0000-0000-000000000000"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("UsageDate"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("CostStatus"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(2.10333307059661),
	// 				float64(20180331),
	// 				"Forecast",
	// 				"USD"},
	// 				[]any{
	// 					float64(218.68795741935486),
	// 					float64(20180331),
	// 					"Forecast",
	// 					"USD"},
	// 					[]any{
	// 						float64(0.14384913581657052),
	// 						float64(20180401),
	// 						"Forecast",
	// 						"USD"},
	// 						[]any{
	// 							float64(0.009865586851323632),
	// 							float64(20180429),
	// 							"Forecast",
	// 							"USD"}},
	// 						},
	// 					}
}
Output:

type ForecastClientExternalCloudProviderUsageOptions added in v0.2.0

type ForecastClientExternalCloudProviderUsageOptions struct {
	// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter
	// supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently
	// support 'ne', 'or', or 'not'.
	Filter *string
}

ForecastClientExternalCloudProviderUsageOptions contains the optional parameters for the ForecastClient.ExternalCloudProviderUsage method.

type ForecastClientExternalCloudProviderUsageResponse added in v0.2.0

type ForecastClientExternalCloudProviderUsageResponse struct {
	QueryResult
}

ForecastClientExternalCloudProviderUsageResponse contains the response from method ForecastClient.ExternalCloudProviderUsage.

type ForecastClientUsageOptions added in v0.2.0

type ForecastClientUsageOptions struct {
	// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter
	// supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently
	// support 'ne', 'or', or 'not'.
	Filter *string
}

ForecastClientUsageOptions contains the optional parameters for the ForecastClient.Usage method.

type ForecastClientUsageResponse added in v0.2.0

type ForecastClientUsageResponse struct {
	QueryResult
}

ForecastClientUsageResponse contains the response from method ForecastClient.Usage.

type ForecastDataset

type ForecastDataset struct {
	// Dictionary of aggregation expression to use in the forecast. The key of each item in the dictionary is the alias for the
	// aggregated column. forecast can have up to 2 aggregation clauses.
	Aggregation map[string]*QueryAggregation

	// Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping
	// are provided.
	Configuration *QueryDatasetConfiguration

	// Has filter expression to use in the forecast.
	Filter *QueryFilter

	// The granularity of rows in the forecast.
	Granularity *GranularityType
}

ForecastDataset - The definition of data present in the forecast.

func (ForecastDataset) MarshalJSON

func (f ForecastDataset) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ForecastDataset.

func (*ForecastDataset) UnmarshalJSON added in v1.1.0

func (f *ForecastDataset) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ForecastDataset.

type ForecastDefinition

type ForecastDefinition struct {
	// REQUIRED; Has definition for data in this forecast.
	Dataset *ForecastDataset

	// REQUIRED; The time frame for pulling data for the forecast. If custom, then a specific time period must be provided.
	Timeframe *ForecastTimeframeType

	// REQUIRED; The type of the forecast.
	Type *ForecastType

	// a boolean determining if actualCost will be included
	IncludeActualCost *bool

	// a boolean determining if FreshPartialCost will be included
	IncludeFreshPartialCost *bool

	// Has time period for pulling data for the forecast.
	TimePeriod *QueryTimePeriod
}

ForecastDefinition - The definition of a forecast.

func (ForecastDefinition) MarshalJSON added in v1.1.0

func (f ForecastDefinition) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ForecastDefinition.

func (*ForecastDefinition) UnmarshalJSON added in v1.1.0

func (f *ForecastDefinition) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ForecastDefinition.

type ForecastTimeframeType

type ForecastTimeframeType string

ForecastTimeframeType - The time frame for pulling data for the forecast. If custom, then a specific time period must be provided.

const (
	ForecastTimeframeTypeBillingMonthToDate  ForecastTimeframeType = "BillingMonthToDate"
	ForecastTimeframeTypeCustom              ForecastTimeframeType = "Custom"
	ForecastTimeframeTypeMonthToDate         ForecastTimeframeType = "MonthToDate"
	ForecastTimeframeTypeTheLastBillingMonth ForecastTimeframeType = "TheLastBillingMonth"
	ForecastTimeframeTypeTheLastMonth        ForecastTimeframeType = "TheLastMonth"
	ForecastTimeframeTypeWeekToDate          ForecastTimeframeType = "WeekToDate"
)

func PossibleForecastTimeframeTypeValues

func PossibleForecastTimeframeTypeValues() []ForecastTimeframeType

PossibleForecastTimeframeTypeValues returns the possible values for the ForecastTimeframeType const type.

type ForecastType

type ForecastType string

ForecastType - The type of the forecast.

const (
	ForecastTypeActualCost    ForecastType = "ActualCost"
	ForecastTypeAmortizedCost ForecastType = "AmortizedCost"
	ForecastTypeUsage         ForecastType = "Usage"
)

func PossibleForecastTypeValues

func PossibleForecastTypeValues() []ForecastType

PossibleForecastTypeValues returns the possible values for the ForecastType const type.

type FormatType

type FormatType string

FormatType - The format of the export being delivered. Currently only 'Csv' is supported.

const (
	FormatTypeCSV FormatType = "Csv"
)

func PossibleFormatTypeValues

func PossibleFormatTypeValues() []FormatType

PossibleFormatTypeValues returns the possible values for the FormatType const type.

type FunctionType

type FunctionType string

FunctionType - The name of the aggregation function to use.

const (
	FunctionTypeSum FunctionType = "Sum"
)

func PossibleFunctionTypeValues

func PossibleFunctionTypeValues() []FunctionType

PossibleFunctionTypeValues returns the possible values for the FunctionType const type.

type GenerateDetailedCostReportClient

type GenerateDetailedCostReportClient struct {
	// contains filtered or unexported fields
}

GenerateDetailedCostReportClient contains the methods for the GenerateDetailedCostReport group. Don't use this type directly, use NewGenerateDetailedCostReportClient() instead.

func NewGenerateDetailedCostReportClient

func NewGenerateDetailedCostReportClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GenerateDetailedCostReportClient, error)

NewGenerateDetailedCostReportClient creates a new instance of GenerateDetailedCostReportClient with the specified values.

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*GenerateDetailedCostReportClient) BeginCreateOperation

BeginCreateOperation - Generates the detailed cost report for provided date range, billing period(Only enterprise customers) or Invoice Id asynchronously at a certain scope. Call returns a 202 with header Azure-Consumption-AsyncOperation providing a link to the operation created. A call on the operation will provide the status and if the operation is completed the blob file where generated detailed cost report is being stored. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • scope - The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope. Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for billingAccount scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.
  • parameters - Parameters supplied to the Create detailed cost report operation.
  • options - GenerateDetailedCostReportClientBeginCreateOperationOptions contains the optional parameters for the GenerateDetailedCostReportClient.BeginCreateOperation method.
Example (GenerateDetailedCostReportByBillingAccountLegacyAndBillingPeriod)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/GenerateDetailedCostReportByBillingAccountLegacyAndBillingPeriod.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGenerateDetailedCostReportClient().BeginCreateOperation(ctx, "providers/Microsoft.Billing/billingAccounts/12345", armcostmanagement.GenerateDetailedCostReportDefinition{
		BillingPeriod: to.Ptr("202008"),
		Metric:        to.Ptr(armcostmanagement.GenerateDetailedCostReportMetricTypeActualCost),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.GenerateDetailedCostReportOperationResult = armcostmanagement.GenerateDetailedCostReportOperationResult{
	// 	Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	Type: to.Ptr("Microsoft.Consumption/operationResult"),
	// 	ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/operationResults/00000000-0000-0000-0000-000000000000"),
	// 	Properties: &armcostmanagement.DownloadURL{
	// 		DownloadURL: to.Ptr("https://ccmreportstorageeastus.blob.core.windows.net/armreports/20201207/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd"),
	// 		ValidTill: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-08T05:55:59.4394737Z"); return t}()),
	// 	},
	// }
}
Output:

Example (GenerateDetailedCostReportByBillingProfileAndInvoiceId)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/GenerateDetailedCostReportByBillingProfileAndInvoiceId.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGenerateDetailedCostReportClient().BeginCreateOperation(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", armcostmanagement.GenerateDetailedCostReportDefinition{
		InvoiceID: to.Ptr("M1234567"),
		Metric:    to.Ptr(armcostmanagement.GenerateDetailedCostReportMetricTypeActualCost),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.GenerateDetailedCostReportOperationResult = armcostmanagement.GenerateDetailedCostReportOperationResult{
	// 	Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	Type: to.Ptr("Microsoft.Consumption/operationResult"),
	// 	ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/operationResults/00000000-0000-0000-0000-000000000000"),
	// 	Properties: &armcostmanagement.DownloadURL{
	// 		DownloadURL: to.Ptr("https://ccmreportstorageeastus.blob.core.windows.net/armreports/20201207/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd"),
	// 		ValidTill: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-08T05:55:59.4394737Z"); return t}()),
	// 	},
	// }
}
Output:

Example (GenerateDetailedCostReportByBillingProfileAndInvoiceIdAndCustomerId)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/GenerateDetailedCostReportByBillingProfileAndInvoiceIdAndCustomerId.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGenerateDetailedCostReportClient().BeginCreateOperation(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", armcostmanagement.GenerateDetailedCostReportDefinition{
		CustomerID: to.Ptr("456789"),
		InvoiceID:  to.Ptr("M1234567"),
		Metric:     to.Ptr(armcostmanagement.GenerateDetailedCostReportMetricTypeActualCost),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.GenerateDetailedCostReportOperationResult = armcostmanagement.GenerateDetailedCostReportOperationResult{
	// 	Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	Type: to.Ptr("Microsoft.Consumption/operationResult"),
	// 	ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/operationResults/00000000-0000-0000-0000-000000000000"),
	// 	Properties: &armcostmanagement.DownloadURL{
	// 		DownloadURL: to.Ptr("https://ccmreportstorageeastus.blob.core.windows.net/armreports/20201207/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd"),
	// 		ValidTill: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-08T05:55:59.4394737Z"); return t}()),
	// 	},
	// }
}
Output:

Example (GenerateDetailedCostReportByCustomerAndTimePeriod)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/GenerateDetailedCostReportByCustomerAndTimePeriod.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGenerateDetailedCostReportClient().BeginCreateOperation(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579", armcostmanagement.GenerateDetailedCostReportDefinition{
		Metric: to.Ptr(armcostmanagement.GenerateDetailedCostReportMetricTypeActualCost),
		TimePeriod: &armcostmanagement.GenerateDetailedCostReportTimePeriod{
			End:   to.Ptr("2020-03-15"),
			Start: to.Ptr("2020-03-01"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.GenerateDetailedCostReportOperationResult = armcostmanagement.GenerateDetailedCostReportOperationResult{
	// 	Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	Type: to.Ptr("Microsoft.Consumption/operationResult"),
	// 	ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/operationResults/00000000-0000-0000-0000-000000000000"),
	// 	Properties: &armcostmanagement.DownloadURL{
	// 		DownloadURL: to.Ptr("https://ccmreportstorageeastus.blob.core.windows.net/armreports/20201207/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd"),
	// 		ValidTill: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-08T05:55:59.4394737Z"); return t}()),
	// 	},
	// }
}
Output:

Example (GenerateDetailedCostReportBySubscriptionAndTimePeriod)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/GenerateDetailedCostReportBySubscriptionAndTimePeriod.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGenerateDetailedCostReportClient().BeginCreateOperation(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", armcostmanagement.GenerateDetailedCostReportDefinition{
		Metric: to.Ptr(armcostmanagement.GenerateDetailedCostReportMetricTypeActualCost),
		TimePeriod: &armcostmanagement.GenerateDetailedCostReportTimePeriod{
			End:   to.Ptr("2020-03-15"),
			Start: to.Ptr("2020-03-01"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.GenerateDetailedCostReportOperationResult = armcostmanagement.GenerateDetailedCostReportOperationResult{
	// 	Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	Type: to.Ptr("Microsoft.Consumption/operationResult"),
	// 	ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/operationResults/00000000-0000-0000-0000-000000000000"),
	// 	Properties: &armcostmanagement.DownloadURL{
	// 		DownloadURL: to.Ptr("https://ccmreportstorageeastus.blob.core.windows.net/armreports/20201207/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd"),
	// 		ValidTill: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-08T05:55:59.4394737Z"); return t}()),
	// 	},
	// }
}
Output:

type GenerateDetailedCostReportClientBeginCreateOperationOptions added in v0.2.0

type GenerateDetailedCostReportClientBeginCreateOperationOptions struct {
	// Resumes the LRO from the provided token.
	ResumeToken string
}

GenerateDetailedCostReportClientBeginCreateOperationOptions contains the optional parameters for the GenerateDetailedCostReportClient.BeginCreateOperation method.

type GenerateDetailedCostReportClientCreateOperationResponse added in v0.2.0

type GenerateDetailedCostReportClientCreateOperationResponse struct {
	GenerateDetailedCostReportOperationResult
}

GenerateDetailedCostReportClientCreateOperationResponse contains the response from method GenerateDetailedCostReportClient.BeginCreateOperation.

type GenerateDetailedCostReportDefinition

type GenerateDetailedCostReportDefinition struct {
	// Billing Period in YearMonth(e.g. 202008) format. Only for legacy enterprise customers can use this. Can only have one of
	// either timePeriod or invoiceId or billingPeriod parameters. If none provided
	// current month cost is provided.
	BillingPeriod *string

	// Customer Id for Modern (Invoice Id and billing profile is also required for this).
	CustomerID *string

	// Invoice Id for PayAsYouGo customers and Modern billing profile scope. Can only have one of either timePeriod or invoiceId
	// or billingPeriod parameters. If none provided current month cost is provided.
	InvoiceID *string

	// The type of the detailed report. By default ActualCost is provided
	Metric *GenerateDetailedCostReportMetricType

	// Has time period for pulling data for the cost detailed report. Can only have one of either timePeriod or invoiceId or billingPeriod
	// parameters. If none provided current month cost is provided.
	TimePeriod *GenerateDetailedCostReportTimePeriod
}

GenerateDetailedCostReportDefinition - The definition of a cost detailed report.

func (GenerateDetailedCostReportDefinition) MarshalJSON added in v1.1.0

func (g GenerateDetailedCostReportDefinition) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GenerateDetailedCostReportDefinition.

func (*GenerateDetailedCostReportDefinition) UnmarshalJSON added in v1.1.0

func (g *GenerateDetailedCostReportDefinition) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GenerateDetailedCostReportDefinition.

type GenerateDetailedCostReportErrorResponse

type GenerateDetailedCostReportErrorResponse struct {
	// The details of the error.
	Error *ErrorDetails
}

GenerateDetailedCostReportErrorResponse - Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. Some Error responses: * 413 Request Entity Too Large - Request is throttled. The amount of data required to fulfill the request exceeds the maximum size permitted of 2Gb. Please utilize our Exports feature instead.

* 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" header.

* 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" header.

func (GenerateDetailedCostReportErrorResponse) MarshalJSON added in v1.1.0

func (g GenerateDetailedCostReportErrorResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GenerateDetailedCostReportErrorResponse.

func (*GenerateDetailedCostReportErrorResponse) UnmarshalJSON added in v1.1.0

func (g *GenerateDetailedCostReportErrorResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GenerateDetailedCostReportErrorResponse.

type GenerateDetailedCostReportMetricType

type GenerateDetailedCostReportMetricType string

GenerateDetailedCostReportMetricType - The type of the detailed report. By default ActualCost is provided

const (
	GenerateDetailedCostReportMetricTypeActualCost    GenerateDetailedCostReportMetricType = "ActualCost"
	GenerateDetailedCostReportMetricTypeAmortizedCost GenerateDetailedCostReportMetricType = "AmortizedCost"
)

func PossibleGenerateDetailedCostReportMetricTypeValues

func PossibleGenerateDetailedCostReportMetricTypeValues() []GenerateDetailedCostReportMetricType

PossibleGenerateDetailedCostReportMetricTypeValues returns the possible values for the GenerateDetailedCostReportMetricType const type.

type GenerateDetailedCostReportOperationResult

type GenerateDetailedCostReportOperationResult struct {
	// The id of the long running operation.
	ID *string

	// The name of the long running operation.
	Name *string

	// The properties of the resource generated.
	Properties *DownloadURL

	// The type of the long running operation.
	Type *string
}

GenerateDetailedCostReportOperationResult - The result of the long running operation for cost detailed report.

func (GenerateDetailedCostReportOperationResult) MarshalJSON added in v1.1.0

MarshalJSON implements the json.Marshaller interface for type GenerateDetailedCostReportOperationResult.

func (*GenerateDetailedCostReportOperationResult) UnmarshalJSON added in v1.1.0

func (g *GenerateDetailedCostReportOperationResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GenerateDetailedCostReportOperationResult.

type GenerateDetailedCostReportOperationResultsClient

type GenerateDetailedCostReportOperationResultsClient struct {
	// contains filtered or unexported fields
}

GenerateDetailedCostReportOperationResultsClient contains the methods for the GenerateDetailedCostReportOperationResults group. Don't use this type directly, use NewGenerateDetailedCostReportOperationResultsClient() instead.

func NewGenerateDetailedCostReportOperationResultsClient

func NewGenerateDetailedCostReportOperationResultsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GenerateDetailedCostReportOperationResultsClient, error)

NewGenerateDetailedCostReportOperationResultsClient creates a new instance of GenerateDetailedCostReportOperationResultsClient with the specified values.

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*GenerateDetailedCostReportOperationResultsClient) Get

Get - Get the result of the specified operation. This link is provided in the GenerateDetailedCostReport creation request response header. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • operationID - The target operation Id.
  • scope - The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope. Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for billingAccount scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.
  • options - GenerateDetailedCostReportOperationResultsClientGetOptions contains the optional parameters for the GenerateDetailedCostReportOperationResultsClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/GenerateDetailedCostReportOperationResultsBySubscriptionScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGenerateDetailedCostReportOperationResultsClient().Get(ctx, "00000000-0000-0000-0000-000000000000", "subscriptions/00000000-0000-0000-0000-000000000000", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.GenerateDetailedCostReportOperationResult = armcostmanagement.GenerateDetailedCostReportOperationResult{
	// 	Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	Type: to.Ptr("Microsoft.Consumption/operationResult"),
	// 	ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/operationResults/00000000-0000-0000-0000-000000000000"),
	// 	Properties: &armcostmanagement.DownloadURL{
	// 		DownloadURL: to.Ptr("https://ccmreportstorageeastus.blob.core.windows.net/armreports/20201207/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd"),
	// 		ValidTill: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-08T05:55:59.4394737Z"); return t}()),
	// 	},
	// }
}
Output:

type GenerateDetailedCostReportOperationResultsClientGetOptions added in v0.2.0

type GenerateDetailedCostReportOperationResultsClientGetOptions struct {
}

GenerateDetailedCostReportOperationResultsClientGetOptions contains the optional parameters for the GenerateDetailedCostReportOperationResultsClient.Get method.

type GenerateDetailedCostReportOperationResultsClientGetResponse added in v0.2.0

type GenerateDetailedCostReportOperationResultsClientGetResponse struct {
	GenerateDetailedCostReportOperationResult
}

GenerateDetailedCostReportOperationResultsClientGetResponse contains the response from method GenerateDetailedCostReportOperationResultsClient.Get.

type GenerateDetailedCostReportOperationStatusClient

type GenerateDetailedCostReportOperationStatusClient struct {
	// contains filtered or unexported fields
}

GenerateDetailedCostReportOperationStatusClient contains the methods for the GenerateDetailedCostReportOperationStatus group. Don't use this type directly, use NewGenerateDetailedCostReportOperationStatusClient() instead.

func NewGenerateDetailedCostReportOperationStatusClient

func NewGenerateDetailedCostReportOperationStatusClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GenerateDetailedCostReportOperationStatusClient, error)

NewGenerateDetailedCostReportOperationStatusClient creates a new instance of GenerateDetailedCostReportOperationStatusClient with the specified values.

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*GenerateDetailedCostReportOperationStatusClient) Get

Get - Get the status of the specified operation. This link is provided in the GenerateDetailedCostReport creation request response header. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • operationID - The target operation Id.
  • scope - The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope. Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for billingAccount scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.
  • options - GenerateDetailedCostReportOperationStatusClientGetOptions contains the optional parameters for the GenerateDetailedCostReportOperationStatusClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/GenerateDetailedCostReportOperationStatusBySubscriptionScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGenerateDetailedCostReportOperationStatusClient().Get(ctx, "00000000-0000-0000-0000-000000000000", "subscriptions/00000000-0000-0000-0000-000000000000", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.GenerateDetailedCostReportOperationStatuses = armcostmanagement.GenerateDetailedCostReportOperationStatuses{
	// 	Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	Type: to.Ptr("Microsoft.Consumption/operationStatus"),
	// 	Error: &armcostmanagement.ErrorDetails{
	// 		Code: to.Ptr("0"),
	// 	},
	// 	ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/operationStatus/00000000-0000-0000-0000-000000000000"),
	// 	Properties: &armcostmanagement.DownloadURL{
	// 		DownloadURL: to.Ptr("https://ccmreportstorageeastus.blob.core.windows.net/armreports/20201207/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd"),
	// 		ValidTill: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-08T05:55:59.4394737Z"); return t}()),
	// 	},
	// 	Status: &armcostmanagement.Status{
	// 	},
	// }
}
Output:

type GenerateDetailedCostReportOperationStatusClientGetOptions added in v0.2.0

type GenerateDetailedCostReportOperationStatusClientGetOptions struct {
}

GenerateDetailedCostReportOperationStatusClientGetOptions contains the optional parameters for the GenerateDetailedCostReportOperationStatusClient.Get method.

type GenerateDetailedCostReportOperationStatusClientGetResponse added in v0.2.0

type GenerateDetailedCostReportOperationStatusClientGetResponse struct {
	GenerateDetailedCostReportOperationStatuses
}

GenerateDetailedCostReportOperationStatusClientGetResponse contains the response from method GenerateDetailedCostReportOperationStatusClient.Get.

type GenerateDetailedCostReportOperationStatuses

type GenerateDetailedCostReportOperationStatuses struct {
	// The details of the error.
	Error *ErrorDetails

	// The id of the long running operation.
	ID *string

	// The name of the long running operation.
	Name *string

	// The properties of the resource generated.
	Properties *DownloadURL

	// The status of the long running operation.
	Status *Status

	// The type of the long running operation.
	Type *string
}

GenerateDetailedCostReportOperationStatuses - The status of the long running operation for cost detailed report.

func (GenerateDetailedCostReportOperationStatuses) MarshalJSON added in v1.1.0

MarshalJSON implements the json.Marshaller interface for type GenerateDetailedCostReportOperationStatuses.

func (*GenerateDetailedCostReportOperationStatuses) UnmarshalJSON added in v1.1.0

func (g *GenerateDetailedCostReportOperationStatuses) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GenerateDetailedCostReportOperationStatuses.

type GenerateDetailedCostReportTimePeriod

type GenerateDetailedCostReportTimePeriod struct {
	// REQUIRED; The end date to pull data to. example format 2020-03-15
	End *string

	// REQUIRED; The start date to pull data from. example format 2020-03-15
	Start *string
}

GenerateDetailedCostReportTimePeriod - The start and end date for pulling data for the cost detailed report.

func (GenerateDetailedCostReportTimePeriod) MarshalJSON added in v1.1.0

func (g GenerateDetailedCostReportTimePeriod) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GenerateDetailedCostReportTimePeriod.

func (*GenerateDetailedCostReportTimePeriod) UnmarshalJSON added in v1.1.0

func (g *GenerateDetailedCostReportTimePeriod) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GenerateDetailedCostReportTimePeriod.

type GenerateReservationDetailsReportClient added in v0.3.0

type GenerateReservationDetailsReportClient struct {
	// contains filtered or unexported fields
}

GenerateReservationDetailsReportClient contains the methods for the GenerateReservationDetailsReport group. Don't use this type directly, use NewGenerateReservationDetailsReportClient() instead.

func NewGenerateReservationDetailsReportClient added in v0.3.0

func NewGenerateReservationDetailsReportClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GenerateReservationDetailsReportClient, error)

NewGenerateReservationDetailsReportClient creates a new instance of GenerateReservationDetailsReportClient with the specified values.

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*GenerateReservationDetailsReportClient) BeginByBillingAccountID added in v0.3.0

BeginByBillingAccountID - Generates the reservations details report for provided date range asynchronously based on enrollment id. The Reservation usage details can be viewed only by certain enterprise roles. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • billingAccountID - Enrollment ID (Legacy BillingAccount ID)
  • startDate - Start Date
  • endDate - End Date
  • options - GenerateReservationDetailsReportClientBeginByBillingAccountIDOptions contains the optional parameters for the GenerateReservationDetailsReportClient.BeginByBillingAccountID method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/GenerateReservationDetailsReportByBillingAccount.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGenerateReservationDetailsReportClient().BeginByBillingAccountID(ctx, "9845612", "2020-01-01", "2020-01-30", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.OperationStatus = armcostmanagement.OperationStatus{
	// 	Properties: &armcostmanagement.ReportURL{
	// 		ReportURL: to.Ptr(armcostmanagement.ReservationReportSchema("https://storage.blob.core.windows.net/details/20200911/00000000-0000-0000-0000-000000000000?sv=2016-05-31&sr=b&sig=jep8HT2aphfUkyERRZa5LRfd9RPzjXbzB%2F9TNiQ")),
	// 		ValidUntil: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-12T02:56:55.5021869Z"); return t}()),
	// 	},
	// 	Status: to.Ptr(armcostmanagement.OperationStatusTypeCompleted),
	// }
}
Output:

func (*GenerateReservationDetailsReportClient) BeginByBillingProfileID added in v0.3.0

BeginByBillingProfileID - Generates the reservations details report for provided date range asynchronously by billing profile. The Reservation usage details can be viewed by only certain enterprise roles by default. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • billingAccountID - BillingAccount ID
  • billingProfileID - BillingProfile ID
  • startDate - Start Date
  • endDate - End Date
  • options - GenerateReservationDetailsReportClientBeginByBillingProfileIDOptions contains the optional parameters for the GenerateReservationDetailsReportClient.BeginByBillingProfileID method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/GenerateReservationDetailsReportByBillingProfile.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGenerateReservationDetailsReportClient().BeginByBillingProfileID(ctx, "00000000-0000-0000-0000-000000000000", "CZSFR-SDFXC-DSDF", "2020-01-01", "2020-01-30", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.OperationStatus = armcostmanagement.OperationStatus{
	// 	Properties: &armcostmanagement.ReportURL{
	// 		ReportURL: to.Ptr(armcostmanagement.ReservationReportSchema("https://storage.blob.core.windows.net/details/20200911/00000000-0000-0000-0000-000000000000?sv=2016-05-31&sr=b&sig=jep8HT2aphfUkyERRZa5LRfd9RPzjXbzB%2F9TNiQ")),
	// 		ValidUntil: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-12T02:56:55.5021869Z"); return t}()),
	// 	},
	// 	Status: to.Ptr(armcostmanagement.OperationStatusTypeCompleted),
	// }
}
Output:

type GenerateReservationDetailsReportClientBeginByBillingAccountIDOptions added in v0.3.0

type GenerateReservationDetailsReportClientBeginByBillingAccountIDOptions struct {
	// Resumes the LRO from the provided token.
	ResumeToken string
}

GenerateReservationDetailsReportClientBeginByBillingAccountIDOptions contains the optional parameters for the GenerateReservationDetailsReportClient.BeginByBillingAccountID method.

type GenerateReservationDetailsReportClientBeginByBillingProfileIDOptions added in v0.3.0

type GenerateReservationDetailsReportClientBeginByBillingProfileIDOptions struct {
	// Resumes the LRO from the provided token.
	ResumeToken string
}

GenerateReservationDetailsReportClientBeginByBillingProfileIDOptions contains the optional parameters for the GenerateReservationDetailsReportClient.BeginByBillingProfileID method.

type GenerateReservationDetailsReportClientByBillingAccountIDResponse added in v0.3.0

type GenerateReservationDetailsReportClientByBillingAccountIDResponse struct {
	OperationStatus
}

GenerateReservationDetailsReportClientByBillingAccountIDResponse contains the response from method GenerateReservationDetailsReportClient.BeginByBillingAccountID.

type GenerateReservationDetailsReportClientByBillingProfileIDResponse added in v0.3.0

type GenerateReservationDetailsReportClientByBillingProfileIDResponse struct {
	OperationStatus
}

GenerateReservationDetailsReportClientByBillingProfileIDResponse contains the response from method GenerateReservationDetailsReportClient.BeginByBillingProfileID.

type GranularityType

type GranularityType string

GranularityType - The granularity of rows in the export. Currently only 'Daily' is supported.

const (
	GranularityTypeDaily GranularityType = "Daily"
)

func PossibleGranularityTypeValues

func PossibleGranularityTypeValues() []GranularityType

PossibleGranularityTypeValues returns the possible values for the GranularityType const type.

type KpiProperties

type KpiProperties struct {
	// show the KPI in the UI?
	Enabled *bool

	// ID of resource related to metric (budget).
	ID *string

	// KPI type (Forecast, Budget).
	Type *KpiType
}

KpiProperties - Each KPI must contain a 'type' and 'enabled' key.

func (KpiProperties) MarshalJSON added in v1.1.0

func (k KpiProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type KpiProperties.

func (*KpiProperties) UnmarshalJSON added in v1.1.0

func (k *KpiProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type KpiProperties.

type KpiType

type KpiType string

KpiType - KPI type (Forecast, Budget).

const (
	KpiTypeBudget   KpiType = "Budget"
	KpiTypeForecast KpiType = "Forecast"
)

func PossibleKpiTypeValues

func PossibleKpiTypeValues() []KpiType

PossibleKpiTypeValues returns the possible values for the KpiType const type.

type MetricType

type MetricType string

MetricType - Metric to use when displaying costs.

const (
	MetricTypeAHUB          MetricType = "AHUB"
	MetricTypeActualCost    MetricType = "ActualCost"
	MetricTypeAmortizedCost MetricType = "AmortizedCost"
)

func PossibleMetricTypeValues

func PossibleMetricTypeValues() []MetricType

PossibleMetricTypeValues returns the possible values for the MetricType const type.

type Operation

type Operation struct {
	// The object that represents the operation.
	Display *OperationDisplay

	// READ-ONLY; Operation id: {provider}/{resource}/{operation}.
	ID *string

	// READ-ONLY; Operation name: {provider}/{resource}/{operation}.
	Name *string
}

Operation - A Cost management REST API operation.

func (Operation) MarshalJSON added in v1.1.0

func (o Operation) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Operation.

func (*Operation) UnmarshalJSON added in v1.1.0

func (o *Operation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Operation.

type OperationDisplay

type OperationDisplay struct {
	// READ-ONLY; Operation description
	Description *string

	// READ-ONLY; Operation type: Read, write, delete, etc.
	Operation *string

	// READ-ONLY; Service provider: Microsoft.CostManagement.
	Provider *string

	// READ-ONLY; Resource on which the operation is performed: Dimensions, Query.
	Resource *string
}

OperationDisplay - The object that represents the operation.

func (OperationDisplay) MarshalJSON added in v1.1.0

func (o OperationDisplay) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type OperationDisplay.

func (*OperationDisplay) UnmarshalJSON added in v1.1.0

func (o *OperationDisplay) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay.

type OperationListResult

type OperationListResult struct {
	// READ-ONLY; URL to get the next set of operation list results if there are any.
	NextLink *string

	// READ-ONLY; List of cost management operations supported by the Microsoft.CostManagement resource provider.
	Value []*Operation
}

OperationListResult - Result of listing cost management operations. It contains a list of operations and a URL link to get the next set of results.

func (OperationListResult) MarshalJSON

func (o OperationListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type OperationListResult.

func (*OperationListResult) UnmarshalJSON added in v1.1.0

func (o *OperationListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult.

type OperationStatus added in v0.3.0

type OperationStatus struct {
	// The properties of the resource generated.
	Properties *ReportURL

	// The status of the long running operation.
	Status *OperationStatusType
}

OperationStatus - The status of the long running operation.

func (OperationStatus) MarshalJSON added in v1.1.0

func (o OperationStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type OperationStatus.

func (*OperationStatus) UnmarshalJSON added in v1.1.0

func (o *OperationStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatus.

type OperationStatusType

type OperationStatusType string

OperationStatusType - The status of the long running operation.

const (
	OperationStatusTypeCompleted OperationStatusType = "Completed"
	OperationStatusTypeFailed    OperationStatusType = "Failed"
	OperationStatusTypeRunning   OperationStatusType = "Running"
)

func PossibleOperationStatusTypeValues

func PossibleOperationStatusTypeValues() []OperationStatusType

PossibleOperationStatusTypeValues returns the possible values for the OperationStatusType const type.

type OperationsClient

type OperationsClient struct {
	// contains filtered or unexported fields
}

OperationsClient contains the methods for the Operations group. Don't use this type directly, use NewOperationsClient() instead.

func NewOperationsClient

func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error)

NewOperationsClient creates a new instance of OperationsClient with the specified values.

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*OperationsClient) NewListPager added in v0.4.0

NewListPager - Lists all of the available cost management REST API operations.

Generated from API version 2021-10-01

  • options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/OperationList.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewOperationsClient().NewListPager(nil)
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.OperationListResult = armcostmanagement.OperationListResult{
		// 	Value: []*armcostmanagement.Operation{
		// 		{
		// 			Name: to.Ptr("Microsoft.CostManagement/budgets/read"),
		// 			Display: &armcostmanagement.OperationDisplay{
		// 				Description: to.Ptr("List the budgets by a subscription or a management group."),
		// 				Operation: to.Ptr("List budgets"),
		// 				Provider: to.Ptr("Microsoft.CostManagement"),
		// 				Resource: to.Ptr("Budgets"),
		// 			},
		// 			ID: to.Ptr("Microsoft.CostManagement/budgets/read"),
		// 		},
		// 		{
		// 			Name: to.Ptr("Microsoft.CostManagement/query/action"),
		// 			Display: &armcostmanagement.OperationDisplay{
		// 				Description: to.Ptr("Query usage data by a scope."),
		// 				Operation: to.Ptr("Query usage data"),
		// 				Provider: to.Ptr("Microsoft.CostManagement"),
		// 				Resource: to.Ptr("Query"),
		// 			},
		// 			ID: to.Ptr("Microsoft.CostManagement/query/action"),
		// 		},
		// 		{
		// 			Name: to.Ptr("Microsoft.CostManagement/exports/read"),
		// 			Display: &armcostmanagement.OperationDisplay{
		// 				Description: to.Ptr("List the exports by scope."),
		// 				Operation: to.Ptr("List exports"),
		// 				Provider: to.Ptr("Microsoft.CostManagement"),
		// 				Resource: to.Ptr("Exports"),
		// 			},
		// 			ID: to.Ptr("Microsoft.CostManagement/exports/read"),
		// 		},
		// 		{
		// 			Name: to.Ptr("Microsoft.CostManagement/exports/write"),
		// 			Display: &armcostmanagement.OperationDisplay{
		// 				Description: to.Ptr("Create or update the specified export."),
		// 				Operation: to.Ptr("Create and update export"),
		// 				Provider: to.Ptr("Microsoft.CostManagement"),
		// 				Resource: to.Ptr("Exports"),
		// 			},
		// 			ID: to.Ptr("Microsoft.CostManagement/exports/write"),
		// 		},
		// 		{
		// 			Name: to.Ptr("Microsoft.CostManagement/exports/action"),
		// 			Display: &armcostmanagement.OperationDisplay{
		// 				Description: to.Ptr("Run the specified export."),
		// 				Operation: to.Ptr("Run export"),
		// 				Provider: to.Ptr("Microsoft.CostManagement"),
		// 				Resource: to.Ptr("Exports"),
		// 			},
		// 			ID: to.Ptr("Microsoft.CostManagement/exports/action"),
		// 		},
		// 		{
		// 			Name: to.Ptr("Microsoft.CostManagement/exports/run/action"),
		// 			Display: &armcostmanagement.OperationDisplay{
		// 				Description: to.Ptr("Run exports."),
		// 				Operation: to.Ptr("Run exports"),
		// 				Provider: to.Ptr("Microsoft.CostManagement"),
		// 				Resource: to.Ptr("exports/run"),
		// 			},
		// 			ID: to.Ptr("Microsoft.CostManagement/exports/run/action"),
		// 		},
		// 		{
		// 			Name: to.Ptr("Microsoft.CostManagement/alerts/read"),
		// 			Display: &armcostmanagement.OperationDisplay{
		// 				Description: to.Ptr("List alerts."),
		// 				Operation: to.Ptr("List Alerts"),
		// 				Provider: to.Ptr("Microsoft.CostManagement"),
		// 				Resource: to.Ptr("Alerts"),
		// 			},
		// 			ID: to.Ptr("Microsoft.CostManagement/alerts/read"),
		// 		},
		// 		{
		// 			Name: to.Ptr("Microsoft.CostManagement/operations/read"),
		// 			Display: &armcostmanagement.OperationDisplay{
		// 				Description: to.Ptr("List all supported operations by Microsoft.CostManagement resource provider."),
		// 				Operation: to.Ptr("List supported operations"),
		// 				Provider: to.Ptr("Microsoft.CostManagement"),
		// 				Resource: to.Ptr("Operations"),
		// 			},
		// 			ID: to.Ptr("Microsoft.CostManagement/operations/read"),
		// 		},
		// 		{
		// 			Name: to.Ptr("Microsoft.CostManagement/views/action"),
		// 			Display: &armcostmanagement.OperationDisplay{
		// 				Description: to.Ptr("Create view."),
		// 				Operation: to.Ptr("Create views"),
		// 				Provider: to.Ptr("Microsoft.CostManagement"),
		// 				Resource: to.Ptr("Views"),
		// 			},
		// 			ID: to.Ptr("Microsoft.CostManagement/views/action"),
		// 		},
		// 		{
		// 			Name: to.Ptr("Microsoft.CostManagement/views/write"),
		// 			Display: &armcostmanagement.OperationDisplay{
		// 				Description: to.Ptr("Update view."),
		// 				Operation: to.Ptr("Update views"),
		// 				Provider: to.Ptr("Microsoft.CostManagement"),
		// 				Resource: to.Ptr("Views"),
		// 			},
		// 			ID: to.Ptr("Microsoft.CostManagement/views/write"),
		// 	}},
		// }
	}
}
Output:

type OperationsClientListOptions added in v0.2.0

type OperationsClientListOptions struct {
}

OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.

type OperationsClientListResponse added in v0.2.0

type OperationsClientListResponse struct {
	OperationListResult
}

OperationsClientListResponse contains the response from method OperationsClient.NewListPager.

type OperatorType

type OperatorType string

OperatorType - The operator to use for comparison.

const (
	OperatorTypeContains OperatorType = "Contains"
	OperatorTypeIn       OperatorType = "In"
)

func PossibleOperatorTypeValues

func PossibleOperatorTypeValues() []OperatorType

PossibleOperatorTypeValues returns the possible values for the OperatorType const type.

type PivotProperties

type PivotProperties struct {
	// Data field to show in view.
	Name *string

	// Data type to show in view.
	Type *PivotType
}

PivotProperties - Each pivot must contain a 'type' and 'name'.

func (PivotProperties) MarshalJSON added in v1.1.0

func (p PivotProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PivotProperties.

func (*PivotProperties) UnmarshalJSON added in v1.1.0

func (p *PivotProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type PivotProperties.

type PivotType

type PivotType string

PivotType - Data type to show in view.

const (
	PivotTypeDimension PivotType = "Dimension"
	PivotTypeTagKey    PivotType = "TagKey"
)

func PossiblePivotTypeValues

func PossiblePivotTypeValues() []PivotType

PossiblePivotTypeValues returns the possible values for the PivotType const type.

type ProxyResource

type ProxyResource struct {
	// eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating
	// the latest version or not.
	ETag *string

	// READ-ONLY; Resource Id.
	ID *string

	// READ-ONLY; Resource name.
	Name *string

	// READ-ONLY; Resource type.
	Type *string
}

ProxyResource - The Resource model definition.

func (ProxyResource) MarshalJSON added in v1.1.0

func (p ProxyResource) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ProxyResource.

func (*ProxyResource) UnmarshalJSON added in v1.1.0

func (p *ProxyResource) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource.

type QueryAggregation

type QueryAggregation struct {
	// REQUIRED; The name of the aggregation function to use.
	Function *FunctionType

	// REQUIRED; The name of the column to aggregate.
	Name *string
}

QueryAggregation - The aggregation expression to be used in the query.

func (QueryAggregation) MarshalJSON added in v1.1.0

func (q QueryAggregation) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type QueryAggregation.

func (*QueryAggregation) UnmarshalJSON added in v1.1.0

func (q *QueryAggregation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type QueryAggregation.

type QueryClient

type QueryClient struct {
	// contains filtered or unexported fields
}

QueryClient contains the methods for the Query group. Don't use this type directly, use NewQueryClient() instead.

func NewQueryClient

func NewQueryClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*QueryClient, error)

NewQueryClient creates a new instance of QueryClient with the specified values.

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*QueryClient) Usage

func (client *QueryClient) Usage(ctx context.Context, scope string, parameters QueryDefinition, options *QueryClientUsageOptions) (QueryClientUsageResponse, error)

Usage - Query the usage data for scope defined. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • scope - The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.
  • parameters - Parameters supplied to the CreateOrUpdate Query Config operation.
  • options - QueryClientUsageOptions contains the optional parameters for the QueryClient.Usage method.
Example (BillingAccountQueryGroupingLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingAccountQueryGrouping.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/70664866", armcostmanagement.QueryDefinition{
		Type: to.Ptr(armcostmanagement.ExportTypeUsage),
		Dataset: &armcostmanagement.QueryDataset{
			Aggregation: map[string]*armcostmanagement.QueryAggregation{
				"totalCost": {
					Name:     to.Ptr("PreTaxCost"),
					Function: to.Ptr(armcostmanagement.FunctionTypeSum),
				},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityType("None")),
			Grouping: []*armcostmanagement.QueryGrouping{
				{
					Name: to.Ptr("ResourceGroup"),
					Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension),
				}},
		},
		Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/70664866/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("ResourceGroup"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(19.545363672276512),
	// 				"JapanUnifia-Trial",
	// 				"USD"},
	// 				[]any{
	// 					float64(173.41979241290323),
	// 					"RVIIOT-TRIAL",
	// 					"USD"},
	// 					[]any{
	// 						float64(20.35941656262545),
	// 						"VSTSHOL-1595322048000",
	// 						"USD"}},
	// 					},
	// 				}
}
Output:

Example (BillingAccountQueryGroupingModern)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCABillingAccountQueryGrouping.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789", armcostmanagement.QueryDefinition{
		Type: to.Ptr(armcostmanagement.ExportTypeUsage),
		Dataset: &armcostmanagement.QueryDataset{
			Aggregation: map[string]*armcostmanagement.QueryAggregation{
				"totalCost": {
					Name:     to.Ptr("PreTaxCost"),
					Function: to.Ptr(armcostmanagement.FunctionTypeSum),
				},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityType("None")),
			Grouping: []*armcostmanagement.QueryGrouping{
				{
					Name: to.Ptr("ResourceGroup"),
					Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension),
				}},
		},
		Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("ResourceGroup"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(19.545363672276512),
	// 				"JapanUnifia-Trial",
	// 				"USD"},
	// 				[]any{
	// 					float64(173.41979241290323),
	// 					"RVIIOT-TRIAL",
	// 					"USD"},
	// 					[]any{
	// 						float64(20.35941656262545),
	// 						"VSTSHOL-1595322048000",
	// 						"USD"}},
	// 					},
	// 				}
}
Output:

Example (BillingAccountQueryLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingAccountQuery.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/70664866", armcostmanagement.QueryDefinition{
		Type: to.Ptr(armcostmanagement.ExportTypeUsage),
		Dataset: &armcostmanagement.QueryDataset{
			Filter: &armcostmanagement.QueryFilter{
				And: []*armcostmanagement.QueryFilter{
					{
						Or: []*armcostmanagement.QueryFilter{
							{
								Dimensions: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("ResourceLocation"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("East US"),
										to.Ptr("West Europe")},
								},
							},
							{
								Tags: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("Environment"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("UAT"),
										to.Ptr("Prod")},
								},
							}},
					},
					{
						Dimensions: &armcostmanagement.QueryComparisonExpression{
							Name:     to.Ptr("ResourceGroup"),
							Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
							Values: []*string{
								to.Ptr("API")},
						},
					}},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
		},
		Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/70664866/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("ResourceGroup"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("UsageDate"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(19.545363672276512),
	// 				"JapanUnifia-Trial",
	// 				float64(20180331),
	// 				"USD"},
	// 				[]any{
	// 					float64(173.41979241290323),
	// 					"RVIIOT-TRIAL",
	// 					float64(20180331),
	// 					"USD"},
	// 					[]any{
	// 						float64(20.35941656262545),
	// 						"VSTSHOL-1595322048000",
	// 						float64(20180331),
	// 						"USD"},
	// 						[]any{
	// 							float64(0.16677720329728665),
	// 							"gs-stms-dev",
	// 							float64(20180331),
	// 							"USD"}},
	// 						},
	// 					}
}
Output:

Example (BillingAccountQueryModern)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCABillingAccountQuery.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789", armcostmanagement.QueryDefinition{
		Type: to.Ptr(armcostmanagement.ExportTypeUsage),
		Dataset: &armcostmanagement.QueryDataset{
			Filter: &armcostmanagement.QueryFilter{
				And: []*armcostmanagement.QueryFilter{
					{
						Or: []*armcostmanagement.QueryFilter{
							{
								Dimensions: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("ResourceLocation"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("East US"),
										to.Ptr("West Europe")},
								},
							},
							{
								Tags: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("Environment"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("UAT"),
										to.Ptr("Prod")},
								},
							}},
					},
					{
						Dimensions: &armcostmanagement.QueryComparisonExpression{
							Name:     to.Ptr("ResourceGroup"),
							Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
							Values: []*string{
								to.Ptr("API")},
						},
					}},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
		},
		Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("ResourceGroup"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("UsageDate"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(19.545363672276512),
	// 				"JapanUnifia-Trial",
	// 				float64(20180331),
	// 				"USD"},
	// 				[]any{
	// 					float64(173.41979241290323),
	// 					"RVIIOT-TRIAL",
	// 					float64(20180331),
	// 					"USD"},
	// 					[]any{
	// 						float64(20.35941656262545),
	// 						"VSTSHOL-1595322048000",
	// 						float64(20180331),
	// 						"USD"},
	// 						[]any{
	// 							float64(0.16677720329728665),
	// 							"gs-stms-dev",
	// 							float64(20180331),
	// 							"USD"}},
	// 						},
	// 					}
}
Output:

Example (BillingProfileQueryGroupingModern)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCABillingProfileQueryGrouping.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", armcostmanagement.QueryDefinition{
		Type: to.Ptr(armcostmanagement.ExportTypeUsage),
		Dataset: &armcostmanagement.QueryDataset{
			Aggregation: map[string]*armcostmanagement.QueryAggregation{
				"totalCost": {
					Name:     to.Ptr("PreTaxCost"),
					Function: to.Ptr(armcostmanagement.FunctionTypeSum),
				},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityType("None")),
			Grouping: []*armcostmanagement.QueryGrouping{
				{
					Name: to.Ptr("ResourceGroup"),
					Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension),
				}},
		},
		Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("ResourceGroup"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(19.545363672276512),
	// 				"JapanUnifia-Trial",
	// 				"USD"},
	// 				[]any{
	// 					float64(173.41979241290323),
	// 					"RVIIOT-TRIAL",
	// 					"USD"},
	// 					[]any{
	// 						float64(20.35941656262545),
	// 						"VSTSHOL-1595322048000",
	// 						"USD"}},
	// 					},
	// 				}
}
Output:

Example (BillingProfileQueryModern)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCABillingProfileQuery.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", armcostmanagement.QueryDefinition{
		Type: to.Ptr(armcostmanagement.ExportTypeUsage),
		Dataset: &armcostmanagement.QueryDataset{
			Filter: &armcostmanagement.QueryFilter{
				And: []*armcostmanagement.QueryFilter{
					{
						Or: []*armcostmanagement.QueryFilter{
							{
								Dimensions: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("ResourceLocation"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("East US"),
										to.Ptr("West Europe")},
								},
							},
							{
								Tags: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("Environment"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("UAT"),
										to.Ptr("Prod")},
								},
							}},
					},
					{
						Dimensions: &armcostmanagement.QueryComparisonExpression{
							Name:     to.Ptr("ResourceGroup"),
							Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
							Values: []*string{
								to.Ptr("API")},
						},
					}},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
		},
		Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("ResourceGroup"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("UsageDate"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(19.545363672276512),
	// 				"JapanUnifia-Trial",
	// 				float64(20180331),
	// 				"USD"},
	// 				[]any{
	// 					float64(173.41979241290323),
	// 					"RVIIOT-TRIAL",
	// 					float64(20180331),
	// 					"USD"},
	// 					[]any{
	// 						float64(20.35941656262545),
	// 						"VSTSHOL-1595322048000",
	// 						float64(20180331),
	// 						"USD"},
	// 						[]any{
	// 							float64(0.16677720329728665),
	// 							"gs-stms-dev",
	// 							float64(20180331),
	// 							"USD"}},
	// 						},
	// 					}
}
Output:

Example (CustomerQueryGroupingModern)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCACustomerQueryGrouping.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", armcostmanagement.QueryDefinition{
		Type: to.Ptr(armcostmanagement.ExportTypeUsage),
		Dataset: &armcostmanagement.QueryDataset{
			Aggregation: map[string]*armcostmanagement.QueryAggregation{
				"totalCost": {
					Name:     to.Ptr("PreTaxCost"),
					Function: to.Ptr(armcostmanagement.FunctionTypeSum),
				},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityType("None")),
			Grouping: []*armcostmanagement.QueryGrouping{
				{
					Name: to.Ptr("ResourceGroup"),
					Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension),
				}},
		},
		Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("ResourceGroup"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(19.545363672276512),
	// 				"JapanUnifia-Trial",
	// 				"USD"},
	// 				[]any{
	// 					float64(173.41979241290323),
	// 					"RVIIOT-TRIAL",
	// 					"USD"},
	// 					[]any{
	// 						float64(20.35941656262545),
	// 						"VSTSHOL-1595322048000",
	// 						"USD"}},
	// 					},
	// 				}
}
Output:

Example (CustomerQueryModern)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCACustomerQuery.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", armcostmanagement.QueryDefinition{
		Type: to.Ptr(armcostmanagement.ExportTypeUsage),
		Dataset: &armcostmanagement.QueryDataset{
			Filter: &armcostmanagement.QueryFilter{
				And: []*armcostmanagement.QueryFilter{
					{
						Or: []*armcostmanagement.QueryFilter{
							{
								Dimensions: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("ResourceLocation"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("East US"),
										to.Ptr("West Europe")},
								},
							},
							{
								Tags: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("Environment"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("UAT"),
										to.Ptr("Prod")},
								},
							}},
					},
					{
						Dimensions: &armcostmanagement.QueryComparisonExpression{
							Name:     to.Ptr("ResourceGroup"),
							Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
							Values: []*string{
								to.Ptr("API")},
						},
					}},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
		},
		Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("ResourceGroup"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("UsageDate"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(19.545363672276512),
	// 				"JapanUnifia-Trial",
	// 				float64(20180331),
	// 				"USD"},
	// 				[]any{
	// 					float64(173.41979241290323),
	// 					"RVIIOT-TRIAL",
	// 					float64(20180331),
	// 					"USD"},
	// 					[]any{
	// 						float64(20.35941656262545),
	// 						"VSTSHOL-1595322048000",
	// 						float64(20180331),
	// 						"USD"},
	// 						[]any{
	// 							float64(0.16677720329728665),
	// 							"gs-stms-dev",
	// 							float64(20180331),
	// 							"USD"}},
	// 						},
	// 					}
}
Output:

Example (DepartmentQueryGroupingLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/DepartmentQueryGrouping.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/100/departments/123", armcostmanagement.QueryDefinition{
		Type: to.Ptr(armcostmanagement.ExportTypeUsage),
		Dataset: &armcostmanagement.QueryDataset{
			Aggregation: map[string]*armcostmanagement.QueryAggregation{
				"totalCost": {
					Name:     to.Ptr("PreTaxCost"),
					Function: to.Ptr(armcostmanagement.FunctionTypeSum),
				},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityType("None")),
			Grouping: []*armcostmanagement.QueryGrouping{
				{
					Name: to.Ptr("ResourceGroup"),
					Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension),
				}},
		},
		Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/70664866/departments/123/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("ResourceGroup"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(19.545363672276512),
	// 				"JapanUnifia-Trial",
	// 				"USD"},
	// 				[]any{
	// 					float64(173.41979241290323),
	// 					"RVIIOT-TRIAL",
	// 					"USD"},
	// 					[]any{
	// 						float64(20.35941656262545),
	// 						"VSTSHOL-1595322048000",
	// 						"USD"}},
	// 					},
	// 				}
}
Output:

Example (DepartmentQueryLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/DepartmentQuery.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/100/departments/123", armcostmanagement.QueryDefinition{
		Type: to.Ptr(armcostmanagement.ExportTypeUsage),
		Dataset: &armcostmanagement.QueryDataset{
			Filter: &armcostmanagement.QueryFilter{
				And: []*armcostmanagement.QueryFilter{
					{
						Or: []*armcostmanagement.QueryFilter{
							{
								Dimensions: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("ResourceLocation"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("East US"),
										to.Ptr("West Europe")},
								},
							},
							{
								Tags: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("Environment"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("UAT"),
										to.Ptr("Prod")},
								},
							}},
					},
					{
						Dimensions: &armcostmanagement.QueryComparisonExpression{
							Name:     to.Ptr("ResourceGroup"),
							Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
							Values: []*string{
								to.Ptr("API")},
						},
					}},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
		},
		Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/70664866/departments/123/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("ResourceGroup"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("UsageDate"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(19.545363672276512),
	// 				"JapanUnifia-Trial",
	// 				float64(20180331),
	// 				"USD"},
	// 				[]any{
	// 					float64(173.41979241290323),
	// 					"RVIIOT-TRIAL",
	// 					float64(20180331),
	// 					"USD"},
	// 					[]any{
	// 						float64(20.35941656262545),
	// 						"VSTSHOL-1595322048000",
	// 						float64(20180331),
	// 						"USD"},
	// 						[]any{
	// 							float64(0.16677720329728665),
	// 							"gs-stms-dev",
	// 							float64(20180331),
	// 							"USD"}},
	// 						},
	// 					}
}
Output:

Example (EnrollmentAccountQueryGroupingLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/EnrollmentAccountQueryGrouping.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", armcostmanagement.QueryDefinition{
		Type: to.Ptr(armcostmanagement.ExportTypeUsage),
		Dataset: &armcostmanagement.QueryDataset{
			Aggregation: map[string]*armcostmanagement.QueryAggregation{
				"totalCost": {
					Name:     to.Ptr("PreTaxCost"),
					Function: to.Ptr(armcostmanagement.FunctionTypeSum),
				},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
			Grouping: []*armcostmanagement.QueryGrouping{
				{
					Name: to.Ptr("ResourceGroup"),
					Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension),
				}},
		},
		Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/70664866/enrollmentAccounts/456/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("ResourceGroup"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("UsageDate"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(19.545363672276512),
	// 				"JapanUnifia-Trial",
	// 				float64(20180331),
	// 				"USD"},
	// 				[]any{
	// 					float64(173.41979241290323),
	// 					"RVIIOT-TRIAL",
	// 					float64(20180331),
	// 					"USD"},
	// 					[]any{
	// 						float64(20.35941656262545),
	// 						"VSTSHOL-1595322048000",
	// 						float64(20180331),
	// 						"USD"}},
	// 					},
	// 				}
}
Output:

Example (EnrollmentAccountQueryLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/EnrollmentAccountQuery.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", armcostmanagement.QueryDefinition{
		Type: to.Ptr(armcostmanagement.ExportTypeUsage),
		Dataset: &armcostmanagement.QueryDataset{
			Filter: &armcostmanagement.QueryFilter{
				And: []*armcostmanagement.QueryFilter{
					{
						Or: []*armcostmanagement.QueryFilter{
							{
								Dimensions: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("ResourceLocation"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("East US"),
										to.Ptr("West Europe")},
								},
							},
							{
								Tags: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("Environment"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("UAT"),
										to.Ptr("Prod")},
								},
							}},
					},
					{
						Dimensions: &armcostmanagement.QueryComparisonExpression{
							Name:     to.Ptr("ResourceGroup"),
							Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
							Values: []*string{
								to.Ptr("API")},
						},
					}},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
		},
		Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/70664866/enrollmentAccounts/456/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("ResourceGroup"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("UsageDate"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(19.545363672276512),
	// 				"JapanUnifia-Trial",
	// 				float64(20180331),
	// 				"USD"},
	// 				[]any{
	// 					float64(173.41979241290323),
	// 					"RVIIOT-TRIAL",
	// 					float64(20180331),
	// 					"USD"},
	// 					[]any{
	// 						float64(20.35941656262545),
	// 						"VSTSHOL-1595322048000",
	// 						float64(20180331),
	// 						"USD"},
	// 						[]any{
	// 							float64(0.16677720329728665),
	// 							"gs-stms-dev",
	// 							float64(20180331),
	// 							"USD"}},
	// 						},
	// 					}
}
Output:

Example (InvoiceSectionQueryGroupingModern)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCAInvoiceSectionQueryGrouping.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", armcostmanagement.QueryDefinition{
		Type: to.Ptr(armcostmanagement.ExportTypeUsage),
		Dataset: &armcostmanagement.QueryDataset{
			Aggregation: map[string]*armcostmanagement.QueryAggregation{
				"totalCost": {
					Name:     to.Ptr("PreTaxCost"),
					Function: to.Ptr(armcostmanagement.FunctionTypeSum),
				},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityType("None")),
			Grouping: []*armcostmanagement.QueryGrouping{
				{
					Name: to.Ptr("ResourceGroup"),
					Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension),
				}},
		},
		Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("ResourceGroup"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(19.545363672276512),
	// 				"JapanUnifia-Trial",
	// 				"USD"},
	// 				[]any{
	// 					float64(173.41979241290323),
	// 					"RVIIOT-TRIAL",
	// 					"USD"},
	// 					[]any{
	// 						float64(20.35941656262545),
	// 						"VSTSHOL-1595322048000",
	// 						"USD"}},
	// 					},
	// 				}
}
Output:

Example (InvoiceSectionQueryModern)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCAInvoiceSectionQuery.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", armcostmanagement.QueryDefinition{
		Type: to.Ptr(armcostmanagement.ExportTypeUsage),
		Dataset: &armcostmanagement.QueryDataset{
			Filter: &armcostmanagement.QueryFilter{
				And: []*armcostmanagement.QueryFilter{
					{
						Or: []*armcostmanagement.QueryFilter{
							{
								Dimensions: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("ResourceLocation"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("East US"),
										to.Ptr("West Europe")},
								},
							},
							{
								Tags: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("Environment"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("UAT"),
										to.Ptr("Prod")},
								},
							}},
					},
					{
						Dimensions: &armcostmanagement.QueryComparisonExpression{
							Name:     to.Ptr("ResourceGroup"),
							Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
							Values: []*string{
								to.Ptr("API")},
						},
					}},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
		},
		Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("ResourceGroup"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("UsageDate"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(19.545363672276512),
	// 				"JapanUnifia-Trial",
	// 				float64(20180331),
	// 				"USD"},
	// 				[]any{
	// 					float64(173.41979241290323),
	// 					"RVIIOT-TRIAL",
	// 					float64(20180331),
	// 					"USD"},
	// 					[]any{
	// 						float64(20.35941656262545),
	// 						"VSTSHOL-1595322048000",
	// 						float64(20180331),
	// 						"USD"},
	// 						[]any{
	// 							float64(0.16677720329728665),
	// 							"gs-stms-dev",
	// 							float64(20180331),
	// 							"USD"}},
	// 						},
	// 					}
}
Output:

Example (ManagementGroupQueryGroupingLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ManagementGroupQueryGrouping.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Management/managementGroups/MyMgId", armcostmanagement.QueryDefinition{
		Type: to.Ptr(armcostmanagement.ExportTypeUsage),
		Dataset: &armcostmanagement.QueryDataset{
			Aggregation: map[string]*armcostmanagement.QueryAggregation{
				"totalCost": {
					Name:     to.Ptr("PreTaxCost"),
					Function: to.Ptr(armcostmanagement.FunctionTypeSum),
				},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityType("None")),
			Grouping: []*armcostmanagement.QueryGrouping{
				{
					Name: to.Ptr("ResourceGroup"),
					Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension),
				}},
		},
		Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("providers/Microsoft.Management/managementGroups/MyMgId/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("ResourceGroup"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("UsageDate"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(20.35941656262545),
	// 				"VSTSHOL-1595322048000",
	// 				float64(20180331),
	// 				"USD"},
	// 				[]any{
	// 					float64(173.41979241290323),
	// 					"RVIIOT-TRIAL",
	// 					float64(20180331),
	// 					"USD"},
	// 					[]any{
	// 						float64(19.545363672276512),
	// 						"JapanUnifia-Trial",
	// 						float64(20180331),
	// 						"USD"}},
	// 					},
	// 				}
}
Output:

Example (ManagementGroupQueryLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ManagementGroupQuery.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Management/managementGroups/MyMgId", armcostmanagement.QueryDefinition{
		Type: to.Ptr(armcostmanagement.ExportTypeUsage),
		Dataset: &armcostmanagement.QueryDataset{
			Filter: &armcostmanagement.QueryFilter{
				And: []*armcostmanagement.QueryFilter{
					{
						Or: []*armcostmanagement.QueryFilter{
							{
								Dimensions: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("ResourceLocation"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("East US"),
										to.Ptr("West Europe")},
								},
							},
							{
								Tags: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("Environment"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("UAT"),
										to.Ptr("Prod")},
								},
							}},
					},
					{
						Dimensions: &armcostmanagement.QueryComparisonExpression{
							Name:     to.Ptr("ResourceGroup"),
							Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
							Values: []*string{
								to.Ptr("API")},
						},
					}},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
		},
		Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("providers/Microsoft.Management/managementGroups/MyMgId/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("ResourceGroup"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("UsageDate"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(19.545363672276512),
	// 				"JapanUnifia-Trial",
	// 				float64(20180331),
	// 				"USD"},
	// 				[]any{
	// 					float64(173.41979241290323),
	// 					"RVIIOT-TRIAL",
	// 					float64(20180331),
	// 					"USD"},
	// 					[]any{
	// 						float64(20.35941656262545),
	// 						"VSTSHOL-1595322048000",
	// 						float64(20180331),
	// 						"USD"},
	// 						[]any{
	// 							float64(0.16677720329728665),
	// 							"gs-stms-dev",
	// 							float64(20180331),
	// 							"USD"}},
	// 						},
	// 					}
}
Output:

Example (ResourceGroupQueryGroupingLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ResourceGroupQueryGrouping.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewQueryClient().Usage(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", armcostmanagement.QueryDefinition{
		Type: to.Ptr(armcostmanagement.ExportTypeUsage),
		Dataset: &armcostmanagement.QueryDataset{
			Aggregation: map[string]*armcostmanagement.QueryAggregation{
				"totalCost": {
					Name:     to.Ptr("PreTaxCost"),
					Function: to.Ptr(armcostmanagement.FunctionTypeSum),
				},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
			Grouping: []*armcostmanagement.QueryGrouping{
				{
					Name: to.Ptr("ResourceType"),
					Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension),
				}},
		},
		Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("9af9459d-441d-4055-9ed0-83d4c4a363fb"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ScreenSharingTest-peer/providers/Microsoft.CostManagement/Query/9af9459d-441d-4055-9ed0-83d4c4a363fb"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("ResourceType"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("UsageDate"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(2.10333307059661),
	// 				"Microsoft.SqlServer",
	// 				float64(20180417),
	// 				"USD"},
	// 				[]any{
	// 					float64(20.10333307059661),
	// 					"Microsoft.Compute",
	// 					float64(20180418),
	// 					"USD"}},
	// 				},
	// 			}
}
Output:

Example (ResourceGroupQueryLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ResourceGroupQuery.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewQueryClient().Usage(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", armcostmanagement.QueryDefinition{
		Type: to.Ptr(armcostmanagement.ExportTypeUsage),
		Dataset: &armcostmanagement.QueryDataset{
			Filter: &armcostmanagement.QueryFilter{
				And: []*armcostmanagement.QueryFilter{
					{
						Or: []*armcostmanagement.QueryFilter{
							{
								Dimensions: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("ResourceLocation"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("East US"),
										to.Ptr("West Europe")},
								},
							},
							{
								Tags: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("Environment"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("UAT"),
										to.Ptr("Prod")},
								},
							}},
					},
					{
						Dimensions: &armcostmanagement.QueryComparisonExpression{
							Name:     to.Ptr("ResourceGroup"),
							Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
							Values: []*string{
								to.Ptr("API")},
						},
					}},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
		},
		Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("9af9459d-441d-4055-9ed0-83d4c4a363fb"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("subscriptions/55312978-ba1b-415c-9304-c4b9c43c0481/resourcegroups/ScreenSharingTest-peer/providers/Microsoft.CostManagement/Query/9af9459d-441d-4055-9ed0-83d4c4a363fb"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("ResourceGroup"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("UsageDate"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(2.10333307059661),
	// 				"ScreenSharingTest-peer",
	// 				float64(20180417),
	// 				"USD"},
	// 				[]any{
	// 					float64(20.10333307059661),
	// 					"ScreenSharingTest-peer",
	// 					float64(20180418),
	// 					"USD"}},
	// 				},
	// 			}
}
Output:

Example (SubscriptionQueryGroupingLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/SubscriptionQueryGrouping.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewQueryClient().Usage(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", armcostmanagement.QueryDefinition{
		Type: to.Ptr(armcostmanagement.ExportTypeUsage),
		Dataset: &armcostmanagement.QueryDataset{
			Aggregation: map[string]*armcostmanagement.QueryAggregation{
				"totalCost": {
					Name:     to.Ptr("PreTaxCost"),
					Function: to.Ptr(armcostmanagement.FunctionTypeSum),
				},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityType("None")),
			Grouping: []*armcostmanagement.QueryGrouping{
				{
					Name: to.Ptr("ResourceGroup"),
					Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension),
				}},
		},
		Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("55312978-ba1b-415c-9304-cfd9c43c0481"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/Query/00000000-0000-0000-0000-000000000000"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("ResourceGroup"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(0.009865586851323632),
	// 				"Ict_StratAndPlan_GoldSprova_Prod_0",
	// 				"USD"},
	// 				[]any{
	// 					float64(218.68795741935486),
	// 					"Ict_StratAndPlan_GoldSprova_Prod_1",
	// 					"USD"},
	// 					[]any{
	// 						float64(2.10333307059661),
	// 						"ScreenSharingTest-peer1",
	// 						"USD"},
	// 						[]any{
	// 							float64(0.14384913581657052),
	// 							"Ssbciotelement01",
	// 							"USD"}},
	// 						},
	// 					}
}
Output:

Example (SubscriptionQueryLegacy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/SubscriptionQuery.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewQueryClient().Usage(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", armcostmanagement.QueryDefinition{
		Type: to.Ptr(armcostmanagement.ExportTypeUsage),
		Dataset: &armcostmanagement.QueryDataset{
			Filter: &armcostmanagement.QueryFilter{
				And: []*armcostmanagement.QueryFilter{
					{
						Or: []*armcostmanagement.QueryFilter{
							{
								Dimensions: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("ResourceLocation"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("East US"),
										to.Ptr("West Europe")},
								},
							},
							{
								Tags: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("Environment"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("UAT"),
										to.Ptr("Prod")},
								},
							}},
					},
					{
						Dimensions: &armcostmanagement.QueryComparisonExpression{
							Name:     to.Ptr("ResourceGroup"),
							Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
							Values: []*string{
								to.Ptr("API")},
						},
					}},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
		},
		Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("55312978-ba1b-415c-9304-cfd9c43c0481"),
	// 	Type: to.Ptr("microsoft.costmanagement/Query"),
	// 	ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/Query/00000000-0000-0000-0000-000000000000"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("ResourceGroup"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("UsageDate"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(2.10333307059661),
	// 				"ScreenSharingTest-peer",
	// 				float64(20180331),
	// 				"USD"},
	// 				[]any{
	// 					float64(218.68795741935486),
	// 					"Ict_StratAndPlan_GoldSprova_Prod",
	// 					float64(20180331),
	// 					"USD"},
	// 					[]any{
	// 						float64(0.14384913581657052),
	// 						"ssbciotelement01",
	// 						float64(20180401),
	// 						"USD"},
	// 						[]any{
	// 							float64(0.009865586851323632),
	// 							"ict_stratandplan_goldsprova_prod",
	// 							float64(20180429),
	// 							"USD"}},
	// 						},
	// 					}
}
Output:

func (*QueryClient) UsageByExternalCloudProviderType

func (client *QueryClient) UsageByExternalCloudProviderType(ctx context.Context, externalCloudProviderType ExternalCloudProviderType, externalCloudProviderID string, parameters QueryDefinition, options *QueryClientUsageByExternalCloudProviderTypeOptions) (QueryClientUsageByExternalCloudProviderTypeResponse, error)

UsageByExternalCloudProviderType - Query the usage data for external cloud provider type defined. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • externalCloudProviderType - The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account.
  • externalCloudProviderID - This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations.
  • parameters - Parameters supplied to the CreateOrUpdate Query Config operation.
  • options - QueryClientUsageByExternalCloudProviderTypeOptions contains the optional parameters for the QueryClient.UsageByExternalCloudProviderType method.
Example (ExternalBillingAccountQueryList)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalBillingAccountsQuery.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewQueryClient().UsageByExternalCloudProviderType(ctx, armcostmanagement.ExternalCloudProviderTypeExternalBillingAccounts, "100", armcostmanagement.QueryDefinition{
		Type: to.Ptr(armcostmanagement.ExportTypeUsage),
		Dataset: &armcostmanagement.QueryDataset{
			Filter: &armcostmanagement.QueryFilter{
				And: []*armcostmanagement.QueryFilter{
					{
						Or: []*armcostmanagement.QueryFilter{
							{
								Dimensions: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("ResourceLocation"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("East US"),
										to.Ptr("West Europe")},
								},
							},
							{
								Tags: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("Environment"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("UAT"),
										to.Ptr("Prod")},
								},
							}},
					},
					{
						Dimensions: &armcostmanagement.QueryComparisonExpression{
							Name:     to.Ptr("ResourceGroup"),
							Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
							Values: []*string{
								to.Ptr("API")},
						},
					}},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
		},
		Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("6dc7b06a-d90a-4df5-b655-ce6cf1c0814d"),
	// 	Type: to.Ptr("Microsoft.CostManagement/query"),
	// 	ID: to.Ptr("providers/Microsoft.CostManagement/externalBillingAccounts/100/query/6dc7b06a-d90a-4df5-b655-ce6cf1c0814d"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("ServiceName"),
	// 				Type: to.Ptr("String"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 			[]any{
	// 				float64(0),
	// 				"abc db",
	// 				"USD"},
	// 				[]any{
	// 					float64(30.2572751438),
	// 					"abc compute cloud",
	// 					"USD"},
	// 					[]any{
	// 						float64(0.07675760200000002),
	// 						"abc file system",
	// 						"USD"},
	// 						[]any{
	// 							float64(50.43096419040001),
	// 							"abc elasticache",
	// 							"USD"}},
	// 						},
	// 					}
}
Output:

Example (ExternalSubscriptionsQuery)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalSubscriptionsQuery.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewQueryClient().UsageByExternalCloudProviderType(ctx, armcostmanagement.ExternalCloudProviderTypeExternalSubscriptions, "100", armcostmanagement.QueryDefinition{
		Type: to.Ptr(armcostmanagement.ExportTypeUsage),
		Dataset: &armcostmanagement.QueryDataset{
			Filter: &armcostmanagement.QueryFilter{
				And: []*armcostmanagement.QueryFilter{
					{
						Or: []*armcostmanagement.QueryFilter{
							{
								Dimensions: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("ResourceLocation"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("East US"),
										to.Ptr("West Europe")},
								},
							},
							{
								Tags: &armcostmanagement.QueryComparisonExpression{
									Name:     to.Ptr("Environment"),
									Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
									Values: []*string{
										to.Ptr("UAT"),
										to.Ptr("Prod")},
								},
							}},
					},
					{
						Dimensions: &armcostmanagement.QueryComparisonExpression{
							Name:     to.Ptr("ResourceGroup"),
							Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn),
							Values: []*string{
								to.Ptr("API")},
						},
					}},
			},
			Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily),
		},
		Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.QueryResult = armcostmanagement.QueryResult{
	// 	Name: to.Ptr("d99477af-7510-40ee-aca2-e59bdca0d10d"),
	// 	Type: to.Ptr("Microsoft.CostManagement/query"),
	// 	ID: to.Ptr("providers/Microsoft.CostManagement/externalSubscriptions/100/query/d99477af-7510-40ee-aca2-e59bdca0d10d"),
	// 	Properties: &armcostmanagement.QueryProperties{
	// 		Columns: []*armcostmanagement.QueryColumn{
	// 			{
	// 				Name: to.Ptr("PreTaxCost"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("UsageDate"),
	// 				Type: to.Ptr("Number"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Currency"),
	// 				Type: to.Ptr("String"),
	// 		}},
	// 		Rows: [][]any{
	// 		},
	// 	},
	// }
}
Output:

type QueryClientUsageByExternalCloudProviderTypeOptions added in v0.2.0

type QueryClientUsageByExternalCloudProviderTypeOptions struct {
}

QueryClientUsageByExternalCloudProviderTypeOptions contains the optional parameters for the QueryClient.UsageByExternalCloudProviderType method.

type QueryClientUsageByExternalCloudProviderTypeResponse added in v0.2.0

type QueryClientUsageByExternalCloudProviderTypeResponse struct {
	QueryResult
}

QueryClientUsageByExternalCloudProviderTypeResponse contains the response from method QueryClient.UsageByExternalCloudProviderType.

type QueryClientUsageOptions added in v0.2.0

type QueryClientUsageOptions struct {
}

QueryClientUsageOptions contains the optional parameters for the QueryClient.Usage method.

type QueryClientUsageResponse added in v0.2.0

type QueryClientUsageResponse struct {
	QueryResult
}

QueryClientUsageResponse contains the response from method QueryClient.Usage.

type QueryColumn

type QueryColumn struct {
	// The name of column.
	Name *string

	// The type of column.
	Type *string
}

QueryColumn properties

func (QueryColumn) MarshalJSON added in v1.1.0

func (q QueryColumn) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type QueryColumn.

func (*QueryColumn) UnmarshalJSON added in v1.1.0

func (q *QueryColumn) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type QueryColumn.

type QueryColumnType

type QueryColumnType string

QueryColumnType - The type of the column in the export.

const (
	QueryColumnTypeDimension QueryColumnType = "Dimension"
	QueryColumnTypeTag       QueryColumnType = "Tag"
)

func PossibleQueryColumnTypeValues

func PossibleQueryColumnTypeValues() []QueryColumnType

PossibleQueryColumnTypeValues returns the possible values for the QueryColumnType const type.

type QueryComparisonExpression

type QueryComparisonExpression struct {
	// REQUIRED; The name of the column to use in comparison.
	Name *string

	// REQUIRED; The operator to use for comparison.
	Operator *QueryOperatorType

	// REQUIRED; Array of values to use for comparison
	Values []*string
}

QueryComparisonExpression - The comparison expression to be used in the query.

func (QueryComparisonExpression) MarshalJSON

func (q QueryComparisonExpression) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type QueryComparisonExpression.

func (*QueryComparisonExpression) UnmarshalJSON added in v1.1.0

func (q *QueryComparisonExpression) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type QueryComparisonExpression.

type QueryDataset

type QueryDataset struct {
	// Dictionary of aggregation expression to use in the query. The key of each item in the dictionary is the alias for the aggregated
	// column. Query can have up to 2 aggregation clauses.
	Aggregation map[string]*QueryAggregation

	// Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping
	// are provided.
	Configuration *QueryDatasetConfiguration

	// The filter expression to use in the query. Please reference our Query API REST documentation for how to properly format
	// the filter.
	Filter *QueryFilter

	// The granularity of rows in the query.
	Granularity *GranularityType

	// Array of group by expression to use in the query. Query can have up to 2 group by clauses.
	Grouping []*QueryGrouping
}

QueryDataset - The definition of data present in the query.

func (QueryDataset) MarshalJSON

func (q QueryDataset) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type QueryDataset.

func (*QueryDataset) UnmarshalJSON added in v1.1.0

func (q *QueryDataset) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type QueryDataset.

type QueryDatasetConfiguration

type QueryDatasetConfiguration struct {
	// Array of column names to be included in the query. Any valid query column name is allowed. If not provided, then query
	// includes all columns.
	Columns []*string
}

QueryDatasetConfiguration - The configuration of dataset in the query.

func (QueryDatasetConfiguration) MarshalJSON

func (q QueryDatasetConfiguration) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type QueryDatasetConfiguration.

func (*QueryDatasetConfiguration) UnmarshalJSON added in v1.1.0

func (q *QueryDatasetConfiguration) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type QueryDatasetConfiguration.

type QueryDefinition

type QueryDefinition struct {
	// REQUIRED; Has definition for data in this query.
	Dataset *QueryDataset

	// REQUIRED; The time frame for pulling data for the query. If custom, then a specific time period must be provided.
	Timeframe *TimeframeType

	// REQUIRED; The type of the query.
	Type *ExportType

	// Has time period for pulling data for the query.
	TimePeriod *QueryTimePeriod
}

QueryDefinition - The definition of a query.

func (QueryDefinition) MarshalJSON added in v1.1.0

func (q QueryDefinition) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type QueryDefinition.

func (*QueryDefinition) UnmarshalJSON added in v1.1.0

func (q *QueryDefinition) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type QueryDefinition.

type QueryFilter

type QueryFilter struct {
	// The logical "AND" expression. Must have at least 2 items.
	And []*QueryFilter

	// Has comparison expression for a dimension
	Dimensions *QueryComparisonExpression

	// The logical "OR" expression. Must have at least 2 items.
	Or []*QueryFilter

	// Has comparison expression for a tag
	Tags *QueryComparisonExpression
}

QueryFilter - The filter expression to be used in the export.

func (QueryFilter) MarshalJSON

func (q QueryFilter) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type QueryFilter.

func (*QueryFilter) UnmarshalJSON added in v1.1.0

func (q *QueryFilter) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type QueryFilter.

type QueryGrouping

type QueryGrouping struct {
	// REQUIRED; The name of the column to group.
	Name *string

	// REQUIRED; Has type of the column to group.
	Type *QueryColumnType
}

QueryGrouping - The group by expression to be used in the query.

func (QueryGrouping) MarshalJSON added in v1.1.0

func (q QueryGrouping) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type QueryGrouping.

func (*QueryGrouping) UnmarshalJSON added in v1.1.0

func (q *QueryGrouping) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type QueryGrouping.

type QueryOperatorType

type QueryOperatorType string

QueryOperatorType - The operator to use for comparison.

const (
	QueryOperatorTypeIn QueryOperatorType = "In"
)

func PossibleQueryOperatorTypeValues

func PossibleQueryOperatorTypeValues() []QueryOperatorType

PossibleQueryOperatorTypeValues returns the possible values for the QueryOperatorType const type.

type QueryProperties

type QueryProperties struct {
	// Array of columns
	Columns []*QueryColumn

	// The link (url) to the next page of results.
	NextLink *string

	// Array of rows
	Rows [][]any
}

QueryProperties - Query properties

func (QueryProperties) MarshalJSON

func (q QueryProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type QueryProperties.

func (*QueryProperties) UnmarshalJSON added in v1.1.0

func (q *QueryProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type QueryProperties.

type QueryResult

type QueryResult struct {
	// Query properties
	Properties *QueryProperties

	// READ-ONLY; ETag of the resource.
	ETag *string

	// READ-ONLY; Resource Id.
	ID *string

	// READ-ONLY; Location of the resource.
	Location *string

	// READ-ONLY; Resource name.
	Name *string

	// READ-ONLY; SKU of the resource.
	SKU *string

	// READ-ONLY; Resource tags.
	Tags map[string]*string

	// READ-ONLY; Resource type.
	Type *string
}

QueryResult - Result of query. It contains all columns listed under groupings and aggregation.

func (QueryResult) MarshalJSON

func (q QueryResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type QueryResult.

func (*QueryResult) UnmarshalJSON added in v1.1.0

func (q *QueryResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type QueryResult.

type QueryTimePeriod

type QueryTimePeriod struct {
	// REQUIRED; The start date to pull data from.
	From *time.Time

	// REQUIRED; The end date to pull data to.
	To *time.Time
}

QueryTimePeriod - The start and end date for pulling data for the query.

func (QueryTimePeriod) MarshalJSON

func (q QueryTimePeriod) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type QueryTimePeriod.

func (*QueryTimePeriod) UnmarshalJSON

func (q *QueryTimePeriod) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type QueryTimePeriod.

type RecurrenceType

type RecurrenceType string

RecurrenceType - The schedule recurrence.

const (
	RecurrenceTypeAnnually RecurrenceType = "Annually"
	RecurrenceTypeDaily    RecurrenceType = "Daily"
	RecurrenceTypeMonthly  RecurrenceType = "Monthly"
	RecurrenceTypeWeekly   RecurrenceType = "Weekly"
)

func PossibleRecurrenceTypeValues

func PossibleRecurrenceTypeValues() []RecurrenceType

PossibleRecurrenceTypeValues returns the possible values for the RecurrenceType const type.

type ReportConfigAggregation

type ReportConfigAggregation struct {
	// REQUIRED; The name of the aggregation function to use.
	Function *FunctionType

	// REQUIRED; The name of the column to aggregate.
	Name *string
}

ReportConfigAggregation - The aggregation expression to be used in the report.

func (ReportConfigAggregation) MarshalJSON added in v1.1.0

func (r ReportConfigAggregation) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ReportConfigAggregation.

func (*ReportConfigAggregation) UnmarshalJSON added in v1.1.0

func (r *ReportConfigAggregation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigAggregation.

type ReportConfigColumnType

type ReportConfigColumnType string

ReportConfigColumnType - The type of the column in the report.

const (
	ReportConfigColumnTypeDimension ReportConfigColumnType = "Dimension"
	ReportConfigColumnTypeTag       ReportConfigColumnType = "Tag"
)

func PossibleReportConfigColumnTypeValues

func PossibleReportConfigColumnTypeValues() []ReportConfigColumnType

PossibleReportConfigColumnTypeValues returns the possible values for the ReportConfigColumnType const type.

type ReportConfigComparisonExpression

type ReportConfigComparisonExpression struct {
	// REQUIRED; The name of the column to use in comparison.
	Name *string

	// REQUIRED; The operator to use for comparison.
	Operator *OperatorType

	// REQUIRED; Array of values to use for comparison
	Values []*string
}

ReportConfigComparisonExpression - The comparison expression to be used in the report.

func (ReportConfigComparisonExpression) MarshalJSON

func (r ReportConfigComparisonExpression) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ReportConfigComparisonExpression.

func (*ReportConfigComparisonExpression) UnmarshalJSON added in v1.1.0

func (r *ReportConfigComparisonExpression) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigComparisonExpression.

type ReportConfigDataset

type ReportConfigDataset struct {
	// Dictionary of aggregation expression to use in the report. The key of each item in the dictionary is the alias for the
	// aggregated column. Report can have up to 2 aggregation clauses.
	Aggregation map[string]*ReportConfigAggregation

	// Has configuration information for the data in the report. The configuration will be ignored if aggregation and grouping
	// are provided.
	Configuration *ReportConfigDatasetConfiguration

	// Has filter expression to use in the report.
	Filter *ReportConfigFilter

	// The granularity of rows in the report.
	Granularity *ReportGranularityType

	// Array of group by expression to use in the report. Report can have up to 2 group by clauses.
	Grouping []*ReportConfigGrouping

	// Array of order by expression to use in the report.
	Sorting []*ReportConfigSorting
}

ReportConfigDataset - The definition of data present in the report.

func (ReportConfigDataset) MarshalJSON

func (r ReportConfigDataset) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ReportConfigDataset.

func (*ReportConfigDataset) UnmarshalJSON added in v1.1.0

func (r *ReportConfigDataset) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigDataset.

type ReportConfigDatasetConfiguration

type ReportConfigDatasetConfiguration struct {
	// Array of column names to be included in the report. Any valid report column name is allowed. If not provided, then report
	// includes all columns.
	Columns []*string
}

ReportConfigDatasetConfiguration - The configuration of dataset in the report.

func (ReportConfigDatasetConfiguration) MarshalJSON

func (r ReportConfigDatasetConfiguration) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ReportConfigDatasetConfiguration.

func (*ReportConfigDatasetConfiguration) UnmarshalJSON added in v1.1.0

func (r *ReportConfigDatasetConfiguration) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigDatasetConfiguration.

type ReportConfigDefinition

type ReportConfigDefinition struct {
	// REQUIRED; The time frame for pulling data for the report. If custom, then a specific time period must be provided.
	Timeframe *ReportTimeframeType

	// REQUIRED; The type of the report. Usage represents actual usage, forecast represents forecasted data and UsageAndForecast
	// represents both usage and forecasted data. Actual usage and forecasted data can be
	// differentiated based on dates.
	Type *ReportType

	// Has definition for data in this report config.
	DataSet *ReportConfigDataset

	// If true, report includes monetary commitment.
	IncludeMonetaryCommitment *bool

	// Has time period for pulling data for the report.
	TimePeriod *ReportConfigTimePeriod
}

ReportConfigDefinition - The definition of a report config.

func (ReportConfigDefinition) MarshalJSON added in v1.1.0

func (r ReportConfigDefinition) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ReportConfigDefinition.

func (*ReportConfigDefinition) UnmarshalJSON added in v1.1.0

func (r *ReportConfigDefinition) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigDefinition.

type ReportConfigFilter

type ReportConfigFilter struct {
	// The logical "AND" expression. Must have at least 2 items.
	And []*ReportConfigFilter

	// Has comparison expression for a dimension
	Dimensions *ReportConfigComparisonExpression

	// The logical "OR" expression. Must have at least 2 items.
	Or []*ReportConfigFilter

	// Has comparison expression for a tag
	Tags *ReportConfigComparisonExpression
}

ReportConfigFilter - The filter expression to be used in the report.

func (ReportConfigFilter) MarshalJSON

func (r ReportConfigFilter) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ReportConfigFilter.

func (*ReportConfigFilter) UnmarshalJSON added in v1.1.0

func (r *ReportConfigFilter) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigFilter.

type ReportConfigGrouping

type ReportConfigGrouping struct {
	// REQUIRED; The name of the column to group. This version supports subscription lowest possible grain.
	Name *string

	// REQUIRED; Has type of the column to group.
	Type *ReportConfigColumnType
}

ReportConfigGrouping - The group by expression to be used in the report.

func (ReportConfigGrouping) MarshalJSON added in v1.1.0

func (r ReportConfigGrouping) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ReportConfigGrouping.

func (*ReportConfigGrouping) UnmarshalJSON added in v1.1.0

func (r *ReportConfigGrouping) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigGrouping.

type ReportConfigSorting

type ReportConfigSorting struct {
	// REQUIRED; The name of the column to sort.
	Name *string

	// Direction of sort.
	Direction *ReportConfigSortingType
}

ReportConfigSorting - The order by expression to be used in the report.

func (ReportConfigSorting) MarshalJSON added in v1.1.0

func (r ReportConfigSorting) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ReportConfigSorting.

func (*ReportConfigSorting) UnmarshalJSON added in v1.1.0

func (r *ReportConfigSorting) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigSorting.

type ReportConfigSortingType added in v0.3.0

type ReportConfigSortingType string

ReportConfigSortingType - Direction of sort.

const (
	ReportConfigSortingTypeAscending  ReportConfigSortingType = "Ascending"
	ReportConfigSortingTypeDescending ReportConfigSortingType = "Descending"
)

func PossibleReportConfigSortingTypeValues added in v0.3.0

func PossibleReportConfigSortingTypeValues() []ReportConfigSortingType

PossibleReportConfigSortingTypeValues returns the possible values for the ReportConfigSortingType const type.

type ReportConfigTimePeriod

type ReportConfigTimePeriod struct {
	// REQUIRED; The start date to pull data from.
	From *time.Time

	// REQUIRED; The end date to pull data to.
	To *time.Time
}

ReportConfigTimePeriod - The start and end date for pulling data for the report.

func (ReportConfigTimePeriod) MarshalJSON

func (r ReportConfigTimePeriod) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ReportConfigTimePeriod.

func (*ReportConfigTimePeriod) UnmarshalJSON

func (r *ReportConfigTimePeriod) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigTimePeriod.

type ReportGranularityType

type ReportGranularityType string

ReportGranularityType - The granularity of rows in the report.

const (
	ReportGranularityTypeDaily   ReportGranularityType = "Daily"
	ReportGranularityTypeMonthly ReportGranularityType = "Monthly"
)

func PossibleReportGranularityTypeValues

func PossibleReportGranularityTypeValues() []ReportGranularityType

PossibleReportGranularityTypeValues returns the possible values for the ReportGranularityType const type.

type ReportOperationStatusType added in v0.3.0

type ReportOperationStatusType string

ReportOperationStatusType - The status of the long running operation.

const (
	ReportOperationStatusTypeCompleted       ReportOperationStatusType = "Completed"
	ReportOperationStatusTypeFailed          ReportOperationStatusType = "Failed"
	ReportOperationStatusTypeInProgress      ReportOperationStatusType = "InProgress"
	ReportOperationStatusTypeNoDataFound     ReportOperationStatusType = "NoDataFound"
	ReportOperationStatusTypeQueued          ReportOperationStatusType = "Queued"
	ReportOperationStatusTypeReadyToDownload ReportOperationStatusType = "ReadyToDownload"
	ReportOperationStatusTypeTimedOut        ReportOperationStatusType = "TimedOut"
)

func PossibleReportOperationStatusTypeValues added in v0.3.0

func PossibleReportOperationStatusTypeValues() []ReportOperationStatusType

PossibleReportOperationStatusTypeValues returns the possible values for the ReportOperationStatusType const type.

type ReportTimeframeType

type ReportTimeframeType string

ReportTimeframeType - The time frame for pulling data for the report. If custom, then a specific time period must be provided.

const (
	ReportTimeframeTypeCustom      ReportTimeframeType = "Custom"
	ReportTimeframeTypeMonthToDate ReportTimeframeType = "MonthToDate"
	ReportTimeframeTypeWeekToDate  ReportTimeframeType = "WeekToDate"
	ReportTimeframeTypeYearToDate  ReportTimeframeType = "YearToDate"
)

func PossibleReportTimeframeTypeValues

func PossibleReportTimeframeTypeValues() []ReportTimeframeType

PossibleReportTimeframeTypeValues returns the possible values for the ReportTimeframeType const type.

type ReportType

type ReportType string

ReportType - The type of the report. Usage represents actual usage, forecast represents forecasted data and UsageAndForecast represents both usage and forecasted data. Actual usage and forecasted data can be differentiated based on dates.

const (
	ReportTypeUsage ReportType = "Usage"
)

func PossibleReportTypeValues

func PossibleReportTypeValues() []ReportType

PossibleReportTypeValues returns the possible values for the ReportType const type.

type ReportURL added in v0.3.0

type ReportURL struct {
	// The CSV file from the reportUrl blob link consists of reservation usage data with the following schema at daily granularity
	ReportURL *ReservationReportSchema

	// The time at which report URL becomes invalid.
	ValidUntil *time.Time
}

ReportURL - The URL to download the generated report.

func (ReportURL) MarshalJSON added in v0.3.0

func (r ReportURL) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ReportURL.

func (*ReportURL) UnmarshalJSON added in v0.3.0

func (r *ReportURL) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ReportURL.

type ReservationReportSchema added in v1.0.0

type ReservationReportSchema string

ReservationReportSchema - The CSV file from the reportUrl blob link consists of reservation usage data with the following schema at daily granularity

const (
	ReservationReportSchemaInstanceFlexibilityGroup ReservationReportSchema = "InstanceFlexibilityGroup"
	ReservationReportSchemaInstanceFlexibilityRatio ReservationReportSchema = "InstanceFlexibilityRatio"
	ReservationReportSchemaInstanceID               ReservationReportSchema = "InstanceId"
	ReservationReportSchemaKind                     ReservationReportSchema = "Kind"
	ReservationReportSchemaReservationID            ReservationReportSchema = "ReservationId"
	ReservationReportSchemaReservationOrderID       ReservationReportSchema = "ReservationOrderId"
	ReservationReportSchemaReservedHours            ReservationReportSchema = "ReservedHours"
	ReservationReportSchemaSKUName                  ReservationReportSchema = "SkuName"
	ReservationReportSchemaTotalReservedQuantity    ReservationReportSchema = "TotalReservedQuantity"
	ReservationReportSchemaUsageDate                ReservationReportSchema = "UsageDate"
	ReservationReportSchemaUsedHours                ReservationReportSchema = "UsedHours"
)

func PossibleReservationReportSchemaValues added in v1.0.0

func PossibleReservationReportSchemaValues() []ReservationReportSchema

PossibleReservationReportSchemaValues returns the possible values for the ReservationReportSchema const type.

type Resource

type Resource struct {
	// READ-ONLY; ETag of the resource.
	ETag *string

	// READ-ONLY; Resource Id.
	ID *string

	// READ-ONLY; Location of the resource.
	Location *string

	// READ-ONLY; Resource name.
	Name *string

	// READ-ONLY; SKU of the resource.
	SKU *string

	// READ-ONLY; Resource tags.
	Tags map[string]*string

	// READ-ONLY; Resource type.
	Type *string
}

Resource - The Resource model definition.

func (Resource) MarshalJSON

func (r Resource) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Resource.

func (*Resource) UnmarshalJSON added in v1.1.0

func (r *Resource) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Resource.

type Status

type Status struct {
	// The status of the long running operation.
	Status *ReportOperationStatusType
}

Status - The status of the long running operation.

func (Status) MarshalJSON added in v1.1.0

func (s Status) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Status.

func (*Status) UnmarshalJSON added in v1.1.0

func (s *Status) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Status.

type StatusType

type StatusType string

StatusType - The status of the export's schedule. If 'Inactive', the export's schedule is paused.

const (
	StatusTypeActive   StatusType = "Active"
	StatusTypeInactive StatusType = "Inactive"
)

func PossibleStatusTypeValues

func PossibleStatusTypeValues() []StatusType

PossibleStatusTypeValues returns the possible values for the StatusType const type.

type TimeframeType

type TimeframeType string

TimeframeType - The time frame for pulling data for the export. If custom, then a specific time period must be provided.

const (
	TimeframeTypeBillingMonthToDate  TimeframeType = "BillingMonthToDate"
	TimeframeTypeCustom              TimeframeType = "Custom"
	TimeframeTypeMonthToDate         TimeframeType = "MonthToDate"
	TimeframeTypeTheLastBillingMonth TimeframeType = "TheLastBillingMonth"
	TimeframeTypeTheLastMonth        TimeframeType = "TheLastMonth"
	TimeframeTypeWeekToDate          TimeframeType = "WeekToDate"
)

func PossibleTimeframeTypeValues

func PossibleTimeframeTypeValues() []TimeframeType

PossibleTimeframeTypeValues returns the possible values for the TimeframeType const type.

type View

type View struct {
	// eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating
	// the latest version or not.
	ETag *string

	// The properties of the view.
	Properties *ViewProperties

	// READ-ONLY; Resource Id.
	ID *string

	// READ-ONLY; Resource name.
	Name *string

	// READ-ONLY; Resource type.
	Type *string
}

View - States and configurations of Cost Analysis.

func (View) MarshalJSON added in v1.1.0

func (v View) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type View.

func (*View) UnmarshalJSON added in v1.1.0

func (v *View) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type View.

type ViewListResult

type ViewListResult struct {
	// READ-ONLY; The link (url) to the next page of results.
	NextLink *string

	// READ-ONLY; The list of views.
	Value []*View
}

ViewListResult - Result of listing views. It contains a list of available views.

func (ViewListResult) MarshalJSON

func (v ViewListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ViewListResult.

func (*ViewListResult) UnmarshalJSON added in v1.1.0

func (v *ViewListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ViewListResult.

type ViewProperties

type ViewProperties struct {
	// Show costs accumulated over time.
	Accumulated *AccumulatedType

	// Chart type of the main view in Cost Analysis. Required.
	Chart *ChartType

	// User input name of the view. Required.
	DisplayName *string

	// List of KPIs to show in Cost Analysis UI.
	Kpis []*KpiProperties

	// Metric to use when displaying costs.
	Metric *MetricType

	// Configuration of 3 sub-views in the Cost Analysis UI.
	Pivots []*PivotProperties

	// Query body configuration. Required.
	Query *ReportConfigDefinition

	// Cost Management scope to save the view on. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'
	// for resourceGroup
	// scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
	// for
	// Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
	// for EnrollmentAccount scope,
	// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile
	// scope,
	// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection
	// scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for
	// Management Group scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for
	// ExternalBillingAccount scope, and
	// '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope.
	Scope *string

	// READ-ONLY; Date the user created this view.
	CreatedOn *time.Time

	// READ-ONLY; Currency of the current view.
	Currency *string

	// READ-ONLY; Date range of the current view.
	DateRange *string

	// READ-ONLY; Date when the user last modified this view.
	ModifiedOn *time.Time
}

ViewProperties - The properties of the view.

func (ViewProperties) MarshalJSON

func (v ViewProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ViewProperties.

func (*ViewProperties) UnmarshalJSON

func (v *ViewProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ViewProperties.

type ViewsClient

type ViewsClient struct {
	// contains filtered or unexported fields
}

ViewsClient contains the methods for the Views group. Don't use this type directly, use NewViewsClient() instead.

func NewViewsClient

func NewViewsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ViewsClient, error)

NewViewsClient creates a new instance of ViewsClient with the specified values.

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*ViewsClient) CreateOrUpdate

func (client *ViewsClient) CreateOrUpdate(ctx context.Context, viewName string, parameters View, options *ViewsClientCreateOrUpdateOptions) (ViewsClientCreateOrUpdateResponse, error)

CreateOrUpdate - The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • viewName - View name
  • parameters - Parameters supplied to the CreateOrUpdate View operation.
  • options - ViewsClientCreateOrUpdateOptions contains the optional parameters for the ViewsClient.CreateOrUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/PrivateViewCreateOrUpdate.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewViewsClient().CreateOrUpdate(ctx, "swaggerExample", armcostmanagement.View{
		ETag: to.Ptr("\"1d4ff9fe66f1d10\""),
		Properties: &armcostmanagement.ViewProperties{
			Accumulated: to.Ptr(armcostmanagement.AccumulatedTypeTrue),
			Chart:       to.Ptr(armcostmanagement.ChartTypeTable),
			DisplayName: to.Ptr("swagger Example"),
			Kpis: []*armcostmanagement.KpiProperties{
				{
					Type:    to.Ptr(armcostmanagement.KpiTypeForecast),
					Enabled: to.Ptr(true),
				},
				{
					Type:    to.Ptr(armcostmanagement.KpiTypeBudget),
					Enabled: to.Ptr(true),
					ID:      to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo"),
				}},
			Metric: to.Ptr(armcostmanagement.MetricTypeActualCost),
			Pivots: []*armcostmanagement.PivotProperties{
				{
					Name: to.Ptr("ServiceName"),
					Type: to.Ptr(armcostmanagement.PivotTypeDimension),
				},
				{
					Name: to.Ptr("MeterCategory"),
					Type: to.Ptr(armcostmanagement.PivotTypeDimension),
				},
				{
					Name: to.Ptr("swaggerTagKey"),
					Type: to.Ptr(armcostmanagement.PivotTypeTagKey),
				}},
			Query: &armcostmanagement.ReportConfigDefinition{
				Type: to.Ptr(armcostmanagement.ReportTypeUsage),
				DataSet: &armcostmanagement.ReportConfigDataset{
					Aggregation: map[string]*armcostmanagement.ReportConfigAggregation{
						"totalCost": {
							Name:     to.Ptr("PreTaxCost"),
							Function: to.Ptr(armcostmanagement.FunctionTypeSum),
						},
					},
					Granularity: to.Ptr(armcostmanagement.ReportGranularityTypeDaily),
					Grouping:    []*armcostmanagement.ReportConfigGrouping{},
					Sorting: []*armcostmanagement.ReportConfigSorting{
						{
							Name:      to.Ptr("UsageDate"),
							Direction: to.Ptr(armcostmanagement.ReportConfigSortingTypeAscending),
						}},
				},
				Timeframe: to.Ptr(armcostmanagement.ReportTimeframeTypeMonthToDate),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.View = armcostmanagement.View{
	// 	Name: to.Ptr("swaggerExample"),
	// 	Type: to.Ptr("Microsoft.CostManagement/Views"),
	// 	ETag: to.Ptr("\"1d4ffa5a9c2430c\""),
	// 	ID: to.Ptr("/providers/Microsoft.CostManagement/views/swaggerExample"),
	// 	Properties: &armcostmanagement.ViewProperties{
	// 		Accumulated: to.Ptr(armcostmanagement.AccumulatedTypeTrue),
	// 		Chart: to.Ptr(armcostmanagement.ChartTypeTable),
	// 		DisplayName: to.Ptr("swagger Example"),
	// 		Kpis: []*armcostmanagement.KpiProperties{
	// 			{
	// 				Type: to.Ptr(armcostmanagement.KpiTypeForecast),
	// 				Enabled: to.Ptr(true),
	// 			},
	// 			{
	// 				Type: to.Ptr(armcostmanagement.KpiTypeBudget),
	// 				Enabled: to.Ptr(true),
	// 				ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo"),
	// 		}},
	// 		Metric: to.Ptr(armcostmanagement.MetricTypeActualCost),
	// 		Pivots: []*armcostmanagement.PivotProperties{
	// 			{
	// 				Name: to.Ptr("ServiceName"),
	// 				Type: to.Ptr(armcostmanagement.PivotTypeDimension),
	// 			},
	// 			{
	// 				Name: to.Ptr("MeterCategory"),
	// 				Type: to.Ptr(armcostmanagement.PivotTypeDimension),
	// 			},
	// 			{
	// 				Name: to.Ptr("swaggerTagKey"),
	// 				Type: to.Ptr(armcostmanagement.PivotTypeTagKey),
	// 		}},
	// 		Query: &armcostmanagement.ReportConfigDefinition{
	// 			Type: to.Ptr(armcostmanagement.ReportTypeUsage),
	// 			DataSet: &armcostmanagement.ReportConfigDataset{
	// 				Aggregation: map[string]*armcostmanagement.ReportConfigAggregation{
	// 					"totalCost": &armcostmanagement.ReportConfigAggregation{
	// 						Name: to.Ptr("PreTaxCost"),
	// 						Function: to.Ptr(armcostmanagement.FunctionTypeSum),
	// 					},
	// 				},
	// 				Granularity: to.Ptr(armcostmanagement.ReportGranularityTypeDaily),
	// 				Grouping: []*armcostmanagement.ReportConfigGrouping{
	// 				},
	// 				Sorting: []*armcostmanagement.ReportConfigSorting{
	// 					{
	// 						Name: to.Ptr("UsageDate"),
	// 						Direction: to.Ptr(armcostmanagement.ReportConfigSortingTypeAscending),
	// 				}},
	// 			},
	// 			Timeframe: to.Ptr(armcostmanagement.ReportTimeframeTypeMonthToDate),
	// 		},
	// 		Scope: to.Ptr(""),
	// 	},
	// }
}
Output:

func (*ViewsClient) CreateOrUpdateByScope

func (client *ViewsClient) CreateOrUpdateByScope(ctx context.Context, scope string, viewName string, parameters View, options *ViewsClientCreateOrUpdateByScopeOptions) (ViewsClientCreateOrUpdateByScopeResponse, error)

CreateOrUpdateByScope - The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • scope - The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope.
  • viewName - View name
  • parameters - Parameters supplied to the CreateOrUpdate View operation.
  • options - ViewsClientCreateOrUpdateByScopeOptions contains the optional parameters for the ViewsClient.CreateOrUpdateByScope method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ViewCreateOrUpdateByResourceGroup.json

package main

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/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewViewsClient().CreateOrUpdateByScope(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", "swaggerExample", armcostmanagement.View{
		ETag: to.Ptr("\"1d4ff9fe66f1d10\""),
		Properties: &armcostmanagement.ViewProperties{
			Accumulated: to.Ptr(armcostmanagement.AccumulatedTypeTrue),
			Chart:       to.Ptr(armcostmanagement.ChartTypeTable),
			DisplayName: to.Ptr("swagger Example"),
			Kpis: []*armcostmanagement.KpiProperties{
				{
					Type:    to.Ptr(armcostmanagement.KpiTypeForecast),
					Enabled: to.Ptr(true),
				},
				{
					Type:    to.Ptr(armcostmanagement.KpiTypeBudget),
					Enabled: to.Ptr(true),
					ID:      to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo"),
				}},
			Metric: to.Ptr(armcostmanagement.MetricTypeActualCost),
			Pivots: []*armcostmanagement.PivotProperties{
				{
					Name: to.Ptr("ServiceName"),
					Type: to.Ptr(armcostmanagement.PivotTypeDimension),
				},
				{
					Name: to.Ptr("MeterCategory"),
					Type: to.Ptr(armcostmanagement.PivotTypeDimension),
				},
				{
					Name: to.Ptr("swaggerTagKey"),
					Type: to.Ptr(armcostmanagement.PivotTypeTagKey),
				}},
			Query: &armcostmanagement.ReportConfigDefinition{
				Type: to.Ptr(armcostmanagement.ReportTypeUsage),
				DataSet: &armcostmanagement.ReportConfigDataset{
					Aggregation: map[string]*armcostmanagement.ReportConfigAggregation{
						"totalCost": {
							Name:     to.Ptr("PreTaxCost"),
							Function: to.Ptr(armcostmanagement.FunctionTypeSum),
						},
					},
					Granularity: to.Ptr(armcostmanagement.ReportGranularityTypeDaily),
					Grouping:    []*armcostmanagement.ReportConfigGrouping{},
					Sorting: []*armcostmanagement.ReportConfigSorting{
						{
							Name:      to.Ptr("UsageDate"),
							Direction: to.Ptr(armcostmanagement.ReportConfigSortingTypeAscending),
						}},
				},
				Timeframe: to.Ptr(armcostmanagement.ReportTimeframeTypeMonthToDate),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.View = armcostmanagement.View{
	// 	Name: to.Ptr("swaggerExample"),
	// 	Type: to.Ptr("Microsoft.CostManagement/Views"),
	// 	ETag: to.Ptr("\"1d4ffa5a9c2430c\""),
	// 	ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/views/swaggerExample"),
	// 	Properties: &armcostmanagement.ViewProperties{
	// 		Accumulated: to.Ptr(armcostmanagement.AccumulatedTypeTrue),
	// 		Chart: to.Ptr(armcostmanagement.ChartTypeTable),
	// 		DisplayName: to.Ptr("swagger Example"),
	// 		Kpis: []*armcostmanagement.KpiProperties{
	// 			{
	// 				Type: to.Ptr(armcostmanagement.KpiTypeForecast),
	// 				Enabled: to.Ptr(true),
	// 			},
	// 			{
	// 				Type: to.Ptr(armcostmanagement.KpiTypeBudget),
	// 				Enabled: to.Ptr(true),
	// 				ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo"),
	// 		}},
	// 		Metric: to.Ptr(armcostmanagement.MetricTypeActualCost),
	// 		Pivots: []*armcostmanagement.PivotProperties{
	// 			{
	// 				Name: to.Ptr("ServiceName"),
	// 				Type: to.Ptr(armcostmanagement.PivotTypeDimension),
	// 			},
	// 			{
	// 				Name: to.Ptr("MeterCategory"),
	// 				Type: to.Ptr(armcostmanagement.PivotTypeDimension),
	// 			},
	// 			{
	// 				Name: to.Ptr("swaggerTagKey"),
	// 				Type: to.Ptr(armcostmanagement.PivotTypeTagKey),
	// 		}},
	// 		Query: &armcostmanagement.ReportConfigDefinition{
	// 			Type: to.Ptr(armcostmanagement.ReportTypeUsage),
	// 			DataSet: &armcostmanagement.ReportConfigDataset{
	// 				Aggregation: map[string]*armcostmanagement.ReportConfigAggregation{
	// 					"totalCost": &armcostmanagement.ReportConfigAggregation{
	// 						Name: to.Ptr("PreTaxCost"),
	// 						Function: to.Ptr(armcostmanagement.FunctionTypeSum),
	// 					},
	// 				},
	// 				Granularity: to.Ptr(armcostmanagement.ReportGranularityTypeDaily),
	// 				Grouping: []*armcostmanagement.ReportConfigGrouping{
	// 				},
	// 				Sorting: []*armcostmanagement.ReportConfigSorting{
	// 					{
	// 						Name: to.Ptr("UsageDate"),
	// 						Direction: to.Ptr(armcostmanagement.ReportConfigSortingTypeAscending),
	// 				}},
	// 			},
	// 			Timeframe: to.Ptr(armcostmanagement.ReportTimeframeTypeMonthToDate),
	// 		},
	// 		Scope: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"),
	// 	},
	// }
}
Output:

func (*ViewsClient) Delete

func (client *ViewsClient) Delete(ctx context.Context, viewName string, options *ViewsClientDeleteOptions) (ViewsClientDeleteResponse, error)

Delete - The operation to delete a view. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • viewName - View name
  • options - ViewsClientDeleteOptions contains the optional parameters for the ViewsClient.Delete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/PrivateViewDelete.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewViewsClient().Delete(ctx, "TestView", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

func (*ViewsClient) DeleteByScope

func (client *ViewsClient) DeleteByScope(ctx context.Context, scope string, viewName string, options *ViewsClientDeleteByScopeOptions) (ViewsClientDeleteByScopeResponse, error)

DeleteByScope - The operation to delete a view. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • scope - The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope.
  • viewName - View name
  • options - ViewsClientDeleteByScopeOptions contains the optional parameters for the ViewsClient.DeleteByScope method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ViewDeleteByResourceGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewViewsClient().DeleteByScope(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", "TestView", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

func (*ViewsClient) Get

func (client *ViewsClient) Get(ctx context.Context, viewName string, options *ViewsClientGetOptions) (ViewsClientGetResponse, error)

Get - Gets the view by view name. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • viewName - View name
  • options - ViewsClientGetOptions contains the optional parameters for the ViewsClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/PrivateView.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewViewsClient().Get(ctx, "swaggerExample", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.View = armcostmanagement.View{
	// 	Name: to.Ptr("swaggerExample"),
	// 	Type: to.Ptr("Microsoft.CostManagement/Views"),
	// 	ETag: to.Ptr("\"1d4ff9fe66f1d10\""),
	// 	ID: to.Ptr("/providers/Microsoft.CostManagement/views/swaggerExample"),
	// 	Properties: &armcostmanagement.ViewProperties{
	// 		Accumulated: to.Ptr(armcostmanagement.AccumulatedTypeTrue),
	// 		Chart: to.Ptr(armcostmanagement.ChartTypeTable),
	// 		DisplayName: to.Ptr("swagger Example"),
	// 		Kpis: []*armcostmanagement.KpiProperties{
	// 			{
	// 				Type: to.Ptr(armcostmanagement.KpiTypeForecast),
	// 				Enabled: to.Ptr(true),
	// 			},
	// 			{
	// 				Type: to.Ptr(armcostmanagement.KpiTypeBudget),
	// 				Enabled: to.Ptr(true),
	// 				ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo"),
	// 		}},
	// 		Metric: to.Ptr(armcostmanagement.MetricTypeActualCost),
	// 		Pivots: []*armcostmanagement.PivotProperties{
	// 			{
	// 				Name: to.Ptr("ServiceName"),
	// 				Type: to.Ptr(armcostmanagement.PivotTypeDimension),
	// 			},
	// 			{
	// 				Name: to.Ptr("MeterCategory"),
	// 				Type: to.Ptr(armcostmanagement.PivotTypeDimension),
	// 			},
	// 			{
	// 				Name: to.Ptr("swaggerTagKey"),
	// 				Type: to.Ptr(armcostmanagement.PivotTypeTagKey),
	// 		}},
	// 		Query: &armcostmanagement.ReportConfigDefinition{
	// 			Type: to.Ptr(armcostmanagement.ReportTypeUsage),
	// 			DataSet: &armcostmanagement.ReportConfigDataset{
	// 				Aggregation: map[string]*armcostmanagement.ReportConfigAggregation{
	// 					"totalCost": &armcostmanagement.ReportConfigAggregation{
	// 						Name: to.Ptr("PreTaxCost"),
	// 						Function: to.Ptr(armcostmanagement.FunctionTypeSum),
	// 					},
	// 				},
	// 				Granularity: to.Ptr(armcostmanagement.ReportGranularityTypeDaily),
	// 				Grouping: []*armcostmanagement.ReportConfigGrouping{
	// 				},
	// 				Sorting: []*armcostmanagement.ReportConfigSorting{
	// 					{
	// 						Name: to.Ptr("UsageDate"),
	// 						Direction: to.Ptr(armcostmanagement.ReportConfigSortingTypeAscending),
	// 				}},
	// 			},
	// 			Timeframe: to.Ptr(armcostmanagement.ReportTimeframeTypeMonthToDate),
	// 		},
	// 		Scope: to.Ptr(""),
	// 	},
	// }
}
Output:

func (*ViewsClient) GetByScope

func (client *ViewsClient) GetByScope(ctx context.Context, scope string, viewName string, options *ViewsClientGetByScopeOptions) (ViewsClientGetByScopeResponse, error)

GetByScope - Gets the view for the defined scope by view name. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-10-01

  • scope - The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope.
  • viewName - View name
  • options - ViewsClientGetByScopeOptions contains the optional parameters for the ViewsClient.GetByScope method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ViewByResourceGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewViewsClient().GetByScope(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", "swaggerExample", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.View = armcostmanagement.View{
	// 	Name: to.Ptr("swaggerExample"),
	// 	Type: to.Ptr("Microsoft.CostManagement/Views"),
	// 	ETag: to.Ptr("\"1d4ff9fe66f1d10\""),
	// 	ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/views/swaggerExample"),
	// 	Properties: &armcostmanagement.ViewProperties{
	// 		Accumulated: to.Ptr(armcostmanagement.AccumulatedTypeTrue),
	// 		Chart: to.Ptr(armcostmanagement.ChartTypeTable),
	// 		DisplayName: to.Ptr("swagger Example"),
	// 		Kpis: []*armcostmanagement.KpiProperties{
	// 			{
	// 				Type: to.Ptr(armcostmanagement.KpiTypeForecast),
	// 				Enabled: to.Ptr(true),
	// 			},
	// 			{
	// 				Type: to.Ptr(armcostmanagement.KpiTypeBudget),
	// 				Enabled: to.Ptr(true),
	// 				ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo"),
	// 		}},
	// 		Metric: to.Ptr(armcostmanagement.MetricTypeActualCost),
	// 		Pivots: []*armcostmanagement.PivotProperties{
	// 			{
	// 				Name: to.Ptr("ServiceName"),
	// 				Type: to.Ptr(armcostmanagement.PivotTypeDimension),
	// 			},
	// 			{
	// 				Name: to.Ptr("MeterCategory"),
	// 				Type: to.Ptr(armcostmanagement.PivotTypeDimension),
	// 			},
	// 			{
	// 				Name: to.Ptr("swaggerTagKey"),
	// 				Type: to.Ptr(armcostmanagement.PivotTypeTagKey),
	// 		}},
	// 		Query: &armcostmanagement.ReportConfigDefinition{
	// 			Type: to.Ptr(armcostmanagement.ReportTypeUsage),
	// 			DataSet: &armcostmanagement.ReportConfigDataset{
	// 				Aggregation: map[string]*armcostmanagement.ReportConfigAggregation{
	// 					"totalCost": &armcostmanagement.ReportConfigAggregation{
	// 						Name: to.Ptr("PreTaxCost"),
	// 						Function: to.Ptr(armcostmanagement.FunctionTypeSum),
	// 					},
	// 				},
	// 				Granularity: to.Ptr(armcostmanagement.ReportGranularityTypeDaily),
	// 				Grouping: []*armcostmanagement.ReportConfigGrouping{
	// 				},
	// 				Sorting: []*armcostmanagement.ReportConfigSorting{
	// 					{
	// 						Name: to.Ptr("UsageDate"),
	// 						Direction: to.Ptr(armcostmanagement.ReportConfigSortingTypeAscending),
	// 				}},
	// 			},
	// 			Timeframe: to.Ptr(armcostmanagement.ReportTimeframeTypeMonthToDate),
	// 		},
	// 		Scope: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"),
	// 	},
	// }
}
Output:

func (*ViewsClient) NewListByScopePager added in v0.4.0

func (client *ViewsClient) NewListByScopePager(scope string, options *ViewsClientListByScopeOptions) *runtime.Pager[ViewsClientListByScopeResponse]

NewListByScopePager - Lists all views at the given scope.

Generated from API version 2021-10-01

  • scope - The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope.
  • options - ViewsClientListByScopeOptions contains the optional parameters for the ViewsClient.NewListByScopePager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ViewListByResourceGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewViewsClient().NewListByScopePager("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", nil)
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.ViewListResult = armcostmanagement.ViewListResult{
		// 	Value: []*armcostmanagement.View{
		// 		{
		// 			Name: to.Ptr("swaggerExample"),
		// 			Type: to.Ptr("Microsoft.CostManagement/Views"),
		// 			ETag: to.Ptr("\"1d4ff9fe66f1d10\""),
		// 			ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/views/swaggerExample"),
		// 			Properties: &armcostmanagement.ViewProperties{
		// 				Accumulated: to.Ptr(armcostmanagement.AccumulatedTypeTrue),
		// 				Chart: to.Ptr(armcostmanagement.ChartTypeTable),
		// 				DisplayName: to.Ptr("swagger Example"),
		// 				Kpis: []*armcostmanagement.KpiProperties{
		// 					{
		// 						Type: to.Ptr(armcostmanagement.KpiTypeForecast),
		// 						Enabled: to.Ptr(true),
		// 					},
		// 					{
		// 						Type: to.Ptr(armcostmanagement.KpiTypeBudget),
		// 						Enabled: to.Ptr(true),
		// 						ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo"),
		// 				}},
		// 				Metric: to.Ptr(armcostmanagement.MetricTypeActualCost),
		// 				Pivots: []*armcostmanagement.PivotProperties{
		// 					{
		// 						Name: to.Ptr("ServiceName"),
		// 						Type: to.Ptr(armcostmanagement.PivotTypeDimension),
		// 					},
		// 					{
		// 						Name: to.Ptr("MeterCategory"),
		// 						Type: to.Ptr(armcostmanagement.PivotTypeDimension),
		// 					},
		// 					{
		// 						Name: to.Ptr("swaggerTagKey"),
		// 						Type: to.Ptr(armcostmanagement.PivotTypeTagKey),
		// 				}},
		// 				Query: &armcostmanagement.ReportConfigDefinition{
		// 					Type: to.Ptr(armcostmanagement.ReportTypeUsage),
		// 					DataSet: &armcostmanagement.ReportConfigDataset{
		// 						Aggregation: map[string]*armcostmanagement.ReportConfigAggregation{
		// 							"totalCost": &armcostmanagement.ReportConfigAggregation{
		// 								Name: to.Ptr("PreTaxCost"),
		// 								Function: to.Ptr(armcostmanagement.FunctionTypeSum),
		// 							},
		// 						},
		// 						Granularity: to.Ptr(armcostmanagement.ReportGranularityTypeDaily),
		// 						Grouping: []*armcostmanagement.ReportConfigGrouping{
		// 						},
		// 						Sorting: []*armcostmanagement.ReportConfigSorting{
		// 							{
		// 								Name: to.Ptr("UsageDate"),
		// 								Direction: to.Ptr(armcostmanagement.ReportConfigSortingTypeAscending),
		// 						}},
		// 					},
		// 					Timeframe: to.Ptr(armcostmanagement.ReportTimeframeTypeMonthToDate),
		// 				},
		// 				Scope: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("swaggerExample2"),
		// 			Type: to.Ptr("Microsoft.CostManagement/Views"),
		// 			ETag: to.Ptr("\"1d4ffa5a9c2430c\""),
		// 			ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/views/swaggerExample2"),
		// 			Properties: &armcostmanagement.ViewProperties{
		// 				Accumulated: to.Ptr(armcostmanagement.AccumulatedTypeTrue),
		// 				Chart: to.Ptr(armcostmanagement.ChartTypeGroupedColumn),
		// 				DisplayName: to.Ptr("swagger Example 2"),
		// 				Kpis: []*armcostmanagement.KpiProperties{
		// 					{
		// 						Type: to.Ptr(armcostmanagement.KpiTypeForecast),
		// 						Enabled: to.Ptr(true),
		// 					},
		// 					{
		// 						Type: to.Ptr(armcostmanagement.KpiTypeBudget),
		// 						Enabled: to.Ptr(true),
		// 						ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo"),
		// 				}},
		// 				Metric: to.Ptr(armcostmanagement.MetricTypeActualCost),
		// 				Pivots: []*armcostmanagement.PivotProperties{
		// 					{
		// 						Name: to.Ptr("ServiceName"),
		// 						Type: to.Ptr(armcostmanagement.PivotTypeDimension),
		// 					},
		// 					{
		// 						Name: to.Ptr("MeterCategory"),
		// 						Type: to.Ptr(armcostmanagement.PivotTypeDimension),
		// 					},
		// 					{
		// 						Name: to.Ptr("swaggerTagKey"),
		// 						Type: to.Ptr(armcostmanagement.PivotTypeTagKey),
		// 				}},
		// 				Query: &armcostmanagement.ReportConfigDefinition{
		// 					Type: to.Ptr(armcostmanagement.ReportTypeUsage),
		// 					DataSet: &armcostmanagement.ReportConfigDataset{
		// 						Aggregation: map[string]*armcostmanagement.ReportConfigAggregation{
		// 							"totalCost": &armcostmanagement.ReportConfigAggregation{
		// 								Name: to.Ptr("PreTaxCost"),
		// 								Function: to.Ptr(armcostmanagement.FunctionTypeSum),
		// 							},
		// 						},
		// 						Granularity: to.Ptr(armcostmanagement.ReportGranularityTypeDaily),
		// 						Grouping: []*armcostmanagement.ReportConfigGrouping{
		// 						},
		// 						Sorting: []*armcostmanagement.ReportConfigSorting{
		// 							{
		// 								Name: to.Ptr("UsageDate"),
		// 								Direction: to.Ptr(armcostmanagement.ReportConfigSortingTypeAscending),
		// 						}},
		// 					},
		// 					Timeframe: to.Ptr(armcostmanagement.ReportTimeframeType("LastMonthToDate")),
		// 				},
		// 				Scope: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"),
		// 			},
		// 	}},
		// }
	}
}
Output:

func (*ViewsClient) NewListPager added in v0.4.0

func (client *ViewsClient) NewListPager(options *ViewsClientListOptions) *runtime.Pager[ViewsClientListResponse]

NewListPager - Lists all views by tenant and object.

Generated from API version 2021-10-01

  • options - ViewsClientListOptions contains the optional parameters for the ViewsClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/PrivateViewList.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcostmanagement.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewViewsClient().NewListPager(nil)
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.ViewListResult = armcostmanagement.ViewListResult{
		// 	Value: []*armcostmanagement.View{
		// 		{
		// 			Name: to.Ptr("swaggerExample"),
		// 			Type: to.Ptr("Microsoft.CostManagement/Views"),
		// 			ETag: to.Ptr("\"1d4ff9fe66f1d10\""),
		// 			ID: to.Ptr("/providers/Microsoft.CostManagement/views/swaggerExample"),
		// 			Properties: &armcostmanagement.ViewProperties{
		// 				Accumulated: to.Ptr(armcostmanagement.AccumulatedTypeTrue),
		// 				Chart: to.Ptr(armcostmanagement.ChartTypeTable),
		// 				DisplayName: to.Ptr("swagger Example"),
		// 				Kpis: []*armcostmanagement.KpiProperties{
		// 					{
		// 						Type: to.Ptr(armcostmanagement.KpiTypeForecast),
		// 						Enabled: to.Ptr(true),
		// 					},
		// 					{
		// 						Type: to.Ptr(armcostmanagement.KpiTypeBudget),
		// 						Enabled: to.Ptr(true),
		// 						ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo"),
		// 				}},
		// 				Metric: to.Ptr(armcostmanagement.MetricTypeActualCost),
		// 				Pivots: []*armcostmanagement.PivotProperties{
		// 					{
		// 						Name: to.Ptr("ServiceName"),
		// 						Type: to.Ptr(armcostmanagement.PivotTypeDimension),
		// 					},
		// 					{
		// 						Name: to.Ptr("MeterCategory"),
		// 						Type: to.Ptr(armcostmanagement.PivotTypeDimension),
		// 					},
		// 					{
		// 						Name: to.Ptr("swaggerTagKey"),
		// 						Type: to.Ptr(armcostmanagement.PivotTypeTagKey),
		// 				}},
		// 				Query: &armcostmanagement.ReportConfigDefinition{
		// 					Type: to.Ptr(armcostmanagement.ReportTypeUsage),
		// 					DataSet: &armcostmanagement.ReportConfigDataset{
		// 						Aggregation: map[string]*armcostmanagement.ReportConfigAggregation{
		// 							"totalCost": &armcostmanagement.ReportConfigAggregation{
		// 								Name: to.Ptr("PreTaxCost"),
		// 								Function: to.Ptr(armcostmanagement.FunctionTypeSum),
		// 							},
		// 						},
		// 						Granularity: to.Ptr(armcostmanagement.ReportGranularityTypeDaily),
		// 						Grouping: []*armcostmanagement.ReportConfigGrouping{
		// 						},
		// 						Sorting: []*armcostmanagement.ReportConfigSorting{
		// 							{
		// 								Name: to.Ptr("UsageDate"),
		// 								Direction: to.Ptr(armcostmanagement.ReportConfigSortingTypeAscending),
		// 						}},
		// 					},
		// 					Timeframe: to.Ptr(armcostmanagement.ReportTimeframeTypeMonthToDate),
		// 				},
		// 				Scope: to.Ptr(""),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("swaggerExample2"),
		// 			Type: to.Ptr("Microsoft.CostManagement/Views"),
		// 			ETag: to.Ptr("\"1d4ffa5a9c2430c\""),
		// 			ID: to.Ptr("/providers/Microsoft.CostManagement/views/swaggerExample2"),
		// 			Properties: &armcostmanagement.ViewProperties{
		// 				Accumulated: to.Ptr(armcostmanagement.AccumulatedTypeTrue),
		// 				Chart: to.Ptr(armcostmanagement.ChartTypeGroupedColumn),
		// 				DisplayName: to.Ptr("swagger Example 2"),
		// 				Kpis: []*armcostmanagement.KpiProperties{
		// 					{
		// 						Type: to.Ptr(armcostmanagement.KpiTypeForecast),
		// 						Enabled: to.Ptr(true),
		// 					},
		// 					{
		// 						Type: to.Ptr(armcostmanagement.KpiTypeBudget),
		// 						Enabled: to.Ptr(true),
		// 						ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo"),
		// 				}},
		// 				Metric: to.Ptr(armcostmanagement.MetricTypeActualCost),
		// 				Pivots: []*armcostmanagement.PivotProperties{
		// 					{
		// 						Name: to.Ptr("ServiceName"),
		// 						Type: to.Ptr(armcostmanagement.PivotTypeDimension),
		// 					},
		// 					{
		// 						Name: to.Ptr("MeterCategory"),
		// 						Type: to.Ptr(armcostmanagement.PivotTypeDimension),
		// 					},
		// 					{
		// 						Name: to.Ptr("swaggerTagKey"),
		// 						Type: to.Ptr(armcostmanagement.PivotTypeTagKey),
		// 				}},
		// 				Query: &armcostmanagement.ReportConfigDefinition{
		// 					Type: to.Ptr(armcostmanagement.ReportTypeUsage),
		// 					DataSet: &armcostmanagement.ReportConfigDataset{
		// 						Aggregation: map[string]*armcostmanagement.ReportConfigAggregation{
		// 							"totalCost": &armcostmanagement.ReportConfigAggregation{
		// 								Name: to.Ptr("PreTaxCost"),
		// 								Function: to.Ptr(armcostmanagement.FunctionTypeSum),
		// 							},
		// 						},
		// 						Granularity: to.Ptr(armcostmanagement.ReportGranularityTypeDaily),
		// 						Grouping: []*armcostmanagement.ReportConfigGrouping{
		// 						},
		// 						Sorting: []*armcostmanagement.ReportConfigSorting{
		// 							{
		// 								Name: to.Ptr("UsageDate"),
		// 								Direction: to.Ptr(armcostmanagement.ReportConfigSortingTypeAscending),
		// 						}},
		// 					},
		// 					Timeframe: to.Ptr(armcostmanagement.ReportTimeframeType("LastMonthToDate")),
		// 				},
		// 				Scope: to.Ptr(""),
		// 			},
		// 	}},
		// }
	}
}
Output:

type ViewsClientCreateOrUpdateByScopeOptions added in v0.2.0

type ViewsClientCreateOrUpdateByScopeOptions struct {
}

ViewsClientCreateOrUpdateByScopeOptions contains the optional parameters for the ViewsClient.CreateOrUpdateByScope method.

type ViewsClientCreateOrUpdateByScopeResponse added in v0.2.0

type ViewsClientCreateOrUpdateByScopeResponse struct {
	View
}

ViewsClientCreateOrUpdateByScopeResponse contains the response from method ViewsClient.CreateOrUpdateByScope.

type ViewsClientCreateOrUpdateOptions added in v0.2.0

type ViewsClientCreateOrUpdateOptions struct {
}

ViewsClientCreateOrUpdateOptions contains the optional parameters for the ViewsClient.CreateOrUpdate method.

type ViewsClientCreateOrUpdateResponse added in v0.2.0

type ViewsClientCreateOrUpdateResponse struct {
	View
}

ViewsClientCreateOrUpdateResponse contains the response from method ViewsClient.CreateOrUpdate.

type ViewsClientDeleteByScopeOptions added in v0.2.0

type ViewsClientDeleteByScopeOptions struct {
}

ViewsClientDeleteByScopeOptions contains the optional parameters for the ViewsClient.DeleteByScope method.

type ViewsClientDeleteByScopeResponse added in v0.2.0

type ViewsClientDeleteByScopeResponse struct {
}

ViewsClientDeleteByScopeResponse contains the response from method ViewsClient.DeleteByScope.

type ViewsClientDeleteOptions added in v0.2.0

type ViewsClientDeleteOptions struct {
}

ViewsClientDeleteOptions contains the optional parameters for the ViewsClient.Delete method.

type ViewsClientDeleteResponse added in v0.2.0

type ViewsClientDeleteResponse struct {
}

ViewsClientDeleteResponse contains the response from method ViewsClient.Delete.

type ViewsClientGetByScopeOptions added in v0.2.0

type ViewsClientGetByScopeOptions struct {
}

ViewsClientGetByScopeOptions contains the optional parameters for the ViewsClient.GetByScope method.

type ViewsClientGetByScopeResponse added in v0.2.0

type ViewsClientGetByScopeResponse struct {
	View
}

ViewsClientGetByScopeResponse contains the response from method ViewsClient.GetByScope.

type ViewsClientGetOptions added in v0.2.0

type ViewsClientGetOptions struct {
}

ViewsClientGetOptions contains the optional parameters for the ViewsClient.Get method.

type ViewsClientGetResponse added in v0.2.0

type ViewsClientGetResponse struct {
	View
}

ViewsClientGetResponse contains the response from method ViewsClient.Get.

type ViewsClientListByScopeOptions added in v0.2.0

type ViewsClientListByScopeOptions struct {
}

ViewsClientListByScopeOptions contains the optional parameters for the ViewsClient.NewListByScopePager method.

type ViewsClientListByScopeResponse added in v0.2.0

type ViewsClientListByScopeResponse struct {
	ViewListResult
}

ViewsClientListByScopeResponse contains the response from method ViewsClient.NewListByScopePager.

type ViewsClientListOptions added in v0.2.0

type ViewsClientListOptions struct {
}

ViewsClientListOptions contains the optional parameters for the ViewsClient.NewListPager method.

type ViewsClientListResponse added in v0.2.0

type ViewsClientListResponse struct {
	ViewListResult
}

ViewsClientListResponse contains the response from method ViewsClient.NewListPager.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL