Documentation ¶
Index ¶
- type AggregatedCostClient
- func (client *AggregatedCostClient) GetByManagementGroup(ctx context.Context, managementGroupID string, ...) (AggregatedCostClientGetByManagementGroupResponse, error)
- func (client *AggregatedCostClient) GetForBillingPeriodByManagementGroup(ctx context.Context, managementGroupID string, billingPeriodName string, ...) (AggregatedCostClientGetForBillingPeriodByManagementGroupResponse, error)
- type AggregatedCostClientGetByManagementGroupOptions
- type AggregatedCostClientGetByManagementGroupResponse
- type AggregatedCostClientGetForBillingPeriodByManagementGroupOptions
- type AggregatedCostClientGetForBillingPeriodByManagementGroupResponse
- type Amount
- type AmountWithExchangeRate
- type Balance
- type BalanceProperties
- type BalancePropertiesAdjustmentDetailsItem
- type BalancePropertiesNewPurchasesDetailsItem
- type BalancesClient
- func (client *BalancesClient) GetByBillingAccount(ctx context.Context, billingAccountID string, ...) (BalancesClientGetByBillingAccountResponse, error)
- func (client *BalancesClient) GetForBillingPeriodByBillingAccount(ctx context.Context, billingAccountID string, billingPeriodName string, ...) (BalancesClientGetForBillingPeriodByBillingAccountResponse, error)
- type BalancesClientGetByBillingAccountOptions
- type BalancesClientGetByBillingAccountResponse
- type BalancesClientGetForBillingPeriodByBillingAccountOptions
- type BalancesClientGetForBillingPeriodByBillingAccountResponse
- type BillingFrequency
- type Budget
- type BudgetComparisonExpression
- type BudgetFilter
- type BudgetFilterProperties
- type BudgetOperatorType
- type BudgetProperties
- type BudgetTimePeriod
- type BudgetsClient
- func (client *BudgetsClient) CreateOrUpdate(ctx context.Context, scope string, budgetName string, parameters Budget, ...) (BudgetsClientCreateOrUpdateResponse, error)
- func (client *BudgetsClient) Delete(ctx context.Context, scope string, budgetName string, ...) (BudgetsClientDeleteResponse, error)
- func (client *BudgetsClient) Get(ctx context.Context, scope string, budgetName string, ...) (BudgetsClientGetResponse, error)
- func (client *BudgetsClient) NewListPager(scope string, options *BudgetsClientListOptions) *runtime.Pager[BudgetsClientListResponse]
- type BudgetsClientCreateOrUpdateOptions
- type BudgetsClientCreateOrUpdateResponse
- type BudgetsClientDeleteOptions
- type BudgetsClientDeleteResponse
- type BudgetsClientGetOptions
- type BudgetsClientGetResponse
- type BudgetsClientListOptions
- type BudgetsClientListResponse
- type BudgetsListResult
- type CategoryType
- type ChargeSummary
- type ChargeSummaryClassification
- type ChargeSummaryKind
- type ChargesClient
- type ChargesClientListOptions
- type ChargesClientListResponse
- type ChargesListResult
- type ClientFactory
- func (c *ClientFactory) NewAggregatedCostClient() *AggregatedCostClient
- func (c *ClientFactory) NewBalancesClient() *BalancesClient
- func (c *ClientFactory) NewBudgetsClient() *BudgetsClient
- func (c *ClientFactory) NewChargesClient() *ChargesClient
- func (c *ClientFactory) NewCreditsClient() *CreditsClient
- func (c *ClientFactory) NewEventsClient() *EventsClient
- func (c *ClientFactory) NewLotsClient() *LotsClient
- func (c *ClientFactory) NewMarketplacesClient() *MarketplacesClient
- func (c *ClientFactory) NewOperationsClient() *OperationsClient
- func (c *ClientFactory) NewPriceSheetClient() *PriceSheetClient
- func (c *ClientFactory) NewReservationRecommendationDetailsClient() *ReservationRecommendationDetailsClient
- func (c *ClientFactory) NewReservationRecommendationsClient() *ReservationRecommendationsClient
- func (c *ClientFactory) NewReservationTransactionsClient() *ReservationTransactionsClient
- func (c *ClientFactory) NewReservationsDetailsClient() *ReservationsDetailsClient
- func (c *ClientFactory) NewReservationsSummariesClient() *ReservationsSummariesClient
- func (c *ClientFactory) NewTagsClient() *TagsClient
- func (c *ClientFactory) NewUsageDetailsClient() *UsageDetailsClient
- type CreditBalanceSummary
- type CreditSummary
- type CreditSummaryProperties
- type CreditsClient
- type CreditsClientGetOptions
- type CreditsClientGetResponse
- type CultureCode
- type CurrentSpend
- type Datagrain
- type DownloadProperties
- type ErrorDetails
- type ErrorResponse
- type EventProperties
- type EventSummary
- type EventType
- type Events
- type EventsClient
- func (client *EventsClient) NewListByBillingAccountPager(billingAccountID string, options *EventsClientListByBillingAccountOptions) *runtime.Pager[EventsClientListByBillingAccountResponse]
- func (client *EventsClient) NewListByBillingProfilePager(billingAccountID string, billingProfileID string, startDate string, ...) *runtime.Pager[EventsClientListByBillingProfileResponse]
- type EventsClientListByBillingAccountOptions
- type EventsClientListByBillingAccountResponse
- type EventsClientListByBillingProfileOptions
- type EventsClientListByBillingProfileResponse
- type ForecastSpend
- type HighCasedErrorDetails
- type HighCasedErrorResponse
- type LegacyChargeSummary
- type LegacyChargeSummaryProperties
- type LegacyReservationRecommendation
- type LegacyReservationRecommendationProperties
- func (l *LegacyReservationRecommendationProperties) GetLegacyReservationRecommendationProperties() *LegacyReservationRecommendationProperties
- func (l LegacyReservationRecommendationProperties) MarshalJSON() ([]byte, error)
- func (l *LegacyReservationRecommendationProperties) UnmarshalJSON(data []byte) error
- type LegacyReservationRecommendationPropertiesClassification
- type LegacyReservationTransaction
- type LegacyReservationTransactionProperties
- type LegacySharedScopeReservationRecommendationProperties
- func (l *LegacySharedScopeReservationRecommendationProperties) GetLegacyReservationRecommendationProperties() *LegacyReservationRecommendationProperties
- func (l LegacySharedScopeReservationRecommendationProperties) MarshalJSON() ([]byte, error)
- func (l *LegacySharedScopeReservationRecommendationProperties) UnmarshalJSON(data []byte) error
- type LegacySingleScopeReservationRecommendationProperties
- func (l *LegacySingleScopeReservationRecommendationProperties) GetLegacyReservationRecommendationProperties() *LegacyReservationRecommendationProperties
- func (l LegacySingleScopeReservationRecommendationProperties) MarshalJSON() ([]byte, error)
- func (l *LegacySingleScopeReservationRecommendationProperties) UnmarshalJSON(data []byte) error
- type LegacyUsageDetail
- type LegacyUsageDetailProperties
- type LookBackPeriod
- type LotProperties
- type LotSource
- type LotSummary
- type Lots
- type LotsClient
- func (client *LotsClient) NewListByBillingAccountPager(billingAccountID string, options *LotsClientListByBillingAccountOptions) *runtime.Pager[LotsClientListByBillingAccountResponse]
- func (client *LotsClient) NewListByBillingProfilePager(billingAccountID string, billingProfileID string, ...) *runtime.Pager[LotsClientListByBillingProfileResponse]
- func (client *LotsClient) NewListByCustomerPager(billingAccountID string, customerID string, ...) *runtime.Pager[LotsClientListByCustomerResponse]
- type LotsClientListByBillingAccountOptions
- type LotsClientListByBillingAccountResponse
- type LotsClientListByBillingProfileOptions
- type LotsClientListByBillingProfileResponse
- type LotsClientListByCustomerOptions
- type LotsClientListByCustomerResponse
- type ManagementGroupAggregatedCostProperties
- type ManagementGroupAggregatedCostResult
- type Marketplace
- type MarketplaceProperties
- type MarketplacesClient
- type MarketplacesClientListOptions
- type MarketplacesClientListResponse
- type MarketplacesListResult
- type MeterDetails
- type MeterDetailsResponse
- type Metrictype
- type ModernChargeSummary
- type ModernChargeSummaryProperties
- type ModernReservationRecommendation
- type ModernReservationRecommendationProperties
- type ModernReservationTransaction
- type ModernReservationTransactionProperties
- type ModernReservationTransactionsListResult
- type ModernUsageDetail
- type ModernUsageDetailProperties
- type Notification
- type Operation
- type OperationDisplay
- type OperationListResult
- type OperationsClient
- type OperationsClientListOptions
- type OperationsClientListResponse
- type OperatorType
- type PriceSheetClient
- type PriceSheetClientGetByBillingPeriodOptions
- type PriceSheetClientGetByBillingPeriodResponse
- type PriceSheetClientGetOptions
- type PriceSheetClientGetResponse
- type PriceSheetModel
- type PriceSheetProperties
- type PriceSheetResult
- type PricingModelType
- type ProxyResource
- type Reseller
- type ReservationDetail
- type ReservationDetailProperties
- type ReservationDetailsListResult
- type ReservationRecommendation
- type ReservationRecommendationClassification
- type ReservationRecommendationDetailsCalculatedSavingsProperties
- type ReservationRecommendationDetailsClient
- type ReservationRecommendationDetailsClientGetOptions
- type ReservationRecommendationDetailsClientGetResponse
- type ReservationRecommendationDetailsModel
- type ReservationRecommendationDetailsProperties
- type ReservationRecommendationDetailsResourceProperties
- type ReservationRecommendationDetailsSavingsProperties
- type ReservationRecommendationDetailsUsageProperties
- type ReservationRecommendationKind
- type ReservationRecommendationsClient
- type ReservationRecommendationsClientListOptions
- type ReservationRecommendationsClientListResponse
- type ReservationRecommendationsListResult
- type ReservationSummariesListResult
- type ReservationSummary
- type ReservationSummaryProperties
- type ReservationTransaction
- type ReservationTransactionResource
- type ReservationTransactionsClient
- func (client *ReservationTransactionsClient) NewListByBillingProfilePager(billingAccountID string, billingProfileID string, ...) *runtime.Pager[ReservationTransactionsClientListByBillingProfileResponse]
- func (client *ReservationTransactionsClient) NewListPager(billingAccountID string, options *ReservationTransactionsClientListOptions) *runtime.Pager[ReservationTransactionsClientListResponse]
- type ReservationTransactionsClientListByBillingProfileOptions
- type ReservationTransactionsClientListByBillingProfileResponse
- type ReservationTransactionsClientListOptions
- type ReservationTransactionsClientListResponse
- type ReservationTransactionsListResult
- type ReservationsDetailsClient
- func (client *ReservationsDetailsClient) NewListByReservationOrderAndReservationPager(reservationOrderID string, reservationID string, filter string, ...) ...
- func (client *ReservationsDetailsClient) NewListByReservationOrderPager(reservationOrderID string, filter string, ...) *runtime.Pager[ReservationsDetailsClientListByReservationOrderResponse]
- func (client *ReservationsDetailsClient) NewListPager(resourceScope string, options *ReservationsDetailsClientListOptions) *runtime.Pager[ReservationsDetailsClientListResponse]
- type ReservationsDetailsClientListByReservationOrderAndReservationOptions
- type ReservationsDetailsClientListByReservationOrderAndReservationResponse
- type ReservationsDetailsClientListByReservationOrderOptions
- type ReservationsDetailsClientListByReservationOrderResponse
- type ReservationsDetailsClientListOptions
- type ReservationsDetailsClientListResponse
- type ReservationsSummariesClient
- func (client *ReservationsSummariesClient) NewListByReservationOrderAndReservationPager(reservationOrderID string, reservationID string, grain Datagrain, ...) ...
- func (client *ReservationsSummariesClient) NewListByReservationOrderPager(reservationOrderID string, grain Datagrain, ...) *runtime.Pager[ReservationsSummariesClientListByReservationOrderResponse]
- func (client *ReservationsSummariesClient) NewListPager(resourceScope string, grain Datagrain, ...) *runtime.Pager[ReservationsSummariesClientListResponse]
- type ReservationsSummariesClientListByReservationOrderAndReservationOptions
- type ReservationsSummariesClientListByReservationOrderAndReservationResponse
- type ReservationsSummariesClientListByReservationOrderOptions
- type ReservationsSummariesClientListByReservationOrderResponse
- type ReservationsSummariesClientListOptions
- type ReservationsSummariesClientListResponse
- type Resource
- type ResourceAttributes
- type SKUProperty
- type Scope
- type Status
- type Tag
- type TagProperties
- type TagsClient
- type TagsClientGetOptions
- type TagsClientGetResponse
- type TagsResult
- type Term
- type ThresholdType
- type TimeGrainType
- type UsageDetail
- type UsageDetailClassification
- type UsageDetailsClient
- type UsageDetailsClientListOptions
- type UsageDetailsClientListResponse
- type UsageDetailsKind
- type UsageDetailsListResult
Examples ¶
- AggregatedCostClient.GetByManagementGroup (AggregatedCostByManagementGroup)
- AggregatedCostClient.GetByManagementGroup (AggregatedCostByManagementGroupFilterByDate)
- AggregatedCostClient.GetForBillingPeriodByManagementGroup
- BalancesClient.GetByBillingAccount
- BalancesClient.GetForBillingPeriodByBillingAccount
- BudgetsClient.CreateOrUpdate
- BudgetsClient.Delete
- BudgetsClient.Get
- BudgetsClient.NewListPager
- ChargesClient.List (ChangesForBillingPeriodByDepartmentLegacy)
- ChargesClient.List (ChangesForBillingPeriodByEnrollmentAccountLegacy)
- ChargesClient.List (ChargesListByBillingAccountGroupByBillingProfileIdModern)
- ChargesClient.List (ChargesListByBillingAccountGroupByCustomerIdModern)
- ChargesClient.List (ChargesListByBillingAccountGroupByInvoiceSectionIdModern)
- ChargesClient.List (ChargesListByBillingAccountModern)
- ChargesClient.List (ChargesListByBillingProfileGroupByInvoiceSectionIdModern)
- ChargesClient.List (ChargesListByBillingProfileInvoiceSectionModern)
- ChargesClient.List (ChargesListByBillingProfileModern)
- ChargesClient.List (ChargesListByCustomerModern)
- ChargesClient.List (ChargesListByDepartmentLegacy)
- ChargesClient.List (ChargesListByInvoiceSectionIdModern)
- ChargesClient.List (ChargesListForEnrollmentAccountLegacy)
- CreditsClient.Get
- EventsClient.NewListByBillingAccountPager (EventsGetByBillingAccount)
- EventsClient.NewListByBillingAccountPager (EventsGetByBillingAccountWithFilters)
- EventsClient.NewListByBillingProfilePager
- LotsClient.NewListByBillingAccountPager (LotsListByBillingAccount)
- LotsClient.NewListByBillingAccountPager (LotsListByBillingAccountWithStatusFilter)
- LotsClient.NewListByBillingProfilePager
- LotsClient.NewListByCustomerPager (LotsListByCustomer)
- LotsClient.NewListByCustomerPager (LotsListByCustomerWithFilter)
- MarketplacesClient.NewListPager (BillingAccountMarketplacesList)
- MarketplacesClient.NewListPager (BillingAccountMarketplacesListForBillingPeriod)
- MarketplacesClient.NewListPager (DepartmentMarketplacesList)
- MarketplacesClient.NewListPager (DepartmentMarketplacesListForBillingPeriod)
- MarketplacesClient.NewListPager (EnrollmentAccountMarketplacesList)
- MarketplacesClient.NewListPager (EnrollmentAccountMarketplacesListForBillingPeriod)
- MarketplacesClient.NewListPager (ManagementGroupMarketplacesList)
- MarketplacesClient.NewListPager (ManagementGroupMarketplacesListForBillingPeriod)
- MarketplacesClient.NewListPager (SubscriptionMarketplacesList)
- MarketplacesClient.NewListPager (SubscriptionMarketplacesListForBillingPeriod)
- OperationsClient.NewListPager
- PriceSheetClient.Get
- PriceSheetClient.GetByBillingPeriod (PriceSheetExpand)
- PriceSheetClient.GetByBillingPeriod (PriceSheetForBillingPeriod)
- ReservationRecommendationDetailsClient.Get (ReservationRecommendationsByBillingAccountLegacy)
- ReservationRecommendationDetailsClient.Get (ReservationRecommendationsByBillingProfileModern)
- ReservationRecommendationDetailsClient.Get (ReservationRecommendationsByResourceGroupLegacy)
- ReservationRecommendationDetailsClient.Get (ReservationRecommendationsBySubscriptionLegacy)
- ReservationRecommendationsClient.NewListPager (ReservationRecommendationsByBillingAccountLegacy)
- ReservationRecommendationsClient.NewListPager (ReservationRecommendationsByBillingProfileModern)
- ReservationRecommendationsClient.NewListPager (ReservationRecommendationsByResourceGroupLegacy)
- ReservationRecommendationsClient.NewListPager (ReservationRecommendationsBySubscriptionLegacy)
- ReservationRecommendationsClient.NewListPager (ReservationRecommendationsFilterBySubscriptionForScopeLookBackPeriodLegacy)
- ReservationTransactionsClient.NewListByBillingProfilePager
- ReservationTransactionsClient.NewListPager
- ReservationsDetailsClient.NewListByReservationOrderAndReservationPager
- ReservationsDetailsClient.NewListByReservationOrderPager
- ReservationsDetailsClient.NewListPager (ReservationDetailsByBillingAccountId)
- ReservationsDetailsClient.NewListPager (ReservationDetailsByBillingProfileId)
- ReservationsDetailsClient.NewListPager (ReservationDetailsByBillingProfileIdReservationId)
- ReservationsSummariesClient.NewListByReservationOrderAndReservationPager (ReservationSummariesDailyWithReservationId)
- ReservationsSummariesClient.NewListByReservationOrderAndReservationPager (ReservationSummariesMonthlyWithReservationId)
- ReservationsSummariesClient.NewListByReservationOrderPager (ReservationSummariesDaily)
- ReservationsSummariesClient.NewListByReservationOrderPager (ReservationSummariesMonthly)
- ReservationsSummariesClient.NewListPager (ReservationSummariesDailyWithBillingAccountId)
- ReservationsSummariesClient.NewListPager (ReservationSummariesDailyWithBillingProfileId)
- ReservationsSummariesClient.NewListPager (ReservationSummariesMonthlyWithBillingAccountId)
- ReservationsSummariesClient.NewListPager (ReservationSummariesMonthlyWithBillingProfileId)
- ReservationsSummariesClient.NewListPager (ReservationSummariesMonthlyWithBillingProfileIdReservationId)
- TagsClient.Get
- UsageDetailsClient.NewListPager (BillingAccountUsageDetailsListForBillingPeriodLegacy)
- UsageDetailsClient.NewListPager (BillingAccountUsageDetailsListLegacy)
- UsageDetailsClient.NewListPager (BillingAccountUsageDetailsListModern)
- UsageDetailsClient.NewListPager (BillingProfileUsageDetailsListModern)
- UsageDetailsClient.NewListPager (CustomerUsageDetailsListModern)
- UsageDetailsClient.NewListPager (DepartmentUsageDetailsListForBillingPeriodLegacy)
- UsageDetailsClient.NewListPager (DepartmentUsageDetailsListLegacy)
- UsageDetailsClient.NewListPager (EnrollmentAccountUsageDetailsListForBillingPeriodLegacy)
- UsageDetailsClient.NewListPager (EnrollmentAccountUsageDetailsListLegacy)
- UsageDetailsClient.NewListPager (InvoiceSectionUsageDetailsListModern)
- UsageDetailsClient.NewListPager (ManagementGroupUsageDetailsListForBillingPeriodLegacy)
- UsageDetailsClient.NewListPager (ManagementGroupUsageDetailsListLegacy)
- UsageDetailsClient.NewListPager (UsageDetailsExpandLegacy)
- UsageDetailsClient.NewListPager (UsageDetailsListByMetricActualCostLegacy)
- UsageDetailsClient.NewListPager (UsageDetailsListByMetricAmortizedCostLegacy)
- UsageDetailsClient.NewListPager (UsageDetailsListByMetricUsageLegacy)
- UsageDetailsClient.NewListPager (UsageDetailsListFilterByTagLegacy)
- UsageDetailsClient.NewListPager (UsageDetailsListForBillingPeriodLegacy)
- UsageDetailsClient.NewListPager (UsageDetailsListLegacy)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregatedCostClient ¶
type AggregatedCostClient struct {
// contains filtered or unexported fields
}
AggregatedCostClient contains the methods for the AggregatedCost group. Don't use this type directly, use NewAggregatedCostClient() instead.
func NewAggregatedCostClient ¶
func NewAggregatedCostClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AggregatedCostClient, error)
NewAggregatedCostClient creates a new instance of AggregatedCostClient with the specified values.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*AggregatedCostClient) GetByManagementGroup ¶
func (client *AggregatedCostClient) GetByManagementGroup(ctx context.Context, managementGroupID string, options *AggregatedCostClientGetByManagementGroupOptions) (AggregatedCostClientGetByManagementGroupResponse, error)
GetByManagementGroup - Provides the aggregate cost of a management group and all child management groups by current billing period. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2021-10-01
- managementGroupID - Azure Management Group ID.
- options - AggregatedCostClientGetByManagementGroupOptions contains the optional parameters for the AggregatedCostClient.GetByManagementGroup method.
Example (AggregatedCostByManagementGroup) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/AggregatedCostByManagementGroup.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewAggregatedCostClient().GetByManagementGroup(ctx, "managementGroupForTest", &armconsumption.AggregatedCostClientGetByManagementGroupOptions{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.ManagementGroupAggregatedCostResult = armconsumption.ManagementGroupAggregatedCostResult{ // Name: to.Ptr("aggregatedcostId1"), // Type: to.Ptr("Microsoft.Consumption/aggregatedcost"), // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/managementGroupForTest/providers/Microsoft.Consumption/aggregatedcostId1"), // Properties: &armconsumption.ManagementGroupAggregatedCostProperties{ // AzureCharges: to.Ptr[float64](250.9876), // ChargesBilledSeparately: to.Ptr[float64](120.345), // Children: []*armconsumption.ManagementGroupAggregatedCostResult{ // { // Name: to.Ptr("aggregatedcostId2"), // Type: to.Ptr("Microsoft.Consumption/aggregatedcost"), // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/managementGroupChildForTest/providers/Microsoft.Consumption/aggregatedcostId2"), // Properties: &armconsumption.ManagementGroupAggregatedCostProperties{ // AzureCharges: to.Ptr[float64](150), // ChargesBilledSeparately: to.Ptr[float64](30.345), // Children: []*armconsumption.ManagementGroupAggregatedCostResult{ // }, // Currency: to.Ptr("USD"), // ExcludedSubscriptions: []*string{ // }, // IncludedSubscriptions: []*string{ // to.Ptr("c349567d-c83a-48c9-ab0e-578c69dc97a4")}, // MarketplaceCharges: to.Ptr[float64](50.786), // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T00:00:00.000Z"); return t}()), // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.000Z"); return t}()), // }, // }}, // Currency: to.Ptr("USD"), // ExcludedSubscriptions: []*string{ // }, // IncludedSubscriptions: []*string{ // to.Ptr("1caaa5a3-2b66-438e-8ab4-bce37d518c5d")}, // MarketplaceCharges: to.Ptr[float64](150.786), // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T00:00:00.000Z"); return t}()), // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.000Z"); return t}()), // }, // } }
Output:
Example (AggregatedCostByManagementGroupFilterByDate) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/AggregatedCostByManagementGroupFilterByDate.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewAggregatedCostClient().GetByManagementGroup(ctx, "managementGroupForTest", &armconsumption.AggregatedCostClientGetByManagementGroupOptions{Filter: to.Ptr("usageStart ge '2018-08-15' and properties/usageStart le '2018-08-31'")}) 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.ManagementGroupAggregatedCostResult = armconsumption.ManagementGroupAggregatedCostResult{ // Name: to.Ptr("aggregatedcostId1"), // Type: to.Ptr("Microsoft.Consumption/aggregatedcost"), // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/managementGroupForTest/providers/Microsoft.Consumption/aggregatedcostId1"), // Properties: &armconsumption.ManagementGroupAggregatedCostProperties{ // AzureCharges: to.Ptr[float64](150.9876), // ChargesBilledSeparately: to.Ptr[float64](90.345), // Children: []*armconsumption.ManagementGroupAggregatedCostResult{ // { // Name: to.Ptr("aggregatedcostId2"), // Type: to.Ptr("Microsoft.Consumption/aggregatedcost"), // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/managementGroupChildForTest/providers/Microsoft.Consumption/aggregatedcostId2"), // Properties: &armconsumption.ManagementGroupAggregatedCostProperties{ // AzureCharges: to.Ptr[float64](50), // ChargesBilledSeparately: to.Ptr[float64](30.345), // Children: []*armconsumption.ManagementGroupAggregatedCostResult{ // }, // Currency: to.Ptr("USD"), // ExcludedSubscriptions: []*string{ // }, // IncludedSubscriptions: []*string{ // to.Ptr("c349567d-c83a-48c9-ab0e-578c69dc97a4")}, // MarketplaceCharges: to.Ptr[float64](10.786), // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-31T00:00:00.000Z"); return t}()), // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-15T00:00:00.000Z"); return t}()), // }, // }}, // Currency: to.Ptr("USD"), // ExcludedSubscriptions: []*string{ // }, // IncludedSubscriptions: []*string{ // to.Ptr("1caaa5a3-2b66-438e-8ab4-bce37d518c5d")}, // MarketplaceCharges: to.Ptr[float64](80.786), // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-31T00:00:00.000Z"); return t}()), // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-15T00:00:00.000Z"); return t}()), // }, // } }
Output:
func (*AggregatedCostClient) GetForBillingPeriodByManagementGroup ¶
func (client *AggregatedCostClient) GetForBillingPeriodByManagementGroup(ctx context.Context, managementGroupID string, billingPeriodName string, options *AggregatedCostClientGetForBillingPeriodByManagementGroupOptions) (AggregatedCostClientGetForBillingPeriodByManagementGroupResponse, error)
GetForBillingPeriodByManagementGroup - Provides the aggregate cost of a management group and all child management groups by specified billing period If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2021-10-01
- managementGroupID - Azure Management Group ID.
- billingPeriodName - Billing Period Name.
- options - AggregatedCostClientGetForBillingPeriodByManagementGroupOptions contains the optional parameters for the AggregatedCostClient.GetForBillingPeriodByManagementGroup method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/AggregatedCostForBillingPeriodByManagementGroup.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewAggregatedCostClient().GetForBillingPeriodByManagementGroup(ctx, "managementGroupForTest", "201807", 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.ManagementGroupAggregatedCostResult = armconsumption.ManagementGroupAggregatedCostResult{ // Name: to.Ptr("aggregatedcostId1"), // Type: to.Ptr("Microsoft.Consumption/aggregatedcost"), // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/managementGroupForTest/providers/Microsoft.Consumption/aggregatedcostId1"), // Properties: &armconsumption.ManagementGroupAggregatedCostProperties{ // AzureCharges: to.Ptr[float64](250.9876), // ChargesBilledSeparately: to.Ptr[float64](120.345), // Children: []*armconsumption.ManagementGroupAggregatedCostResult{ // { // Name: to.Ptr("aggregatedcostId2"), // Type: to.Ptr("Microsoft.Consumption/aggregatedcost"), // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/managementGroupChildForTest/providers/Microsoft.Consumption/aggregatedcostId2"), // Properties: &armconsumption.ManagementGroupAggregatedCostProperties{ // AzureCharges: to.Ptr[float64](150), // ChargesBilledSeparately: to.Ptr[float64](30.345), // Children: []*armconsumption.ManagementGroupAggregatedCostResult{ // }, // Currency: to.Ptr("USD"), // MarketplaceCharges: to.Ptr[float64](50.786), // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-07-31T00:00:00.000Z"); return t}()), // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-07-01T00:00:00.000Z"); return t}()), // }, // }}, // Currency: to.Ptr("USD"), // MarketplaceCharges: to.Ptr[float64](150.786), // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-07-31T00:00:00.000Z"); return t}()), // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-07-01T00:00:00.000Z"); return t}()), // }, // } }
Output:
type AggregatedCostClientGetByManagementGroupOptions ¶ added in v0.3.0
type AggregatedCostClientGetByManagementGroupOptions struct { // May be used to filter aggregated cost by properties/usageStart (Utc time), properties/usageEnd (Utc time). The filter supports // 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support // 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). Filter *string }
AggregatedCostClientGetByManagementGroupOptions contains the optional parameters for the AggregatedCostClient.GetByManagementGroup method.
type AggregatedCostClientGetByManagementGroupResponse ¶ added in v0.3.0
type AggregatedCostClientGetByManagementGroupResponse struct { // A management group aggregated cost resource. ManagementGroupAggregatedCostResult }
AggregatedCostClientGetByManagementGroupResponse contains the response from method AggregatedCostClient.GetByManagementGroup.
type AggregatedCostClientGetForBillingPeriodByManagementGroupOptions ¶ added in v0.3.0
type AggregatedCostClientGetForBillingPeriodByManagementGroupOptions struct { }
AggregatedCostClientGetForBillingPeriodByManagementGroupOptions contains the optional parameters for the AggregatedCostClient.GetForBillingPeriodByManagementGroup method.
type AggregatedCostClientGetForBillingPeriodByManagementGroupResponse ¶ added in v0.3.0
type AggregatedCostClientGetForBillingPeriodByManagementGroupResponse struct { // A management group aggregated cost resource. ManagementGroupAggregatedCostResult }
AggregatedCostClientGetForBillingPeriodByManagementGroupResponse contains the response from method AggregatedCostClient.GetForBillingPeriodByManagementGroup.
type Amount ¶
type Amount struct { // READ-ONLY; Amount currency. Currency *string // READ-ONLY; Amount. Value *float64 }
Amount - The amount plus currency .
func (Amount) MarshalJSON ¶ added in v1.1.0
MarshalJSON implements the json.Marshaller interface for type Amount.
func (*Amount) UnmarshalJSON ¶ added in v1.1.0
UnmarshalJSON implements the json.Unmarshaller interface for type Amount.
type AmountWithExchangeRate ¶
type AmountWithExchangeRate struct { // READ-ONLY; Amount currency. Currency *string // READ-ONLY; The exchange rate. ExchangeRate *float64 // READ-ONLY; The exchange rate month. ExchangeRateMonth *int32 // READ-ONLY; Amount. Value *float64 }
AmountWithExchangeRate - The amount with exchange rate.
func (AmountWithExchangeRate) MarshalJSON ¶ added in v1.1.0
func (a AmountWithExchangeRate) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AmountWithExchangeRate.
func (*AmountWithExchangeRate) UnmarshalJSON ¶ added in v1.1.0
func (a *AmountWithExchangeRate) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AmountWithExchangeRate.
type Balance ¶
type Balance struct { // The properties of the balance. Properties *BalanceProperties // READ-ONLY; The etag for the resource. Etag *string // READ-ONLY; The full qualified ARM ID of an event. ID *string // READ-ONLY; The ID that uniquely identifies an event. Name *string // READ-ONLY; Resource tags. Tags map[string]*string // READ-ONLY; Resource type. Type *string }
Balance - A balance resource.
func (Balance) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface for type Balance.
func (*Balance) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaller interface for type Balance.
type BalanceProperties ¶
type BalanceProperties struct { // The billing frequency. BillingFrequency *BillingFrequency // READ-ONLY; List of Adjustments (Promo credit, SIE credit etc.). AdjustmentDetails []*BalancePropertiesAdjustmentDetailsItem // READ-ONLY; Total adjustment amount. Adjustments *float64 // READ-ONLY; Total charges for Azure Marketplace. AzureMarketplaceServiceCharges *float64 // READ-ONLY; The beginning balance for the billing period. BeginningBalance *float64 // READ-ONLY; Charges Billed separately. ChargesBilledSeparately *float64 // READ-ONLY; The ISO currency in which the meter is charged, for example, USD. Currency *string // READ-ONLY; The ending balance for the billing period (for open periods this will be updated daily). EndingBalance *float64 // READ-ONLY; Total new purchase amount. NewPurchases *float64 // READ-ONLY; List of new purchases. NewPurchasesDetails []*BalancePropertiesNewPurchasesDetailsItem // READ-ONLY; Price is hidden or not. PriceHidden *bool // READ-ONLY; Overage for Azure services. ServiceOverage *float64 // READ-ONLY; serviceOverage + chargesBilledSeparately. TotalOverage *float64 // READ-ONLY; Azure service commitment + total Overage. TotalUsage *float64 // READ-ONLY; Total Commitment usage. Utilized *float64 }
BalanceProperties - The properties of the balance.
func (BalanceProperties) MarshalJSON ¶
func (b BalanceProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BalanceProperties.
func (*BalanceProperties) UnmarshalJSON ¶ added in v1.1.0
func (b *BalanceProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type BalanceProperties.
type BalancePropertiesAdjustmentDetailsItem ¶
type BalancePropertiesAdjustmentDetailsItem struct { // READ-ONLY; the name of new adjustment. Name *string // READ-ONLY; the value of new adjustment. Value *float64 }
func (BalancePropertiesAdjustmentDetailsItem) MarshalJSON ¶ added in v1.1.0
func (b BalancePropertiesAdjustmentDetailsItem) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BalancePropertiesAdjustmentDetailsItem.
func (*BalancePropertiesAdjustmentDetailsItem) UnmarshalJSON ¶ added in v1.1.0
func (b *BalancePropertiesAdjustmentDetailsItem) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type BalancePropertiesAdjustmentDetailsItem.
type BalancePropertiesNewPurchasesDetailsItem ¶
type BalancePropertiesNewPurchasesDetailsItem struct { // READ-ONLY; the name of new purchase. Name *string // READ-ONLY; the value of new purchase. Value *float64 }
func (BalancePropertiesNewPurchasesDetailsItem) MarshalJSON ¶ added in v1.1.0
func (b BalancePropertiesNewPurchasesDetailsItem) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BalancePropertiesNewPurchasesDetailsItem.
func (*BalancePropertiesNewPurchasesDetailsItem) UnmarshalJSON ¶ added in v1.1.0
func (b *BalancePropertiesNewPurchasesDetailsItem) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type BalancePropertiesNewPurchasesDetailsItem.
type BalancesClient ¶
type BalancesClient struct {
// contains filtered or unexported fields
}
BalancesClient contains the methods for the Balances group. Don't use this type directly, use NewBalancesClient() instead.
func NewBalancesClient ¶
func NewBalancesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*BalancesClient, error)
NewBalancesClient creates a new instance of BalancesClient with the specified values.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*BalancesClient) GetByBillingAccount ¶
func (client *BalancesClient) GetByBillingAccount(ctx context.Context, billingAccountID string, options *BalancesClientGetByBillingAccountOptions) (BalancesClientGetByBillingAccountResponse, error)
GetByBillingAccount - Gets the balances for a scope by billingAccountId. Balances are available via this API only for May 1, 2014 or later. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2021-10-01
- billingAccountID - BillingAccount ID
- options - BalancesClientGetByBillingAccountOptions contains the optional parameters for the BalancesClient.GetByBillingAccount method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/BalancesByBillingAccount.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewBalancesClient().GetByBillingAccount(ctx, "123456", 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.Balance = armconsumption.Balance{ // Name: to.Ptr("balanceId1"), // Type: to.Ptr("Microsoft.Consumption/balances"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/123456/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/balances/balanceId1"), // Properties: &armconsumption.BalanceProperties{ // AdjustmentDetails: []*armconsumption.BalancePropertiesAdjustmentDetailsItem{ // { // Name: to.Ptr("Promo Credit"), // Value: to.Ptr[float64](1.1), // }, // { // Name: to.Ptr("SIE Credit"), // Value: to.Ptr[float64](1), // }}, // Adjustments: to.Ptr[float64](0), // AzureMarketplaceServiceCharges: to.Ptr[float64](609.82), // BeginningBalance: to.Ptr[float64](3396469.19), // BillingFrequency: to.Ptr(armconsumption.BillingFrequencyMonth), // ChargesBilledSeparately: to.Ptr[float64](0), // Currency: to.Ptr("USD "), // EndingBalance: to.Ptr[float64](2922371.02), // NewPurchases: to.Ptr[float64](0), // NewPurchasesDetails: []*armconsumption.BalancePropertiesNewPurchasesDetailsItem{ // { // Name: to.Ptr("Promo Purchase"), // Value: to.Ptr[float64](1), // }}, // PriceHidden: to.Ptr(false), // ServiceOverage: to.Ptr[float64](0), // TotalOverage: to.Ptr[float64](0), // TotalUsage: to.Ptr[float64](474098.17), // Utilized: to.Ptr[float64](474098.17), // }, // } }
Output:
func (*BalancesClient) GetForBillingPeriodByBillingAccount ¶
func (client *BalancesClient) GetForBillingPeriodByBillingAccount(ctx context.Context, billingAccountID string, billingPeriodName string, options *BalancesClientGetForBillingPeriodByBillingAccountOptions) (BalancesClientGetForBillingPeriodByBillingAccountResponse, error)
GetForBillingPeriodByBillingAccount - Gets the balances for a scope by billing period and billingAccountId. Balances are available via this API only for May 1, 2014 or later. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2021-10-01
- billingAccountID - BillingAccount ID
- billingPeriodName - Billing Period Name.
- options - BalancesClientGetForBillingPeriodByBillingAccountOptions contains the optional parameters for the BalancesClient.GetForBillingPeriodByBillingAccount method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/BalancesByBillingAccountForBillingPeriod.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewBalancesClient().GetForBillingPeriodByBillingAccount(ctx, "123456", "201702", 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.Balance = armconsumption.Balance{ // Name: to.Ptr("balanceId1"), // Type: to.Ptr("Microsoft.Consumption/balances"), // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/123456/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/balances/balanceId1"), // Properties: &armconsumption.BalanceProperties{ // AdjustmentDetails: []*armconsumption.BalancePropertiesAdjustmentDetailsItem{ // { // Name: to.Ptr("Promo Credit"), // Value: to.Ptr[float64](1.1), // }, // { // Name: to.Ptr("SIE Credit"), // Value: to.Ptr[float64](1), // }}, // Adjustments: to.Ptr[float64](0), // AzureMarketplaceServiceCharges: to.Ptr[float64](609.82), // BeginningBalance: to.Ptr[float64](3396469.19), // BillingFrequency: to.Ptr(armconsumption.BillingFrequencyMonth), // ChargesBilledSeparately: to.Ptr[float64](0), // Currency: to.Ptr("USD "), // EndingBalance: to.Ptr[float64](2922371.02), // NewPurchases: to.Ptr[float64](0), // NewPurchasesDetails: []*armconsumption.BalancePropertiesNewPurchasesDetailsItem{ // { // Name: to.Ptr("Promo Purchase"), // Value: to.Ptr[float64](1), // }}, // PriceHidden: to.Ptr(false), // ServiceOverage: to.Ptr[float64](0), // TotalOverage: to.Ptr[float64](0), // TotalUsage: to.Ptr[float64](474098.17), // Utilized: to.Ptr[float64](474098.17), // }, // } }
Output:
type BalancesClientGetByBillingAccountOptions ¶ added in v0.3.0
type BalancesClientGetByBillingAccountOptions struct { }
BalancesClientGetByBillingAccountOptions contains the optional parameters for the BalancesClient.GetByBillingAccount method.
type BalancesClientGetByBillingAccountResponse ¶ added in v0.3.0
type BalancesClientGetByBillingAccountResponse struct { // A balance resource. Balance }
BalancesClientGetByBillingAccountResponse contains the response from method BalancesClient.GetByBillingAccount.
type BalancesClientGetForBillingPeriodByBillingAccountOptions ¶ added in v0.3.0
type BalancesClientGetForBillingPeriodByBillingAccountOptions struct { }
BalancesClientGetForBillingPeriodByBillingAccountOptions contains the optional parameters for the BalancesClient.GetForBillingPeriodByBillingAccount method.
type BalancesClientGetForBillingPeriodByBillingAccountResponse ¶ added in v0.3.0
type BalancesClientGetForBillingPeriodByBillingAccountResponse struct { // A balance resource. Balance }
BalancesClientGetForBillingPeriodByBillingAccountResponse contains the response from method BalancesClient.GetForBillingPeriodByBillingAccount.
type BillingFrequency ¶
type BillingFrequency string
BillingFrequency - The billing frequency.
const ( BillingFrequencyMonth BillingFrequency = "Month" BillingFrequencyQuarter BillingFrequency = "Quarter" BillingFrequencyYear BillingFrequency = "Year" )
func PossibleBillingFrequencyValues ¶
func PossibleBillingFrequencyValues() []BillingFrequency
PossibleBillingFrequencyValues returns the possible values for the BillingFrequency const type.
type Budget ¶
type Budget 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 budget. Properties *BudgetProperties // READ-ONLY; Resource Id. ID *string // READ-ONLY; Resource name. Name *string // READ-ONLY; Resource type. Type *string }
Budget - A budget resource.
func (Budget) MarshalJSON ¶ added in v1.1.0
MarshalJSON implements the json.Marshaller interface for type Budget.
func (*Budget) UnmarshalJSON ¶ added in v1.1.0
UnmarshalJSON implements the json.Unmarshaller interface for type Budget.
type BudgetComparisonExpression ¶
type BudgetComparisonExpression struct { // REQUIRED; The name of the column to use in comparison. Name *string // REQUIRED; The operator to use for comparison. Operator *BudgetOperatorType // REQUIRED; Array of values to use for comparison Values []*string }
BudgetComparisonExpression - The comparison expression to be used in the budgets.
func (BudgetComparisonExpression) MarshalJSON ¶
func (b BudgetComparisonExpression) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BudgetComparisonExpression.
func (*BudgetComparisonExpression) UnmarshalJSON ¶ added in v1.1.0
func (b *BudgetComparisonExpression) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type BudgetComparisonExpression.
type BudgetFilter ¶
type BudgetFilter struct { // The logical "AND" expression. Must have at least 2 items. And []*BudgetFilterProperties // Has comparison expression for a dimension Dimensions *BudgetComparisonExpression // Has comparison expression for a tag Tags *BudgetComparisonExpression }
BudgetFilter - May be used to filter budgets by resource group, resource, or meter.
func (BudgetFilter) MarshalJSON ¶
func (b BudgetFilter) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BudgetFilter.
func (*BudgetFilter) UnmarshalJSON ¶ added in v1.1.0
func (b *BudgetFilter) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type BudgetFilter.
type BudgetFilterProperties ¶
type BudgetFilterProperties struct { // Has comparison expression for a dimension Dimensions *BudgetComparisonExpression // Has comparison expression for a tag Tags *BudgetComparisonExpression }
BudgetFilterProperties - The Dimensions or Tags to filter a budget by.
func (BudgetFilterProperties) MarshalJSON ¶ added in v1.1.0
func (b BudgetFilterProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BudgetFilterProperties.
func (*BudgetFilterProperties) UnmarshalJSON ¶ added in v1.1.0
func (b *BudgetFilterProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type BudgetFilterProperties.
type BudgetOperatorType ¶
type BudgetOperatorType string
BudgetOperatorType - The operator to use for comparison.
const (
BudgetOperatorTypeIn BudgetOperatorType = "In"
)
func PossibleBudgetOperatorTypeValues ¶
func PossibleBudgetOperatorTypeValues() []BudgetOperatorType
PossibleBudgetOperatorTypeValues returns the possible values for the BudgetOperatorType const type.
type BudgetProperties ¶
type BudgetProperties struct { // REQUIRED; The total amount of cost to track with the budget Amount *float64 // REQUIRED; The category of the budget, whether the budget tracks cost or usage. Category *CategoryType // REQUIRED; The time covered by a budget. Tracking of the amount will be reset based on the time grain. BillingMonth, BillingQuarter, // and BillingAnnual are only supported by WD customers TimeGrain *TimeGrainType // REQUIRED; Has start and end date of the budget. The start date must be first of the month and should be less than the end // date. Budget start date must be on or after June 1, 2017. Future start date should not // be more than twelve months. Past start date should be selected within the timegrain period. There are no restrictions on // the end date. TimePeriod *BudgetTimePeriod // May be used to filter budgets by user-specified dimensions and/or tags. Filter *BudgetFilter // Dictionary of notifications associated with the budget. Budget can have up to five notifications. Notifications map[string]*Notification // READ-ONLY; The current amount of cost which is being tracked for a budget. CurrentSpend *CurrentSpend // READ-ONLY; The forecasted cost which is being tracked for a budget. ForecastSpend *ForecastSpend }
BudgetProperties - The properties of the budget.
func (BudgetProperties) MarshalJSON ¶
func (b BudgetProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BudgetProperties.
func (*BudgetProperties) UnmarshalJSON ¶ added in v1.1.0
func (b *BudgetProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type BudgetProperties.
type BudgetTimePeriod ¶
type BudgetTimePeriod struct { // REQUIRED; The start date for the budget. StartDate *time.Time // The end date for the budget. If not provided, we default this to 10 years from the start date. EndDate *time.Time }
BudgetTimePeriod - The start and end date for a budget.
func (BudgetTimePeriod) MarshalJSON ¶
func (b BudgetTimePeriod) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BudgetTimePeriod.
func (*BudgetTimePeriod) UnmarshalJSON ¶
func (b *BudgetTimePeriod) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type BudgetTimePeriod.
type BudgetsClient ¶
type BudgetsClient struct {
// contains filtered or unexported fields
}
BudgetsClient contains the methods for the Budgets group. Don't use this type directly, use NewBudgetsClient() instead.
func NewBudgetsClient ¶
func NewBudgetsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*BudgetsClient, error)
NewBudgetsClient creates a new instance of BudgetsClient with the specified values.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*BudgetsClient) CreateOrUpdate ¶
func (client *BudgetsClient) CreateOrUpdate(ctx context.Context, scope string, budgetName string, parameters Budget, options *BudgetsClientCreateOrUpdateOptions) (BudgetsClientCreateOrUpdateResponse, error)
CreateOrUpdate - The operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2021-10-01
- scope - The scope associated with budget 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}/invoiceSections/{invoiceSectionId}' for invoiceSection scope.
- budgetName - Budget Name.
- parameters - Parameters supplied to the Create Budget operation.
- options - BudgetsClientCreateOrUpdateOptions contains the optional parameters for the BudgetsClient.CreateOrUpdate method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/CreateOrUpdateBudget.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewBudgetsClient().CreateOrUpdate(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "TestBudget", armconsumption.Budget{ ETag: to.Ptr("\"1d34d016a593709\""), Properties: &armconsumption.BudgetProperties{ Amount: to.Ptr[float64](100.65), Category: to.Ptr(armconsumption.CategoryTypeCost), Filter: &armconsumption.BudgetFilter{ And: []*armconsumption.BudgetFilterProperties{ { Dimensions: &armconsumption.BudgetComparisonExpression{ Name: to.Ptr("ResourceId"), Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), Values: []*string{ to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/MSVM2"), to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/platformcloudplatformGeneric1")}, }, }, { Tags: &armconsumption.BudgetComparisonExpression{ Name: to.Ptr("category"), Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), Values: []*string{ to.Ptr("Dev"), to.Ptr("Prod")}, }, }, { Tags: &armconsumption.BudgetComparisonExpression{ Name: to.Ptr("department"), Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), Values: []*string{ to.Ptr("engineering"), to.Ptr("sales")}, }, }}, }, Notifications: map[string]*armconsumption.Notification{ "Actual_GreaterThan_80_Percent": { ContactEmails: []*string{ to.Ptr("johndoe@contoso.com"), to.Ptr("janesmith@contoso.com")}, ContactGroups: []*string{ to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/microsoft.insights/actionGroups/SampleActionGroup")}, ContactRoles: []*string{ to.Ptr("Contributor"), to.Ptr("Reader")}, Enabled: to.Ptr(true), Locale: to.Ptr(armconsumption.CultureCodeEnUs), Operator: to.Ptr(armconsumption.OperatorTypeGreaterThan), Threshold: to.Ptr[float64](80), ThresholdType: to.Ptr(armconsumption.ThresholdTypeActual), }, }, TimeGrain: to.Ptr(armconsumption.TimeGrainTypeMonthly), TimePeriod: &armconsumption.BudgetTimePeriod{ EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T00:00:00.000Z"); return t }()), StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-01T00:00:00.000Z"); return t }()), }, }, }, 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.Budget = armconsumption.Budget{ // Name: to.Ptr("TestBudget"), // Type: to.Ptr("Microsoft.Consumption/budgets"), // ETag: to.Ptr("\"1d34d012214157f\""), // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/budgets/TestBudget"), // Properties: &armconsumption.BudgetProperties{ // Amount: to.Ptr[float64](100.65), // Category: to.Ptr(armconsumption.CategoryTypeCost), // CurrentSpend: &armconsumption.CurrentSpend{ // Amount: to.Ptr[float64](80.89), // Unit: to.Ptr("USD"), // }, // Filter: &armconsumption.BudgetFilter{ // And: []*armconsumption.BudgetFilterProperties{ // { // Dimensions: &armconsumption.BudgetComparisonExpression{ // Name: to.Ptr("ResourceId"), // Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), // Values: []*string{ // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/MSVM2"), // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/platformcloudplatformGeneric1")}, // }, // }, // { // Tags: &armconsumption.BudgetComparisonExpression{ // Name: to.Ptr("category"), // Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), // Values: []*string{ // to.Ptr("Dev"), // to.Ptr("Prod")}, // }, // }, // { // Tags: &armconsumption.BudgetComparisonExpression{ // Name: to.Ptr("department"), // Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), // Values: []*string{ // to.Ptr("engineering"), // to.Ptr("sales")}, // }, // }}, // }, // Notifications: map[string]*armconsumption.Notification{ // "Actual_GreaterThan_80_Percent": &armconsumption.Notification{ // ContactEmails: []*string{ // to.Ptr("johndoe@contoso.com"), // to.Ptr("janesmith@contoso.com")}, // ContactGroups: []*string{ // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/microsoft.insights/actionGroups/SampleActionGroup")}, // ContactRoles: []*string{ // to.Ptr("Contributor"), // to.Ptr("Reader")}, // Enabled: to.Ptr(true), // Locale: to.Ptr(armconsumption.CultureCodeEnUs), // Operator: to.Ptr(armconsumption.OperatorTypeGreaterThan), // Threshold: to.Ptr[float64](80), // ThresholdType: to.Ptr(armconsumption.ThresholdTypeActual), // }, // }, // TimeGrain: to.Ptr(armconsumption.TimeGrainTypeMonthly), // TimePeriod: &armconsumption.BudgetTimePeriod{ // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T00:00:00.000Z"); return t}()), // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-01T00:00:00.000Z"); return t}()), // }, // }, // } }
Output:
func (*BudgetsClient) Delete ¶
func (client *BudgetsClient) Delete(ctx context.Context, scope string, budgetName string, options *BudgetsClientDeleteOptions) (BudgetsClientDeleteResponse, error)
Delete - The operation to delete a budget. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2021-10-01
- scope - The scope associated with budget 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}/invoiceSections/{invoiceSectionId}' for invoiceSection scope.
- budgetName - Budget Name.
- options - BudgetsClientDeleteOptions contains the optional parameters for the BudgetsClient.Delete method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/DeleteBudget.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } _, err = clientFactory.NewBudgetsClient().Delete(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "TestBudget", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } }
Output:
func (*BudgetsClient) Get ¶
func (client *BudgetsClient) Get(ctx context.Context, scope string, budgetName string, options *BudgetsClientGetOptions) (BudgetsClientGetResponse, error)
Get - Gets the budget for the scope by budget name. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2021-10-01
- scope - The scope associated with budget 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}/invoiceSections/{invoiceSectionId}' for invoiceSection scope.
- budgetName - Budget Name.
- options - BudgetsClientGetOptions contains the optional parameters for the BudgetsClient.Get method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/Budget.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewBudgetsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "TestBudget", 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.Budget = armconsumption.Budget{ // Name: to.Ptr("TestBudget"), // Type: to.Ptr("Microsoft.Consumption/budgets"), // ETag: to.Ptr("\"1d34d012214157f\""), // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/TestBudget"), // Properties: &armconsumption.BudgetProperties{ // Amount: to.Ptr[float64](100.65), // Category: to.Ptr(armconsumption.CategoryTypeCost), // CurrentSpend: &armconsumption.CurrentSpend{ // Amount: to.Ptr[float64](80.89), // Unit: to.Ptr("USD"), // }, // Filter: &armconsumption.BudgetFilter{ // And: []*armconsumption.BudgetFilterProperties{ // { // Dimensions: &armconsumption.BudgetComparisonExpression{ // Name: to.Ptr("ResourceId"), // Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), // Values: []*string{ // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/MSVM2"), // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/platformcloudplatformGeneric1")}, // }, // }, // { // Tags: &armconsumption.BudgetComparisonExpression{ // Name: to.Ptr("category"), // Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), // Values: []*string{ // to.Ptr("Dev"), // to.Ptr("Prod")}, // }, // }, // { // Tags: &armconsumption.BudgetComparisonExpression{ // Name: to.Ptr("department"), // Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), // Values: []*string{ // to.Ptr("engineering"), // to.Ptr("sales")}, // }, // }}, // }, // Notifications: map[string]*armconsumption.Notification{ // "Actual_GreaterThan_80_Percent": &armconsumption.Notification{ // ContactEmails: []*string{ // to.Ptr("johndoe@contoso.com"), // to.Ptr("janesmith@contoso.com")}, // ContactGroups: []*string{ // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/microsoft.insights/actionGroups/SampleActionGroup")}, // ContactRoles: []*string{ // to.Ptr("Contributor"), // to.Ptr("Reader")}, // Enabled: to.Ptr(true), // Operator: to.Ptr(armconsumption.OperatorTypeGreaterThan), // Threshold: to.Ptr[float64](80), // ThresholdType: to.Ptr(armconsumption.ThresholdTypeActual), // }, // }, // TimeGrain: to.Ptr(armconsumption.TimeGrainTypeMonthly), // TimePeriod: &armconsumption.BudgetTimePeriod{ // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T00:00:00.000Z"); return t}()), // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-01T00:00:00.000Z"); return t}()), // }, // }, // } }
Output:
func (*BudgetsClient) NewListPager ¶ added in v0.5.0
func (client *BudgetsClient) NewListPager(scope string, options *BudgetsClientListOptions) *runtime.Pager[BudgetsClientListResponse]
NewListPager - Lists all budgets for the defined scope.
Generated from API version 2021-10-01
- scope - The scope associated with budget 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}/invoiceSections/{invoiceSectionId}' for invoiceSection scope.
- options - BudgetsClientListOptions contains the optional parameters for the BudgetsClient.NewListPager method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/BudgetsList.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewBudgetsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", 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.BudgetsListResult = armconsumption.BudgetsListResult{ // Value: []*armconsumption.Budget{ // { // Name: to.Ptr("TestBudget"), // Type: to.Ptr("Microsoft.Consumption/budgets"), // ETag: to.Ptr("\"1d34d012214157f\""), // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/TestBudget"), // Properties: &armconsumption.BudgetProperties{ // Amount: to.Ptr[float64](100.65), // Category: to.Ptr(armconsumption.CategoryTypeCost), // CurrentSpend: &armconsumption.CurrentSpend{ // Amount: to.Ptr[float64](80.89), // Unit: to.Ptr("USD"), // }, // Filter: &armconsumption.BudgetFilter{ // And: []*armconsumption.BudgetFilterProperties{ // { // Dimensions: &armconsumption.BudgetComparisonExpression{ // Name: to.Ptr("ResourceId"), // Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), // Values: []*string{ // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/MSVM2"), // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/platformcloudplatformGeneric1")}, // }, // }, // { // Tags: &armconsumption.BudgetComparisonExpression{ // Name: to.Ptr("category"), // Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), // Values: []*string{ // to.Ptr("Dev"), // to.Ptr("Prod")}, // }, // }, // { // Tags: &armconsumption.BudgetComparisonExpression{ // Name: to.Ptr("department"), // Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), // Values: []*string{ // to.Ptr("engineering"), // to.Ptr("sales")}, // }, // }}, // }, // Notifications: map[string]*armconsumption.Notification{ // "Actual_GreaterThanOrEqualTo_90_Percent": &armconsumption.Notification{ // ContactEmails: []*string{ // to.Ptr("johndoe@contoso.com"), // to.Ptr("janesmith@contoso.com")}, // ContactGroups: []*string{ // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/microsoft.insights/actionGroups/SampleActionGroup")}, // ContactRoles: []*string{ // to.Ptr("Contributor"), // to.Ptr("Reader")}, // Enabled: to.Ptr(true), // Operator: to.Ptr(armconsumption.OperatorTypeGreaterThanOrEqualTo), // Threshold: to.Ptr[float64](90), // }, // "Actual_GreaterThan_80_Percent": &armconsumption.Notification{ // ContactEmails: []*string{ // to.Ptr("johndoe@contoso.com"), // to.Ptr("janesmith@contoso.com")}, // ContactRoles: []*string{ // to.Ptr("Contributor"), // to.Ptr("Reader")}, // Enabled: to.Ptr(true), // Operator: to.Ptr(armconsumption.OperatorTypeGreaterThan), // Threshold: to.Ptr[float64](80), // }, // "thresholdType": &armconsumption.Notification{ // }, // }, // TimeGrain: to.Ptr(armconsumption.TimeGrainTypeMonthly), // TimePeriod: &armconsumption.BudgetTimePeriod{ // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T00:00:00.000Z"); return t}()), // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-01T00:00:00.000Z"); return t}()), // }, // }, // }, // { // Name: to.Ptr("TestBudget"), // Type: to.Ptr("Microsoft.Consumption/budgets"), // ETag: to.Ptr("\"1d34d012214157f\""), // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/budgets/TestBudget"), // Properties: &armconsumption.BudgetProperties{ // Amount: to.Ptr[float64](600.65), // Category: to.Ptr(armconsumption.CategoryTypeCost), // CurrentSpend: &armconsumption.CurrentSpend{ // Amount: to.Ptr[float64](120.89), // Unit: to.Ptr("USD"), // }, // Filter: &armconsumption.BudgetFilter{ // And: []*armconsumption.BudgetFilterProperties{ // { // Dimensions: &armconsumption.BudgetComparisonExpression{ // Name: to.Ptr("ResourceId"), // Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), // Values: []*string{ // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/MSVM2"), // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/platformcloudplatformGeneric1")}, // }, // }, // { // Tags: &armconsumption.BudgetComparisonExpression{ // Name: to.Ptr("category"), // Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), // Values: []*string{ // to.Ptr("Dev"), // to.Ptr("Prod")}, // }, // }, // { // Tags: &armconsumption.BudgetComparisonExpression{ // Name: to.Ptr("department"), // Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), // Values: []*string{ // to.Ptr("engineering"), // to.Ptr("sales")}, // }, // }}, // }, // Notifications: map[string]*armconsumption.Notification{ // "Actual_GreaterThanOrEqualTo_60_Percent": &armconsumption.Notification{ // ContactEmails: []*string{ // to.Ptr("johndoe@contoso.com"), // to.Ptr("janesmith@contoso.com")}, // ContactGroups: []*string{ // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/microsoft.insights/actionGroups/SampleActionGroup")}, // ContactRoles: []*string{ // to.Ptr("Contributor"), // to.Ptr("Reader")}, // Enabled: to.Ptr(true), // Operator: to.Ptr(armconsumption.OperatorTypeGreaterThanOrEqualTo), // Threshold: to.Ptr[float64](60), // ThresholdType: to.Ptr(armconsumption.ThresholdTypeActual), // }, // "Actual_GreaterThan_40_Percent": &armconsumption.Notification{ // ContactEmails: []*string{ // to.Ptr("johndoe@contoso.com"), // to.Ptr("janesmith@contoso.com")}, // ContactRoles: []*string{ // to.Ptr("Contributor"), // to.Ptr("Reader")}, // Enabled: to.Ptr(true), // Operator: to.Ptr(armconsumption.OperatorTypeGreaterThan), // Threshold: to.Ptr[float64](40), // }, // }, // TimeGrain: to.Ptr(armconsumption.TimeGrainTypeMonthly), // TimePeriod: &armconsumption.BudgetTimePeriod{ // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T00:00:00.000Z"); return t}()), // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-01T00:00:00.000Z"); return t}()), // }, // }, // }}, // } } }
Output:
type BudgetsClientCreateOrUpdateOptions ¶ added in v0.3.0
type BudgetsClientCreateOrUpdateOptions struct { }
BudgetsClientCreateOrUpdateOptions contains the optional parameters for the BudgetsClient.CreateOrUpdate method.
type BudgetsClientCreateOrUpdateResponse ¶ added in v0.3.0
type BudgetsClientCreateOrUpdateResponse struct { // A budget resource. Budget }
BudgetsClientCreateOrUpdateResponse contains the response from method BudgetsClient.CreateOrUpdate.
type BudgetsClientDeleteOptions ¶ added in v0.3.0
type BudgetsClientDeleteOptions struct { }
BudgetsClientDeleteOptions contains the optional parameters for the BudgetsClient.Delete method.
type BudgetsClientDeleteResponse ¶ added in v0.3.0
type BudgetsClientDeleteResponse struct { }
BudgetsClientDeleteResponse contains the response from method BudgetsClient.Delete.
type BudgetsClientGetOptions ¶ added in v0.3.0
type BudgetsClientGetOptions struct { }
BudgetsClientGetOptions contains the optional parameters for the BudgetsClient.Get method.
type BudgetsClientGetResponse ¶ added in v0.3.0
type BudgetsClientGetResponse struct { // A budget resource. Budget }
BudgetsClientGetResponse contains the response from method BudgetsClient.Get.
type BudgetsClientListOptions ¶ added in v0.3.0
type BudgetsClientListOptions struct { }
BudgetsClientListOptions contains the optional parameters for the BudgetsClient.NewListPager method.
type BudgetsClientListResponse ¶ added in v0.3.0
type BudgetsClientListResponse struct { // Result of listing budgets. It contains a list of available budgets in the scope provided. BudgetsListResult }
BudgetsClientListResponse contains the response from method BudgetsClient.NewListPager.
type BudgetsListResult ¶
type BudgetsListResult struct { // READ-ONLY; The link (url) to the next page of results. NextLink *string // READ-ONLY; The list of budgets. Value []*Budget }
BudgetsListResult - Result of listing budgets. It contains a list of available budgets in the scope provided.
func (BudgetsListResult) MarshalJSON ¶
func (b BudgetsListResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BudgetsListResult.
func (*BudgetsListResult) UnmarshalJSON ¶ added in v1.1.0
func (b *BudgetsListResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type BudgetsListResult.
type CategoryType ¶
type CategoryType string
CategoryType - The category of the budget, whether the budget tracks cost or usage.
const (
CategoryTypeCost CategoryType = "Cost"
)
func PossibleCategoryTypeValues ¶
func PossibleCategoryTypeValues() []CategoryType
PossibleCategoryTypeValues returns the possible values for the CategoryType const type.
type ChargeSummary ¶
type ChargeSummary struct { // REQUIRED; Specifies the kind of charge summary. Kind *ChargeSummaryKind // 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 }
ChargeSummary - A charge summary resource.
func (*ChargeSummary) GetChargeSummary ¶
func (c *ChargeSummary) GetChargeSummary() *ChargeSummary
GetChargeSummary implements the ChargeSummaryClassification interface for type ChargeSummary.
func (ChargeSummary) MarshalJSON ¶ added in v1.1.0
func (c ChargeSummary) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChargeSummary.
func (*ChargeSummary) UnmarshalJSON ¶
func (c *ChargeSummary) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChargeSummary.
type ChargeSummaryClassification ¶
type ChargeSummaryClassification interface { // GetChargeSummary returns the ChargeSummary content of the underlying type. GetChargeSummary() *ChargeSummary }
ChargeSummaryClassification provides polymorphic access to related types. Call the interface's GetChargeSummary() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *ChargeSummary, *LegacyChargeSummary, *ModernChargeSummary
type ChargeSummaryKind ¶
type ChargeSummaryKind string
ChargeSummaryKind - Specifies the kind of charge summary.
const ( ChargeSummaryKindLegacy ChargeSummaryKind = "legacy" ChargeSummaryKindModern ChargeSummaryKind = "modern" )
func PossibleChargeSummaryKindValues ¶
func PossibleChargeSummaryKindValues() []ChargeSummaryKind
PossibleChargeSummaryKindValues returns the possible values for the ChargeSummaryKind const type.
type ChargesClient ¶
type ChargesClient struct {
// contains filtered or unexported fields
}
ChargesClient contains the methods for the Charges group. Don't use this type directly, use NewChargesClient() instead.
func NewChargesClient ¶
func NewChargesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ChargesClient, error)
NewChargesClient creates a new instance of ChargesClient with the specified values.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*ChargesClient) List ¶
func (client *ChargesClient) List(ctx context.Context, scope string, options *ChargesClientListOptions) (ChargesClientListResponse, error)
List - Lists the charges based for the defined scope. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2021-10-01
- scope - The scope associated with charges operations. This includes '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope. For department and enrollment accounts, you can also add billing period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to specify billing period at department scope use '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. 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 - ChargesClientListOptions contains the optional parameters for the ChargesClient.List method.
Example (ChangesForBillingPeriodByDepartmentLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesForBillingPeriodByDepartment.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/BillingAccounts/1234/departments/42425", &armconsumption.ChargesClientListOptions{StartDate: nil, EndDate: nil, Filter: nil, Apply: 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.ChargesListResult = armconsumption.ChargesListResult{ // Value: []armconsumption.ChargeSummaryClassification{ // &armconsumption.LegacyChargeSummary{ // Name: to.Ptr("chargeSummaryId1"), // Type: to.Ptr("Microsoft.Consumption/charges"), // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/departments/42425/providers/Microsoft.Consumption/charges/chargeSummaryId1"), // Kind: to.Ptr(armconsumption.ChargeSummaryKindLegacy), // Properties: &armconsumption.LegacyChargeSummaryProperties{ // AzureCharges: to.Ptr[float64](5000), // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/providers/Microsoft.Billing/billingPeriods/201804"), // ChargesBilledSeparately: to.Ptr[float64](60.9), // Currency: to.Ptr("USD"), // MarketplaceCharges: to.Ptr[float64](100), // UsageEnd: to.Ptr("2018-04-30"), // UsageStart: to.Ptr("2018-04-01"), // }, // }}, // } }
Output:
Example (ChangesForBillingPeriodByEnrollmentAccountLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesForBillingPeriodByEnrollmentAccount.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/BillingAccounts/1234/enrollmentAccounts/42425", &armconsumption.ChargesClientListOptions{StartDate: nil, EndDate: nil, Filter: nil, Apply: 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.ChargesListResult = armconsumption.ChargesListResult{ // Value: []armconsumption.ChargeSummaryClassification{ // &armconsumption.LegacyChargeSummary{ // Name: to.Ptr("chargeSummaryId1"), // Type: to.Ptr("Microsoft.Consumption/charges"), // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/enrollmentAccounts/42425/providers/Microsoft.Consumption/charges/chargeSummaryId1"), // Kind: to.Ptr(armconsumption.ChargeSummaryKindLegacy), // Properties: &armconsumption.LegacyChargeSummaryProperties{ // AzureCharges: to.Ptr[float64](5000), // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/providers/Microsoft.Billing/billingPeriods/201804"), // ChargesBilledSeparately: to.Ptr[float64](60.9), // Currency: to.Ptr("USD"), // MarketplaceCharges: to.Ptr[float64](100), // UsageEnd: to.Ptr("2018-04-30"), // UsageStart: to.Ptr("2018-04-01"), // }, // }}, // } }
Output:
Example (ChargesListByBillingAccountGroupByBillingProfileIdModern) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesListByModernBillingAccountGroupByBillingProfileId.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/1234:56789", &armconsumption.ChargesClientListOptions{StartDate: to.Ptr("2019-09-01"), EndDate: to.Ptr("2019-09-30"), Filter: nil, Apply: to.Ptr("groupby((properties/billingProfileId))"), }) 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.ChargesListResult = armconsumption.ChargesListResult{ // Value: []armconsumption.ChargeSummaryClassification{ // &armconsumption.ModernChargeSummary{ // Name: to.Ptr("chargeSummaryId1"), // Type: to.Ptr("Microsoft.Consumption/charges"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Consumption/charges/chargeSummaryId1"), // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), // Properties: &armconsumption.ModernChargeSummaryProperties{ // AzureCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](5000), // }, // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/123456/providers/Microsoft.Billing/billingPeriods/201909"), // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/123456"), // ChargesBilledSeparately: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](60.9), // }, // IsInvoiced: to.Ptr(false), // MarketplaceCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](100), // }, // UsageEnd: to.Ptr("2019-09-30"), // UsageStart: to.Ptr("2019-09-01"), // }, // }, // &armconsumption.ModernChargeSummary{ // Name: to.Ptr("chargeSummaryId2"), // Type: to.Ptr("Microsoft.Consumption/charges"), // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234:56789/billingProfiles/42425/providers/Microsoft.Consumption/charges/chargeSummaryId2"), // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), // Properties: &armconsumption.ModernChargeSummaryProperties{ // AzureCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](5000), // }, // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909"), // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"), // ChargesBilledSeparately: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](60.9), // }, // MarketplaceCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](100), // }, // UsageEnd: to.Ptr("2019-09-30"), // UsageStart: to.Ptr("2019-09-01"), // }, // }}, // } }
Output:
Example (ChargesListByBillingAccountGroupByCustomerIdModern) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesListByModernBillingAccountGroupByCustomerId.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/1234:56789", &armconsumption.ChargesClientListOptions{StartDate: to.Ptr("2019-09-01"), EndDate: to.Ptr("2019-09-30"), Filter: nil, Apply: to.Ptr("groupby((properties/customerId))"), }) 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.ChargesListResult = armconsumption.ChargesListResult{ // Value: []armconsumption.ChargeSummaryClassification{ // &armconsumption.ModernChargeSummary{ // Name: to.Ptr("chargeSummaryId1"), // Type: to.Ptr("Microsoft.Consumption/charges"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/customers/67890/providers/Microsoft.Consumption/charges/chargeSummaryId1"), // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), // Properties: &armconsumption.ModernChargeSummaryProperties{ // AzureCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](5000), // }, // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909"), // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"), // ChargesBilledSeparately: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](60.9), // }, // CustomerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/customers/67890"), // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/invoiceSections/67890"), // IsInvoiced: to.Ptr(false), // MarketplaceCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](100), // }, // UsageEnd: to.Ptr("2019-09-30"), // UsageStart: to.Ptr("2019-09-01"), // }, // }, // &armconsumption.ModernChargeSummary{ // Name: to.Ptr("chargeSummaryId2"), // Type: to.Ptr("Microsoft.Consumption/charges"), // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234:56789/customers/123456/providers/Microsoft.Consumption/charges/chargeSummaryId2"), // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), // Properties: &armconsumption.ModernChargeSummaryProperties{ // AzureCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](5000), // }, // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909"), // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"), // ChargesBilledSeparately: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](60.9), // }, // CustomerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/customers/123456"), // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/invoiceSections/67890"), // IsInvoiced: to.Ptr(false), // MarketplaceCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](100), // }, // UsageEnd: to.Ptr("2019-09-30"), // UsageStart: to.Ptr("2019-09-01"), // }, // }}, // } }
Output:
Example (ChargesListByBillingAccountGroupByInvoiceSectionIdModern) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesListByModernBillingAccountGroupByInvoiceSectionId.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425", &armconsumption.ChargesClientListOptions{StartDate: to.Ptr("2019-09-01"), EndDate: to.Ptr("2019-09-30"), Filter: nil, Apply: to.Ptr("groupby((properties/invoiceSectionId))"), }) 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.ChargesListResult = armconsumption.ChargesListResult{ // Value: []armconsumption.ChargeSummaryClassification{ // &armconsumption.ModernChargeSummary{ // Name: to.Ptr("chargeSummaryId1"), // Type: to.Ptr("Microsoft.Consumption/charges"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/4567/providers/Microsoft.Consumption/charges/chargeSummaryId1"), // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), // Properties: &armconsumption.ModernChargeSummaryProperties{ // AzureCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](5000), // }, // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909"), // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"), // ChargesBilledSeparately: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](60.9), // }, // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/invoiceSections/4567"), // IsInvoiced: to.Ptr(false), // MarketplaceCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](100), // }, // UsageEnd: to.Ptr("2019-09-30"), // UsageStart: to.Ptr("2019-09-01"), // }, // }, // &armconsumption.ModernChargeSummary{ // Name: to.Ptr("chargeSummaryId2"), // Type: to.Ptr("Microsoft.Consumption/charges"), // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234:56789//billingProfiles/42425/invoiceSections/67890/providers/Microsoft.Consumption/charges/chargeSummaryId2"), // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), // Properties: &armconsumption.ModernChargeSummaryProperties{ // AzureCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](5000), // }, // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909"), // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"), // ChargesBilledSeparately: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](60.9), // }, // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/invoiceSections/67890"), // IsInvoiced: to.Ptr(false), // MarketplaceCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](100), // }, // UsageEnd: to.Ptr("2019-09-30"), // UsageStart: to.Ptr("2019-09-01"), // }, // }}, // } }
Output:
Example (ChargesListByBillingAccountModern) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesListByModernBillingAccount.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/1234:56789", &armconsumption.ChargesClientListOptions{StartDate: to.Ptr("2019-09-01"), EndDate: to.Ptr("2019-10-31"), Filter: nil, Apply: 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.ChargesListResult = armconsumption.ChargesListResult{ // Value: []armconsumption.ChargeSummaryClassification{ // &armconsumption.ModernChargeSummary{ // Name: to.Ptr("chargeSummaryId1"), // Type: to.Ptr("Microsoft.Consumption/charges"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Consumption/charges/chargeSummaryId1"), // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), // Properties: &armconsumption.ModernChargeSummaryProperties{ // AzureCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](0), // }, // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201910"), // ChargesBilledSeparately: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](265.09), // }, // IsInvoiced: to.Ptr(false), // MarketplaceCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](0), // }, // UsageEnd: to.Ptr("2019-10-31"), // UsageStart: to.Ptr("2021-10-01"), // }, // }}, // } }
Output:
Example (ChargesListByBillingProfileGroupByInvoiceSectionIdModern) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesListByModernBillingProfileGroupByInvoiceSectionId.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425", &armconsumption.ChargesClientListOptions{StartDate: to.Ptr("2019-09-01"), EndDate: to.Ptr("2019-09-30"), Filter: nil, Apply: to.Ptr("groupby((properties/invoiceSectionId))"), }) 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.ChargesListResult = armconsumption.ChargesListResult{ // Value: []armconsumption.ChargeSummaryClassification{ // &armconsumption.ModernChargeSummary{ // Name: to.Ptr("chargeSummaryId1"), // Type: to.Ptr("Microsoft.Consumption/charges"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/4567/providers/Microsoft.Consumption/charges/chargeSummaryId1"), // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), // Properties: &armconsumption.ModernChargeSummaryProperties{ // AzureCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](5000), // }, // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909"), // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"), // ChargesBilledSeparately: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](60.9), // }, // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/invoiceSections/4567"), // IsInvoiced: to.Ptr(false), // MarketplaceCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](100), // }, // UsageEnd: to.Ptr("2019-09-30"), // UsageStart: to.Ptr("2019-09-01"), // }, // }, // &armconsumption.ModernChargeSummary{ // Name: to.Ptr("chargeSummaryId2"), // Type: to.Ptr("Microsoft.Consumption/charges"), // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234:56789//billingProfiles/42425/invoiceSections/67890/providers/Microsoft.Consumption/charges/chargeSummaryId2"), // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), // Properties: &armconsumption.ModernChargeSummaryProperties{ // AzureCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](5000), // }, // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909"), // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"), // ChargesBilledSeparately: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](60.9), // }, // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/invoiceSections/67890"), // IsInvoiced: to.Ptr(false), // MarketplaceCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](100), // }, // UsageEnd: to.Ptr("2019-09-30"), // UsageStart: to.Ptr("2019-09-01"), // }, // }}, // } }
Output:
Example (ChargesListByBillingProfileInvoiceSectionModern) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesListByModernBillingProfileInvoiceSection.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/67890", &armconsumption.ChargesClientListOptions{StartDate: to.Ptr("2019-09-01"), EndDate: to.Ptr("2019-10-31"), Filter: nil, Apply: 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.ChargesListResult = armconsumption.ChargesListResult{ // Value: []armconsumption.ChargeSummaryClassification{ // &armconsumption.ModernChargeSummary{ // Name: to.Ptr("chargeSummaryId1"), // Type: to.Ptr("Microsoft.Consumption/charges"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/67890/providers/Microsoft.Consumption/charges/chargeSummaryId1"), // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), // Properties: &armconsumption.ModernChargeSummaryProperties{ // AzureCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](5000), // }, // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909"), // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"), // ChargesBilledSeparately: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](60.9), // }, // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/4567"), // IsInvoiced: to.Ptr(false), // MarketplaceCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](100), // }, // UsageEnd: to.Ptr("2019-09-30"), // UsageStart: to.Ptr("2019-09-01"), // }, // }, // &armconsumption.ModernChargeSummary{ // Name: to.Ptr("chargeSummaryId2"), // Type: to.Ptr("Microsoft.Consumption/charges"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/67890/providers/Microsoft.Consumption/charges/chargeSummaryId2"), // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), // Properties: &armconsumption.ModernChargeSummaryProperties{ // AzureCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](5000), // }, // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201910"), // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"), // ChargesBilledSeparately: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](60.9), // }, // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/4567"), // IsInvoiced: to.Ptr(false), // MarketplaceCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](100), // }, // UsageEnd: to.Ptr("2019-10-31"), // UsageStart: to.Ptr("2021-10-01"), // }, // }}, // } }
Output:
Example (ChargesListByBillingProfileModern) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesListByModernBillingProfile.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/BillingAccounts/1234:56789/billingProfiles/2460", &armconsumption.ChargesClientListOptions{StartDate: nil, EndDate: nil, Filter: nil, Apply: 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.ChargesListResult = armconsumption.ChargesListResult{ // Value: []armconsumption.ChargeSummaryClassification{ // &armconsumption.ModernChargeSummary{ // Name: to.Ptr("chargeSummaryId1"), // Type: to.Ptr("Microsoft.Consumption/charges"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/2460/providers/Microsoft.Consumption/charges/chargeSummaryId1"), // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), // Properties: &armconsumption.ModernChargeSummaryProperties{ // AzureCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](0), // }, // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201910"), // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/2460"), // ChargesBilledSeparately: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](265.09), // }, // IsInvoiced: to.Ptr(false), // MarketplaceCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](0), // }, // UsageEnd: to.Ptr("2019-10-31"), // UsageStart: to.Ptr("2021-10-01"), // }, // }}, // } }
Output:
Example (ChargesListByCustomerModern) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesListByModernCustomer.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/BillingAccounts/1234:56789/customers/67890", &armconsumption.ChargesClientListOptions{StartDate: nil, EndDate: nil, Filter: nil, Apply: 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.ChargesListResult = armconsumption.ChargesListResult{ // Value: []armconsumption.ChargeSummaryClassification{ // &armconsumption.ModernChargeSummary{ // Name: to.Ptr("chargeSummaryId1"), // Type: to.Ptr("Microsoft.Consumption/charges"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/customers/67890/providers/Microsoft.Consumption/charges/chargeSummaryId1"), // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), // Properties: &armconsumption.ModernChargeSummaryProperties{ // AzureCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](0), // }, // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201910"), // ChargesBilledSeparately: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](265.09), // }, // IsInvoiced: to.Ptr(false), // MarketplaceCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](0), // }, // UsageEnd: to.Ptr("2019-10-31"), // UsageStart: to.Ptr("2021-10-01"), // }, // }}, // } }
Output:
Example (ChargesListByDepartmentLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesListForDepartmentFilterByStartEndDate.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/BillingAccounts/1234/departments/42425", &armconsumption.ChargesClientListOptions{StartDate: nil, EndDate: nil, Filter: to.Ptr("usageStart eq '2018-04-01' AND usageEnd eq '2018-05-30'"), Apply: 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.ChargesListResult = armconsumption.ChargesListResult{ // Value: []armconsumption.ChargeSummaryClassification{ // &armconsumption.LegacyChargeSummary{ // Name: to.Ptr("chargeSummaryId1"), // Type: to.Ptr("Microsoft.Consumption/charges"), // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/departments/42425/providers/Microsoft.Consumption/charges/chargeSummaryId1"), // Kind: to.Ptr(armconsumption.ChargeSummaryKindLegacy), // Properties: &armconsumption.LegacyChargeSummaryProperties{ // AzureCharges: to.Ptr[float64](5000), // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/providers/Microsoft.Billing/billingPeriods/201804"), // ChargesBilledSeparately: to.Ptr[float64](60.9), // Currency: to.Ptr("USD"), // MarketplaceCharges: to.Ptr[float64](100), // UsageEnd: to.Ptr("2018-04-30"), // UsageStart: to.Ptr("2018-04-01"), // }, // }}, // } }
Output:
Example (ChargesListByInvoiceSectionIdModern) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesListByModernInvoiceSectionId.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/BillingAccounts/1234:56789/invoiceSections/97531", &armconsumption.ChargesClientListOptions{StartDate: nil, EndDate: nil, Filter: nil, Apply: 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.ChargesListResult = armconsumption.ChargesListResult{ // Value: []armconsumption.ChargeSummaryClassification{ // &armconsumption.ModernChargeSummary{ // Name: to.Ptr("chargeSummaryId1"), // Type: to.Ptr("Microsoft.Consumption/charges"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/2460/invoiceSections/97531/providers/Microsoft.Consumption/charges/chargeSummaryId1"), // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), // Properties: &armconsumption.ModernChargeSummaryProperties{ // AzureCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](12), // }, // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201910"), // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/2460"), // ChargesBilledSeparately: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](0), // }, // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/2460/invoiceSections/97531"), // IsInvoiced: to.Ptr(false), // MarketplaceCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](0), // }, // UsageEnd: to.Ptr("2019-10-31"), // UsageStart: to.Ptr("2021-10-01"), // }, // }}, // } }
Output:
Example (ChargesListForEnrollmentAccountLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesListForEnrollmentAccountFilterByStartEndDate.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/BillingAccounts/1234/enrollmentAccounts/42425", &armconsumption.ChargesClientListOptions{StartDate: nil, EndDate: nil, Filter: nil, Apply: 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.ChargesListResult = armconsumption.ChargesListResult{ // Value: []armconsumption.ChargeSummaryClassification{ // &armconsumption.LegacyChargeSummary{ // Name: to.Ptr("chargeSummaryId1"), // Type: to.Ptr("Microsoft.Consumption/charges"), // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/enrollmentAccounts/42425/providers/Microsoft.Consumption/charges/chargeSummaryId1"), // Kind: to.Ptr(armconsumption.ChargeSummaryKindLegacy), // Properties: &armconsumption.LegacyChargeSummaryProperties{ // AzureCharges: to.Ptr[float64](5000), // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/providers/Microsoft.Billing/billingPeriods/201804"), // ChargesBilledSeparately: to.Ptr[float64](60.9), // Currency: to.Ptr("USD"), // MarketplaceCharges: to.Ptr[float64](100), // UsageEnd: to.Ptr("2018-04-30"), // UsageStart: to.Ptr("2018-04-01"), // }, // }}, // } }
Output:
type ChargesClientListOptions ¶ added in v0.3.0
type ChargesClientListOptions struct { // May be used to group charges for billingAccount scope by properties/billingProfileId, properties/invoiceSectionId, properties/customerId // (specific for Partner Led), or for billingProfile scope by // properties/invoiceSectionId. Apply *string // End date EndDate *string // May be used to filter charges by properties/usageEnd (Utc time), properties/usageStart (Utc time). The filter supports // 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', // 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). Filter *string // Start date StartDate *string }
ChargesClientListOptions contains the optional parameters for the ChargesClient.List method.
type ChargesClientListResponse ¶ added in v0.3.0
type ChargesClientListResponse struct { // Result of listing charge summary. ChargesListResult }
ChargesClientListResponse contains the response from method ChargesClient.List.
type ChargesListResult ¶
type ChargesListResult struct { // READ-ONLY; The list of charge summary Value []ChargeSummaryClassification }
ChargesListResult - Result of listing charge summary.
func (ChargesListResult) MarshalJSON ¶
func (c ChargesListResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChargesListResult.
func (*ChargesListResult) UnmarshalJSON ¶
func (c *ChargesListResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChargesListResult.
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(subscriptionID string, 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.
- subscriptionID - Azure Subscription ID.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*ClientFactory) NewAggregatedCostClient ¶ added in v1.1.0
func (c *ClientFactory) NewAggregatedCostClient() *AggregatedCostClient
NewAggregatedCostClient creates a new instance of AggregatedCostClient.
func (*ClientFactory) NewBalancesClient ¶ added in v1.1.0
func (c *ClientFactory) NewBalancesClient() *BalancesClient
NewBalancesClient creates a new instance of BalancesClient.
func (*ClientFactory) NewBudgetsClient ¶ added in v1.1.0
func (c *ClientFactory) NewBudgetsClient() *BudgetsClient
NewBudgetsClient creates a new instance of BudgetsClient.
func (*ClientFactory) NewChargesClient ¶ added in v1.1.0
func (c *ClientFactory) NewChargesClient() *ChargesClient
NewChargesClient creates a new instance of ChargesClient.
func (*ClientFactory) NewCreditsClient ¶ added in v1.1.0
func (c *ClientFactory) NewCreditsClient() *CreditsClient
NewCreditsClient creates a new instance of CreditsClient.
func (*ClientFactory) NewEventsClient ¶ added in v1.1.0
func (c *ClientFactory) NewEventsClient() *EventsClient
NewEventsClient creates a new instance of EventsClient.
func (*ClientFactory) NewLotsClient ¶ added in v1.1.0
func (c *ClientFactory) NewLotsClient() *LotsClient
NewLotsClient creates a new instance of LotsClient.
func (*ClientFactory) NewMarketplacesClient ¶ added in v1.1.0
func (c *ClientFactory) NewMarketplacesClient() *MarketplacesClient
NewMarketplacesClient creates a new instance of MarketplacesClient.
func (*ClientFactory) NewOperationsClient ¶ added in v1.1.0
func (c *ClientFactory) NewOperationsClient() *OperationsClient
NewOperationsClient creates a new instance of OperationsClient.
func (*ClientFactory) NewPriceSheetClient ¶ added in v1.1.0
func (c *ClientFactory) NewPriceSheetClient() *PriceSheetClient
NewPriceSheetClient creates a new instance of PriceSheetClient.
func (*ClientFactory) NewReservationRecommendationDetailsClient ¶ added in v1.1.0
func (c *ClientFactory) NewReservationRecommendationDetailsClient() *ReservationRecommendationDetailsClient
NewReservationRecommendationDetailsClient creates a new instance of ReservationRecommendationDetailsClient.
func (*ClientFactory) NewReservationRecommendationsClient ¶ added in v1.1.0
func (c *ClientFactory) NewReservationRecommendationsClient() *ReservationRecommendationsClient
NewReservationRecommendationsClient creates a new instance of ReservationRecommendationsClient.
func (*ClientFactory) NewReservationTransactionsClient ¶ added in v1.1.0
func (c *ClientFactory) NewReservationTransactionsClient() *ReservationTransactionsClient
NewReservationTransactionsClient creates a new instance of ReservationTransactionsClient.
func (*ClientFactory) NewReservationsDetailsClient ¶ added in v1.1.0
func (c *ClientFactory) NewReservationsDetailsClient() *ReservationsDetailsClient
NewReservationsDetailsClient creates a new instance of ReservationsDetailsClient.
func (*ClientFactory) NewReservationsSummariesClient ¶ added in v1.1.0
func (c *ClientFactory) NewReservationsSummariesClient() *ReservationsSummariesClient
NewReservationsSummariesClient creates a new instance of ReservationsSummariesClient.
func (*ClientFactory) NewTagsClient ¶ added in v1.1.0
func (c *ClientFactory) NewTagsClient() *TagsClient
NewTagsClient creates a new instance of TagsClient.
func (*ClientFactory) NewUsageDetailsClient ¶ added in v1.1.0
func (c *ClientFactory) NewUsageDetailsClient() *UsageDetailsClient
NewUsageDetailsClient creates a new instance of UsageDetailsClient.
type CreditBalanceSummary ¶
type CreditBalanceSummary struct { // READ-ONLY; Current balance. CurrentBalance *Amount // READ-ONLY; Estimated balance. EstimatedBalance *Amount // READ-ONLY; Estimated balance in billing currency. EstimatedBalanceInBillingCurrency *AmountWithExchangeRate }
CreditBalanceSummary - Summary of credit balances.
func (CreditBalanceSummary) MarshalJSON ¶ added in v1.1.0
func (c CreditBalanceSummary) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type CreditBalanceSummary.
func (*CreditBalanceSummary) UnmarshalJSON ¶ added in v1.1.0
func (c *CreditBalanceSummary) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type CreditBalanceSummary.
type CreditSummary ¶
type CreditSummary struct { // The properties of the credit summary. Properties *CreditSummaryProperties // READ-ONLY; The etag for the resource. Etag *string // READ-ONLY; The full qualified ARM ID of an event. ID *string // READ-ONLY; The ID that uniquely identifies an event. Name *string // READ-ONLY; Resource tags. Tags map[string]*string // READ-ONLY; Resource type. Type *string }
CreditSummary - A credit summary resource.
func (CreditSummary) MarshalJSON ¶
func (c CreditSummary) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type CreditSummary.
func (*CreditSummary) UnmarshalJSON ¶
func (c *CreditSummary) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type CreditSummary.
type CreditSummaryProperties ¶
type CreditSummaryProperties struct { // READ-ONLY; Summary of balances associated with this credit summary. BalanceSummary *CreditBalanceSummary // READ-ONLY; The billing currency. BillingCurrency *string // READ-ONLY; The credit currency. CreditCurrency *string // READ-ONLY; The eTag for the resource. ETag *string // READ-ONLY; Expired credit. ExpiredCredit *Amount // READ-ONLY; Pending credit adjustments. PendingCreditAdjustments *Amount // READ-ONLY; Pending eligible charges. PendingEligibleCharges *Amount // READ-ONLY; Credit's reseller. Reseller *Reseller }
CreditSummaryProperties - The properties of the credit summary.
func (CreditSummaryProperties) MarshalJSON ¶ added in v1.1.0
func (c CreditSummaryProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type CreditSummaryProperties.
func (*CreditSummaryProperties) UnmarshalJSON ¶ added in v1.1.0
func (c *CreditSummaryProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type CreditSummaryProperties.
type CreditsClient ¶
type CreditsClient struct {
// contains filtered or unexported fields
}
CreditsClient contains the methods for the Credits group. Don't use this type directly, use NewCreditsClient() instead.
func NewCreditsClient ¶
func NewCreditsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*CreditsClient, error)
NewCreditsClient creates a new instance of CreditsClient with the specified values.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*CreditsClient) Get ¶
func (client *CreditsClient) Get(ctx context.Context, billingAccountID string, billingProfileID string, options *CreditsClientGetOptions) (CreditsClientGetResponse, error)
Get - The credit summary by billingAccountId and billingProfileId. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2021-10-01
- billingAccountID - BillingAccount ID
- billingProfileID - Azure Billing Profile ID.
- options - CreditsClientGetOptions contains the optional parameters for the CreditsClient.Get method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/CreditSummaryByBillingProfile.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewCreditsClient().Get(ctx, "1234:5678", "2468", 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.CreditSummary = armconsumption.CreditSummary{ // Name: to.Ptr("balanceSummary1"), // Type: to.Ptr("Microsoft.Consumption/credits/balanceSummary"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/credits/balanceSummary1"), // Properties: &armconsumption.CreditSummaryProperties{ // BalanceSummary: &armconsumption.CreditBalanceSummary{ // CurrentBalance: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](100), // }, // EstimatedBalance: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](600), // }, // }, // BillingCurrency: to.Ptr("USD"), // CreditCurrency: to.Ptr("USD"), // ExpiredCredit: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](0), // }, // PendingCreditAdjustments: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](500), // }, // PendingEligibleCharges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](0), // }, // Reseller: &armconsumption.Reseller{ // ResellerDescription: to.Ptr("Reseller information."), // ResellerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/reseller/reseller1"), // }, // }, // } }
Output:
type CreditsClientGetOptions ¶ added in v0.3.0
type CreditsClientGetOptions struct { }
CreditsClientGetOptions contains the optional parameters for the CreditsClient.Get method.
type CreditsClientGetResponse ¶ added in v0.3.0
type CreditsClientGetResponse struct { // A credit summary resource. CreditSummary }
CreditsClientGetResponse contains the response from method CreditsClient.Get.
type CultureCode ¶ added in v0.3.0
type CultureCode string
CultureCode - Language in which the recipient will receive the notification
const ( CultureCodeCsCz CultureCode = "cs-cz" CultureCodeDaDk CultureCode = "da-dk" CultureCodeDeDe CultureCode = "de-de" CultureCodeEnGb CultureCode = "en-gb" CultureCodeEnUs CultureCode = "en-us" CultureCodeEsEs CultureCode = "es-es" CultureCodeFrFr CultureCode = "fr-fr" CultureCodeHuHu CultureCode = "hu-hu" CultureCodeItIt CultureCode = "it-it" CultureCodeJaJp CultureCode = "ja-jp" CultureCodeKoKr CultureCode = "ko-kr" CultureCodeNbNo CultureCode = "nb-no" CultureCodeNlNl CultureCode = "nl-nl" CultureCodePlPl CultureCode = "pl-pl" CultureCodePtBr CultureCode = "pt-br" CultureCodePtPt CultureCode = "pt-pt" CultureCodeRuRu CultureCode = "ru-ru" CultureCodeSvSe CultureCode = "sv-se" CultureCodeTrTr CultureCode = "tr-tr" CultureCodeZhCn CultureCode = "zh-cn" CultureCodeZhTw CultureCode = "zh-tw" )
func PossibleCultureCodeValues ¶ added in v0.3.0
func PossibleCultureCodeValues() []CultureCode
PossibleCultureCodeValues returns the possible values for the CultureCode const type.
type CurrentSpend ¶
type CurrentSpend struct { // READ-ONLY; The total amount of cost which is being tracked by the budget. Amount *float64 // READ-ONLY; The unit of measure for the budget amount. Unit *string }
CurrentSpend - The current amount of cost which is being tracked for a budget.
func (CurrentSpend) MarshalJSON ¶ added in v1.1.0
func (c CurrentSpend) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type CurrentSpend.
func (*CurrentSpend) UnmarshalJSON ¶ added in v1.1.0
func (c *CurrentSpend) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type CurrentSpend.
type Datagrain ¶
type Datagrain string
func PossibleDatagrainValues ¶
func PossibleDatagrainValues() []Datagrain
PossibleDatagrainValues returns the possible values for the Datagrain const type.
type DownloadProperties ¶
type DownloadProperties struct { // READ-ONLY; The link (url) to download the pricesheet. DownloadURL *string // READ-ONLY; Download link validity. ValidTill *string }
DownloadProperties - The properties of the price sheet download.
func (DownloadProperties) MarshalJSON ¶ added in v1.1.0
func (d DownloadProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type DownloadProperties.
func (*DownloadProperties) UnmarshalJSON ¶ added in v1.1.0
func (d *DownloadProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type DownloadProperties.
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 EventProperties ¶
type EventProperties struct { // Identifies the type of the event. EventType *EventType // READ-ONLY; The amount of balance adjustment. The property is not available for ConsumptionCommitment lots. Adjustments *Amount // READ-ONLY; The amount of balance adjustment in billing currency. AdjustmentsInBillingCurrency *AmountWithExchangeRate // READ-ONLY; The billing currency of the event. BillingCurrency *string // READ-ONLY; The display name of the billing profile for which the event happened. The property is only available for billing // account of type MicrosoftCustomerAgreement. BillingProfileDisplayName *string // READ-ONLY; The ID that uniquely identifies the billing profile for which the event happened. The property is only available // for billing account of type MicrosoftCustomerAgreement. BillingProfileID *string // READ-ONLY; Amount of canceled credit. CanceledCredit *Amount // READ-ONLY; The amount of charges for events of type SettleCharges and PendingEligibleCharges. Charges *Amount // READ-ONLY; The amount of charges for events of type SettleCharges and PendingEligibleCharges in billing currency. ChargesInBillingCurrency *AmountWithExchangeRate // READ-ONLY; The balance after the event. ClosedBalance *Amount // READ-ONLY; The balance in billing currency after the event. ClosedBalanceInBillingCurrency *AmountWithExchangeRate // READ-ONLY; The credit currency of the event. CreditCurrency *string // READ-ONLY; The amount of expired credit or commitment for NewCredit or SettleCharges event. CreditExpired *Amount // READ-ONLY; The amount of expired credit or commitment for NewCredit or SettleCharges event in billing currency. CreditExpiredInBillingCurrency *AmountWithExchangeRate // READ-ONLY; The description of the event. Description *string // READ-ONLY; The eTag for the resource. ETag *string // READ-ONLY; The number which uniquely identifies the invoice on which the event was billed. This will be empty for unbilled // events. InvoiceNumber *string // READ-ONLY; The ID that uniquely identifies the lot for which the event happened. LotID *string // READ-ONLY; Identifies the source of the lot for which the event happened. LotSource *string // READ-ONLY; The amount of new credit or commitment for NewCredit or SettleCharges event. NewCredit *Amount // READ-ONLY; The amount of new credit or commitment for NewCredit or SettleCharges event in billing currency. NewCreditInBillingCurrency *AmountWithExchangeRate // READ-ONLY; The reseller of the event. Reseller *Reseller // READ-ONLY; The date of the event. TransactionDate *time.Time }
EventProperties - The event properties.
func (EventProperties) MarshalJSON ¶
func (e EventProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type EventProperties.
func (*EventProperties) UnmarshalJSON ¶
func (e *EventProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type EventProperties.
type EventSummary ¶
type EventSummary 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 event properties. Properties *EventProperties // READ-ONLY; Resource Id. ID *string // READ-ONLY; Resource name. Name *string // READ-ONLY; Resource type. Type *string }
EventSummary - An event summary resource.
func (EventSummary) MarshalJSON ¶
func (e EventSummary) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type EventSummary.
func (*EventSummary) UnmarshalJSON ¶
func (e *EventSummary) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type EventSummary.
type EventType ¶
type EventType string
EventType - Identifies the type of the event.
const ( EventTypeNewCredit EventType = "NewCredit" EventTypePendingAdjustments EventType = "PendingAdjustments" EventTypePendingCharges EventType = "PendingCharges" EventTypePendingExpiredCredit EventType = "PendingExpiredCredit" EventTypePendingNewCredit EventType = "PendingNewCredit" EventTypeSettledCharges EventType = "SettledCharges" EventTypeUnKnown EventType = "UnKnown" )
func PossibleEventTypeValues ¶
func PossibleEventTypeValues() []EventType
PossibleEventTypeValues returns the possible values for the EventType const type.
type Events ¶
type Events struct { // READ-ONLY; The link (url) to the next page of results. NextLink *string // READ-ONLY; The list of event summary. Value []*EventSummary }
Events - Result of listing event summary.
func (Events) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface for type Events.
func (*Events) UnmarshalJSON ¶ added in v1.1.0
UnmarshalJSON implements the json.Unmarshaller interface for type Events.
type EventsClient ¶
type EventsClient struct {
// contains filtered or unexported fields
}
EventsClient contains the methods for the Events group. Don't use this type directly, use NewEventsClient() instead.
func NewEventsClient ¶
func NewEventsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*EventsClient, error)
NewEventsClient creates a new instance of EventsClient with the specified values.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*EventsClient) NewListByBillingAccountPager ¶ added in v0.5.0
func (client *EventsClient) NewListByBillingAccountPager(billingAccountID string, options *EventsClientListByBillingAccountOptions) *runtime.Pager[EventsClientListByBillingAccountResponse]
NewListByBillingAccountPager - Lists the events that decrements Azure credits or Microsoft Azure consumption commitment for a billing account or a billing profile for a given start and end date.
Generated from API version 2021-10-01
- billingAccountID - BillingAccount ID
- options - EventsClientListByBillingAccountOptions contains the optional parameters for the EventsClient.NewListByBillingAccountPager method.
Example (EventsGetByBillingAccount) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/EventsGetByBillingAccount.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewEventsClient().NewListByBillingAccountPager("1234:5678", &armconsumption.EventsClientListByBillingAccountOptions{Filter: 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.Events = armconsumption.Events{ // Value: []*armconsumption.EventSummary{ // { // Name: to.Ptr("eventId1"), // Type: to.Ptr("Microsoft.Consumption/events"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Consumption/events/eventId1"), // Properties: &armconsumption.EventProperties{ // Description: to.Ptr("New MACC Added"), // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/X3TD-KVTT-BG7-TGB"), // Charges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](500), // }, // ClosedBalance: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](500), // }, // EventType: to.Ptr(armconsumption.EventTypeNewCredit), // InvoiceNumber: to.Ptr("3304"), // LotID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/Microsoft.Consumption/lots/G202001083926600XXXXX"), // LotSource: to.Ptr("ConsumptionCommitment"), // NewCredit: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](500), // }, // TransactionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T00:00:00.000Z"); return t}()), // }, // }, // { // Name: to.Ptr("eventId2"), // Type: to.Ptr("Microsoft.Consumption/events"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Consumption/events/eventId2"), // Properties: &armconsumption.EventProperties{ // Description: to.Ptr("Balance after invoice 3304"), // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/X3TD-KVTT-BG7-TGB"), // Charges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](500), // }, // ClosedBalance: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](500), // }, // EventType: to.Ptr(armconsumption.EventTypeSettledCharges), // InvoiceNumber: to.Ptr("3304"), // LotID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/Microsoft.Consumption/lots/7004bc39-974d-482e-8e45-caf91dba0870"), // LotSource: to.Ptr("AzurePrepayment"), // TransactionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T00:00:00.000Z"); return t}()), // }, // }}, // } } }
Output:
Example (EventsGetByBillingAccountWithFilters) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/EventsGetByBillingAccountWithFilters.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewEventsClient().NewListByBillingAccountPager("1234:5678", &armconsumption.EventsClientListByBillingAccountOptions{Filter: to.Ptr("lotid eq 'G202001083926600XXXXX' AND lotsource eq 'consumptioncommitment'")}) 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.Events = armconsumption.Events{ // Value: []*armconsumption.EventSummary{ // { // Name: to.Ptr("eventId1"), // Type: to.Ptr("Microsoft.Consumption/events"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Consumption/events/eventId1"), // Properties: &armconsumption.EventProperties{ // Description: to.Ptr("MACC Canceled"), // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/X3TD-KVTT-BG7-TGB"), // CanceledCredit: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](200), // }, // ClosedBalance: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](500), // }, // EventType: to.Ptr(armconsumption.EventType("CanceledCredit")), // InvoiceNumber: to.Ptr("3304"), // LotID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/Microsoft.Consumption/lots/G202001083926600XXXXX"), // LotSource: to.Ptr("ConsumptionCommitment"), // TransactionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T00:00:00.000Z"); return t}()), // }, // }}, // } } }
Output:
func (*EventsClient) NewListByBillingProfilePager ¶ added in v0.5.0
func (client *EventsClient) NewListByBillingProfilePager(billingAccountID string, billingProfileID string, startDate string, endDate string, options *EventsClientListByBillingProfileOptions) *runtime.Pager[EventsClientListByBillingProfileResponse]
NewListByBillingProfilePager - Lists the events that decrements Azure credits or Microsoft Azure consumption commitment for a billing account or a billing profile for a given start and end date.
Generated from API version 2021-10-01
- billingAccountID - BillingAccount ID
- billingProfileID - Azure Billing Profile ID.
- startDate - Start date
- endDate - End date
- options - EventsClientListByBillingProfileOptions contains the optional parameters for the EventsClient.NewListByBillingProfilePager method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/EventsListByBillingProfile.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewEventsClient().NewListByBillingProfilePager("1234:5678", "4268", "2019-09-01", "2019-10-31", 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.Events = armconsumption.Events{ // Value: []*armconsumption.EventSummary{ // { // Name: to.Ptr("event1"), // Type: to.Ptr("Microsoft.Consumption/events"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/4268/providers/Microsoft.Consumption/events/event1"), // Properties: &armconsumption.EventProperties{ // Description: to.Ptr("Settled invoice #312033"), // Adjustments: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](0), // }, // AdjustmentsInBillingCurrency: &armconsumption.AmountWithExchangeRate{ // ExchangeRate: to.Ptr[float64](5000), // ExchangeRateMonth: to.Ptr[int32](1), // }, // BillingCurrency: to.Ptr("USD"), // Charges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](500), // }, // ChargesInBillingCurrency: &armconsumption.AmountWithExchangeRate{ // ExchangeRate: to.Ptr[float64](5000), // ExchangeRateMonth: to.Ptr[int32](1), // }, // ClosedBalance: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](500), // }, // ClosedBalanceInBillingCurrency: &armconsumption.AmountWithExchangeRate{ // ExchangeRate: to.Ptr[float64](5000), // ExchangeRateMonth: to.Ptr[int32](1), // }, // CreditCurrency: to.Ptr("USD"), // CreditExpired: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](0), // }, // CreditExpiredInBillingCurrency: &armconsumption.AmountWithExchangeRate{ // ExchangeRate: to.Ptr[float64](5000), // ExchangeRateMonth: to.Ptr[int32](1), // }, // EventType: to.Ptr(armconsumption.EventTypeSettledCharges), // InvoiceNumber: to.Ptr("3301"), // NewCredit: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](0), // }, // NewCreditInBillingCurrency: &armconsumption.AmountWithExchangeRate{ // ExchangeRate: to.Ptr[float64](5000), // ExchangeRateMonth: to.Ptr[int32](1), // }, // Reseller: &armconsumption.Reseller{ // ResellerDescription: to.Ptr("Reseller information"), // ResellerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/reseller/reseller1"), // }, // TransactionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T00:00:00.000Z"); return t}()), // }, // }, // { // Name: to.Ptr("event2"), // Type: to.Ptr("Microsoft.Consumption/events"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/4268/providers/Microsoft.Consumption/events/event2"), // Properties: &armconsumption.EventProperties{ // Description: to.Ptr("New credits added"), // Adjustments: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](0), // }, // AdjustmentsInBillingCurrency: &armconsumption.AmountWithExchangeRate{ // ExchangeRate: to.Ptr[float64](5000), // ExchangeRateMonth: to.Ptr[int32](1), // }, // BillingCurrency: to.Ptr("USD"), // CanceledCredit: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](5000), // }, // Charges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](0), // }, // ChargesInBillingCurrency: &armconsumption.AmountWithExchangeRate{ // ExchangeRate: to.Ptr[float64](5000), // ExchangeRateMonth: to.Ptr[int32](1), // }, // ClosedBalance: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](900), // }, // ClosedBalanceInBillingCurrency: &armconsumption.AmountWithExchangeRate{ // ExchangeRate: to.Ptr[float64](5000), // ExchangeRateMonth: to.Ptr[int32](1), // }, // CreditCurrency: to.Ptr("USD"), // CreditExpired: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](0), // }, // CreditExpiredInBillingCurrency: &armconsumption.AmountWithExchangeRate{ // ExchangeRate: to.Ptr[float64](5000), // ExchangeRateMonth: to.Ptr[int32](1), // }, // EventType: to.Ptr(armconsumption.EventTypeNewCredit), // InvoiceNumber: to.Ptr("3302"), // NewCredit: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](400), // }, // NewCreditInBillingCurrency: &armconsumption.AmountWithExchangeRate{ // ExchangeRate: to.Ptr[float64](5000), // ExchangeRateMonth: to.Ptr[int32](1), // }, // Reseller: &armconsumption.Reseller{ // ResellerDescription: to.Ptr("Reseller information"), // ResellerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/reseller/reseller1"), // }, // TransactionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-01T00:00:00.000Z"); return t}()), // }, // }, // { // Name: to.Ptr("event3"), // Type: to.Ptr("Microsoft.Consumption/events"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/4268/providers/Microsoft.Consumption/events/event3"), // Properties: &armconsumption.EventProperties{ // Description: to.Ptr("Credits Expired"), // Adjustments: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](0), // }, // AdjustmentsInBillingCurrency: &armconsumption.AmountWithExchangeRate{ // ExchangeRate: to.Ptr[float64](5000), // ExchangeRateMonth: to.Ptr[int32](1), // }, // BillingCurrency: to.Ptr("USD"), // CanceledCredit: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](5000), // }, // Charges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](0), // }, // ChargesInBillingCurrency: &armconsumption.AmountWithExchangeRate{ // ExchangeRate: to.Ptr[float64](5000), // ExchangeRateMonth: to.Ptr[int32](1), // }, // ClosedBalance: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](600), // }, // ClosedBalanceInBillingCurrency: &armconsumption.AmountWithExchangeRate{ // ExchangeRate: to.Ptr[float64](5000), // ExchangeRateMonth: to.Ptr[int32](1), // }, // CreditCurrency: to.Ptr("USD"), // CreditExpired: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](300), // }, // CreditExpiredInBillingCurrency: &armconsumption.AmountWithExchangeRate{ // ExchangeRate: to.Ptr[float64](5000), // ExchangeRateMonth: to.Ptr[int32](1), // }, // EventType: to.Ptr(armconsumption.EventType("ExpiredCredit")), // InvoiceNumber: to.Ptr(""), // NewCredit: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](0), // }, // NewCreditInBillingCurrency: &armconsumption.AmountWithExchangeRate{ // ExchangeRate: to.Ptr[float64](5000), // ExchangeRateMonth: to.Ptr[int32](1), // }, // Reseller: &armconsumption.Reseller{ // ResellerDescription: to.Ptr("Reseller information"), // ResellerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/reseller/reseller1"), // }, // TransactionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-01T00:00:00.000Z"); return t}()), // }, // }, // { // Name: to.Ptr("event4"), // Type: to.Ptr("Microsoft.Consumption/events"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/4268/providers/Microsoft.Consumption/events/event4"), // Properties: &armconsumption.EventProperties{ // Description: to.Ptr("Settled invoice #212033"), // Adjustments: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](-200), // }, // AdjustmentsInBillingCurrency: &armconsumption.AmountWithExchangeRate{ // ExchangeRate: to.Ptr[float64](5000), // ExchangeRateMonth: to.Ptr[int32](1), // }, // BillingCurrency: to.Ptr("USD"), // CanceledCredit: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](5000), // }, // Charges: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](300), // }, // ChargesInBillingCurrency: &armconsumption.AmountWithExchangeRate{ // ExchangeRate: to.Ptr[float64](5000), // ExchangeRateMonth: to.Ptr[int32](1), // }, // ClosedBalance: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](700), // }, // ClosedBalanceInBillingCurrency: &armconsumption.AmountWithExchangeRate{ // ExchangeRate: to.Ptr[float64](5000), // ExchangeRateMonth: to.Ptr[int32](1), // }, // CreditCurrency: to.Ptr("USD"), // CreditExpired: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](100), // }, // CreditExpiredInBillingCurrency: &armconsumption.AmountWithExchangeRate{ // ExchangeRate: to.Ptr[float64](5000), // ExchangeRateMonth: to.Ptr[int32](1), // }, // EventType: to.Ptr(armconsumption.EventTypeSettledCharges), // InvoiceNumber: to.Ptr("3303"), // NewCredit: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](300), // }, // NewCreditInBillingCurrency: &armconsumption.AmountWithExchangeRate{ // ExchangeRate: to.Ptr[float64](5000), // ExchangeRateMonth: to.Ptr[int32](1), // }, // Reseller: &armconsumption.Reseller{ // ResellerDescription: to.Ptr("Reseller information"), // ResellerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/reseller/reseller1"), // }, // TransactionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.000Z"); return t}()), // }, // }}, // } } }
Output:
type EventsClientListByBillingAccountOptions ¶ added in v0.3.0
type EventsClientListByBillingAccountOptions struct { // May be used to filter the events by lotId, lotSource etc. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. // It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value // pair string where key and value is separated by a colon (:). Filter *string }
EventsClientListByBillingAccountOptions contains the optional parameters for the EventsClient.NewListByBillingAccountPager method.
type EventsClientListByBillingAccountResponse ¶ added in v0.3.0
type EventsClientListByBillingAccountResponse struct { // Result of listing event summary. Events }
EventsClientListByBillingAccountResponse contains the response from method EventsClient.NewListByBillingAccountPager.
type EventsClientListByBillingProfileOptions ¶ added in v0.3.0
type EventsClientListByBillingProfileOptions struct { }
EventsClientListByBillingProfileOptions contains the optional parameters for the EventsClient.NewListByBillingProfilePager method.
type EventsClientListByBillingProfileResponse ¶ added in v0.3.0
type EventsClientListByBillingProfileResponse struct { // Result of listing event summary. Events }
EventsClientListByBillingProfileResponse contains the response from method EventsClient.NewListByBillingProfilePager.
type ForecastSpend ¶
type ForecastSpend struct { // READ-ONLY; The forecasted cost for the total time period which is being tracked by the budget. This value is only provided // if the budget contains a forecast alert type. Amount *float64 // READ-ONLY; The unit of measure for the budget amount. Unit *string }
ForecastSpend - The forecasted cost which is being tracked for a budget.
func (ForecastSpend) MarshalJSON ¶ added in v1.1.0
func (f ForecastSpend) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ForecastSpend.
func (*ForecastSpend) UnmarshalJSON ¶ added in v1.1.0
func (f *ForecastSpend) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ForecastSpend.
type HighCasedErrorDetails ¶
type HighCasedErrorDetails struct { // READ-ONLY; Error code. Code *string // READ-ONLY; Error message indicating why the operation failed. Message *string }
HighCasedErrorDetails - The details of the error.
func (HighCasedErrorDetails) MarshalJSON ¶ added in v1.1.0
func (h HighCasedErrorDetails) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type HighCasedErrorDetails.
func (*HighCasedErrorDetails) UnmarshalJSON ¶ added in v1.1.0
func (h *HighCasedErrorDetails) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type HighCasedErrorDetails.
type HighCasedErrorResponse ¶
type HighCasedErrorResponse struct { // The details of the error. Error *HighCasedErrorDetails }
HighCasedErrorResponse - 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 (HighCasedErrorResponse) MarshalJSON ¶ added in v1.1.0
func (h HighCasedErrorResponse) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type HighCasedErrorResponse.
func (*HighCasedErrorResponse) UnmarshalJSON ¶ added in v1.1.0
func (h *HighCasedErrorResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type HighCasedErrorResponse.
type LegacyChargeSummary ¶
type LegacyChargeSummary struct { // REQUIRED; Specifies the kind of charge summary. Kind *ChargeSummaryKind // REQUIRED; Properties for legacy charge summary Properties *LegacyChargeSummaryProperties // 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 }
LegacyChargeSummary - Legacy charge summary.
func (*LegacyChargeSummary) GetChargeSummary ¶ added in v0.3.0
func (l *LegacyChargeSummary) GetChargeSummary() *ChargeSummary
GetChargeSummary implements the ChargeSummaryClassification interface for type LegacyChargeSummary.
func (LegacyChargeSummary) MarshalJSON ¶
func (l LegacyChargeSummary) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type LegacyChargeSummary.
func (*LegacyChargeSummary) UnmarshalJSON ¶
func (l *LegacyChargeSummary) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type LegacyChargeSummary.
type LegacyChargeSummaryProperties ¶
type LegacyChargeSummaryProperties struct { // READ-ONLY; Azure Charges. AzureCharges *float64 // READ-ONLY; The id of the billing period resource that the charge belongs to. BillingPeriodID *string // READ-ONLY; Charges Billed separately. ChargesBilledSeparately *float64 // READ-ONLY; Currency Code Currency *string // READ-ONLY; Marketplace Charges. MarketplaceCharges *float64 // READ-ONLY; Usage end date. UsageEnd *string // READ-ONLY; Usage start date. UsageStart *string }
LegacyChargeSummaryProperties - The properties of legacy charge summary.
func (LegacyChargeSummaryProperties) MarshalJSON ¶ added in v1.1.0
func (l LegacyChargeSummaryProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type LegacyChargeSummaryProperties.
func (*LegacyChargeSummaryProperties) UnmarshalJSON ¶ added in v1.1.0
func (l *LegacyChargeSummaryProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type LegacyChargeSummaryProperties.
type LegacyReservationRecommendation ¶
type LegacyReservationRecommendation struct { // REQUIRED; Specifies the kind of reservation recommendation. Kind *ReservationRecommendationKind // REQUIRED; Properties for legacy reservation recommendation Properties LegacyReservationRecommendationPropertiesClassification // READ-ONLY; The etag for the resource. Etag *string // READ-ONLY; The full qualified ARM ID of an event. ID *string // READ-ONLY; Resource location Location *string // READ-ONLY; The ID that uniquely identifies an event. Name *string // READ-ONLY; Resource sku SKU *string // READ-ONLY; Resource tags. Tags map[string]*string // READ-ONLY; Resource type. Type *string }
LegacyReservationRecommendation - Legacy reservation recommendation.
func (*LegacyReservationRecommendation) GetReservationRecommendation ¶ added in v0.3.0
func (l *LegacyReservationRecommendation) GetReservationRecommendation() *ReservationRecommendation
GetReservationRecommendation implements the ReservationRecommendationClassification interface for type LegacyReservationRecommendation.
func (LegacyReservationRecommendation) MarshalJSON ¶
func (l LegacyReservationRecommendation) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type LegacyReservationRecommendation.
func (*LegacyReservationRecommendation) UnmarshalJSON ¶
func (l *LegacyReservationRecommendation) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type LegacyReservationRecommendation.
type LegacyReservationRecommendationProperties ¶
type LegacyReservationRecommendationProperties struct { // REQUIRED; Shared or single recommendation. Scope *string // READ-ONLY; The total amount of cost without reserved instances. CostWithNoReservedInstances *float64 // READ-ONLY; The usage date for looking back. FirstUsageDate *time.Time // READ-ONLY; The instance Flexibility Group. InstanceFlexibilityGroup *string // READ-ONLY; The instance Flexibility Ratio. InstanceFlexibilityRatio *float32 // READ-ONLY; The number of days of usage to look back for recommendation. LookBackPeriod *string // READ-ONLY; The meter id (GUID) MeterID *string // READ-ONLY; Total estimated savings with reserved instances. NetSavings *float64 // READ-ONLY; The normalized Size. NormalizedSize *string // READ-ONLY; Recommended quality for reserved instances. RecommendedQuantity *float64 // READ-ONLY; The recommended Quantity Normalized. RecommendedQuantityNormalized *float32 // READ-ONLY; The azure resource type. ResourceType *string // READ-ONLY; List of sku properties SKUProperties []*SKUProperty // READ-ONLY; RI recommendations in one or three year terms. Term *string // READ-ONLY; The total amount of cost with reserved instances. TotalCostWithReservedInstances *float64 }
LegacyReservationRecommendationProperties - The properties of the reservation recommendation.
func (*LegacyReservationRecommendationProperties) GetLegacyReservationRecommendationProperties ¶ added in v0.3.0
func (l *LegacyReservationRecommendationProperties) GetLegacyReservationRecommendationProperties() *LegacyReservationRecommendationProperties
GetLegacyReservationRecommendationProperties implements the LegacyReservationRecommendationPropertiesClassification interface for type LegacyReservationRecommendationProperties.
func (LegacyReservationRecommendationProperties) MarshalJSON ¶
func (l LegacyReservationRecommendationProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type LegacyReservationRecommendationProperties.
func (*LegacyReservationRecommendationProperties) UnmarshalJSON ¶
func (l *LegacyReservationRecommendationProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type LegacyReservationRecommendationProperties.
type LegacyReservationRecommendationPropertiesClassification ¶ added in v0.3.0
type LegacyReservationRecommendationPropertiesClassification interface { // GetLegacyReservationRecommendationProperties returns the LegacyReservationRecommendationProperties content of the underlying type. GetLegacyReservationRecommendationProperties() *LegacyReservationRecommendationProperties }
LegacyReservationRecommendationPropertiesClassification provides polymorphic access to related types. Call the interface's GetLegacyReservationRecommendationProperties() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *LegacyReservationRecommendationProperties, *LegacySharedScopeReservationRecommendationProperties, *LegacySingleScopeReservationRecommendationProperties
type LegacyReservationTransaction ¶
type LegacyReservationTransaction struct { // The properties of a legacy reservation transaction. Properties *LegacyReservationTransactionProperties // READ-ONLY; Resource Id. ID *string // READ-ONLY; Resource name. Name *string // READ-ONLY; Resource tags. Tags []*string // READ-ONLY; Resource type. Type *string }
LegacyReservationTransaction - Legacy Reservation transaction resource.
func (LegacyReservationTransaction) MarshalJSON ¶ added in v0.3.0
func (l LegacyReservationTransaction) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type LegacyReservationTransaction.
func (*LegacyReservationTransaction) UnmarshalJSON ¶ added in v1.1.0
func (l *LegacyReservationTransaction) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type LegacyReservationTransaction.
type LegacyReservationTransactionProperties ¶
type LegacyReservationTransactionProperties struct { // READ-ONLY; The name of the account that makes the transaction. AccountName *string // READ-ONLY; The email of the account owner that makes the transaction. AccountOwnerEmail *string // READ-ONLY; The charge of the transaction. Amount *float64 // READ-ONLY; This is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. ArmSKUName *string // READ-ONLY; The billing frequency, which can be either one-time or recurring. BillingFrequency *string // READ-ONLY; The billing month(yyyyMMdd), on which the event initiated. BillingMonth *int32 // READ-ONLY; The cost center of this department if it is a department and a cost center is provided. CostCenter *string // READ-ONLY; The ISO currency in which the transaction is charged, for example, USD. Currency *string // READ-ONLY; The current enrollment. CurrentEnrollment *string // READ-ONLY; The department name. DepartmentName *string // READ-ONLY; The description of the transaction. Description *string // READ-ONLY; The date of the transaction EventDate *time.Time // READ-ONLY; The type of the transaction (Purchase, Cancel, etc.) EventType *string // READ-ONLY; The monetary commitment amount at the enrollment scope. MonetaryCommitment *float64 // READ-ONLY; The overage amount at the enrollment scope. Overage *float64 // READ-ONLY; The purchasing enrollment. PurchasingEnrollment *string // READ-ONLY; The subscription guid that makes the transaction. PurchasingSubscriptionGUID *string // READ-ONLY; The subscription name that makes the transaction. PurchasingSubscriptionName *string // READ-ONLY; The quantity of the transaction. Quantity *float64 // READ-ONLY; The region of the transaction. Region *string // READ-ONLY; The reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents // a single purchase transaction. A reservation order contains reservations. The reservation // order specifies the VM size and region for the reservations. ReservationOrderID *string // READ-ONLY; The name of the reservation order. ReservationOrderName *string // READ-ONLY; This is the term of the transaction. Term *string }
LegacyReservationTransactionProperties - The properties of a legacy reservation transaction.
func (LegacyReservationTransactionProperties) MarshalJSON ¶
func (l LegacyReservationTransactionProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type LegacyReservationTransactionProperties.
func (*LegacyReservationTransactionProperties) UnmarshalJSON ¶
func (l *LegacyReservationTransactionProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type LegacyReservationTransactionProperties.
type LegacySharedScopeReservationRecommendationProperties ¶ added in v0.3.0
type LegacySharedScopeReservationRecommendationProperties struct { string CostWithNoReservedInstances *float64 FirstUsageDate *time.Time InstanceFlexibilityGroup *string InstanceFlexibilityRatio *float32 LookBackPeriod *string MeterID *string NetSavings *float64 NormalizedSize *string RecommendedQuantity *float64 RecommendedQuantityNormalized *float32 ResourceType *string SKUProperties []*SKUProperty Term *string TotalCostWithReservedInstances *float64 }Scope *
LegacySharedScopeReservationRecommendationProperties - The properties of the legacy reservation recommendation for shared scope.
func (*LegacySharedScopeReservationRecommendationProperties) GetLegacyReservationRecommendationProperties ¶ added in v0.3.0
func (l *LegacySharedScopeReservationRecommendationProperties) GetLegacyReservationRecommendationProperties() *LegacyReservationRecommendationProperties
GetLegacyReservationRecommendationProperties implements the LegacyReservationRecommendationPropertiesClassification interface for type LegacySharedScopeReservationRecommendationProperties.
func (LegacySharedScopeReservationRecommendationProperties) MarshalJSON ¶ added in v0.3.0
func (l LegacySharedScopeReservationRecommendationProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type LegacySharedScopeReservationRecommendationProperties.
func (*LegacySharedScopeReservationRecommendationProperties) UnmarshalJSON ¶ added in v0.3.0
func (l *LegacySharedScopeReservationRecommendationProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type LegacySharedScopeReservationRecommendationProperties.
type LegacySingleScopeReservationRecommendationProperties ¶ added in v0.3.0
type LegacySingleScopeReservationRecommendationProperties struct { // REQUIRED; Shared or single recommendation. Scope *string // READ-ONLY; The total amount of cost without reserved instances. CostWithNoReservedInstances *float64 // READ-ONLY; The usage date for looking back. FirstUsageDate *time.Time // READ-ONLY; The instance Flexibility Group. InstanceFlexibilityGroup *string // READ-ONLY; The instance Flexibility Ratio. InstanceFlexibilityRatio *float32 // READ-ONLY; The number of days of usage to look back for recommendation. LookBackPeriod *string // READ-ONLY; The meter id (GUID) MeterID *string // READ-ONLY; Total estimated savings with reserved instances. NetSavings *float64 // READ-ONLY; The normalized Size. NormalizedSize *string // READ-ONLY; Recommended quality for reserved instances. RecommendedQuantity *float64 // READ-ONLY; The recommended Quantity Normalized. RecommendedQuantityNormalized *float32 // READ-ONLY; The azure resource type. ResourceType *string // READ-ONLY; List of sku properties SKUProperties []*SKUProperty // READ-ONLY; Subscription id associated with single scoped recommendation. SubscriptionID *string // READ-ONLY; RI recommendations in one or three year terms. Term *string // READ-ONLY; The total amount of cost with reserved instances. TotalCostWithReservedInstances *float64 }
LegacySingleScopeReservationRecommendationProperties - The properties of the legacy reservation recommendation for single scope.
func (*LegacySingleScopeReservationRecommendationProperties) GetLegacyReservationRecommendationProperties ¶ added in v0.3.0
func (l *LegacySingleScopeReservationRecommendationProperties) GetLegacyReservationRecommendationProperties() *LegacyReservationRecommendationProperties
GetLegacyReservationRecommendationProperties implements the LegacyReservationRecommendationPropertiesClassification interface for type LegacySingleScopeReservationRecommendationProperties.
func (LegacySingleScopeReservationRecommendationProperties) MarshalJSON ¶ added in v0.3.0
func (l LegacySingleScopeReservationRecommendationProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type LegacySingleScopeReservationRecommendationProperties.
func (*LegacySingleScopeReservationRecommendationProperties) UnmarshalJSON ¶ added in v0.3.0
func (l *LegacySingleScopeReservationRecommendationProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type LegacySingleScopeReservationRecommendationProperties.
type LegacyUsageDetail ¶
type LegacyUsageDetail struct { // REQUIRED; Specifies the kind of usage details. Kind *UsageDetailsKind // REQUIRED; Properties for legacy usage details Properties *LegacyUsageDetailProperties // READ-ONLY; The etag for the resource. Etag *string // READ-ONLY; The full qualified ARM ID of an event. ID *string // READ-ONLY; The ID that uniquely identifies an event. Name *string // READ-ONLY; Resource tags. Tags map[string]*string // READ-ONLY; Resource type. Type *string }
LegacyUsageDetail - Legacy usage detail.
func (*LegacyUsageDetail) GetUsageDetail ¶ added in v0.3.0
func (l *LegacyUsageDetail) GetUsageDetail() *UsageDetail
GetUsageDetail implements the UsageDetailClassification interface for type LegacyUsageDetail.
func (LegacyUsageDetail) MarshalJSON ¶
func (l LegacyUsageDetail) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type LegacyUsageDetail.
func (*LegacyUsageDetail) UnmarshalJSON ¶
func (l *LegacyUsageDetail) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type LegacyUsageDetail.
type LegacyUsageDetailProperties ¶
type LegacyUsageDetailProperties struct { // READ-ONLY; Account Name. AccountName *string // READ-ONLY; Account Owner Id. AccountOwnerID *string // READ-ONLY; Additional details of this usage item. By default this is not populated, unless it's specified in $expand. Use // this field to get usage line item specific details such as the actual VM Size // (ServiceType) or the ratio in which the reservation discount is applied. AdditionalInfo *string // READ-ONLY; Unique identifier for the applicable benefit. BenefitID *string // READ-ONLY; Name of the applicable benefit. BenefitName *string // READ-ONLY; Billing Account identifier. BillingAccountID *string // READ-ONLY; Billing Account Name. BillingAccountName *string // READ-ONLY; Billing Currency. BillingCurrency *string // READ-ONLY; The billing period end date. BillingPeriodEndDate *time.Time // READ-ONLY; The billing period start date. BillingPeriodStartDate *time.Time // READ-ONLY; Billing Profile identifier. BillingProfileID *string // READ-ONLY; Billing Profile Name. BillingProfileName *string // READ-ONLY; Indicates a charge represents credits, usage, a Marketplace purchase, a reservation fee, or a refund. ChargeType *string // READ-ONLY; Consumed service name. Name of the azure resource provider that emits the usage or was purchased. This value // is not provided for marketplace usage. ConsumedService *string // READ-ONLY; The amount of cost before tax. Cost *float64 // READ-ONLY; The cost center of this department if it is a department and a cost center is provided. CostCenter *string // READ-ONLY; Date for the usage record. Date *time.Time // READ-ONLY; Effective Price that's charged for the usage. EffectivePrice *float64 // READ-ONLY; Indicates how frequently this charge will occur. OneTime for purchases which only happen once, Monthly for fees // which recur every month, and UsageBased for charges based on how much a service is used. Frequency *string // READ-ONLY; Invoice Section Name. InvoiceSection *string // READ-ONLY; Is Azure Credit Eligible. IsAzureCreditEligible *bool // READ-ONLY; The details about the meter. By default this is not populated, unless it's specified in $expand. MeterDetails *MeterDetailsResponse // READ-ONLY; The meter id (GUID). Not available for marketplace. For reserved instance this represents the primary meter // for which the reservation was purchased. For the actual VM Size for which the reservation is // purchased see productOrderName. MeterID *string // READ-ONLY; Offer Id. Ex: MS-AZR-0017P, MS-AZR-0148P. OfferID *string // READ-ONLY; Part Number of the service used. Can be used to join with the price sheet. Not available for marketplace. PartNumber *string // READ-ONLY; Retail price for the resource. PayGPrice *float64 // READ-ONLY; Plan Name. PlanName *string // READ-ONLY; Identifier that indicates how the meter is priced. PricingModel *PricingModelType // READ-ONLY; Product name for the consumed service or purchase. Not available for Marketplace. Product *string // READ-ONLY; Product Order Id. For reservations this is the Reservation Order ID. ProductOrderID *string // READ-ONLY; Product Order Name. For reservations this is the SKU that was purchased. ProductOrderName *string // READ-ONLY; Publisher Name. PublisherName *string // READ-ONLY; Publisher Type. PublisherType *string // READ-ONLY; The usage quantity. Quantity *float64 // READ-ONLY; ARM resource id of the reservation. Only applies to records relevant to reservations. ReservationID *string // READ-ONLY; User provided display name of the reservation. Last known name for a particular day is populated in the daily // data. Only applies to records relevant to reservations. ReservationName *string // READ-ONLY; Resource Group Name. ResourceGroup *string // READ-ONLY; Unique identifier of the Azure Resource Manager usage detail resource. ResourceID *string // READ-ONLY; Resource Location. ResourceLocation *string // READ-ONLY; Resource Name. ResourceName *string // READ-ONLY; Service-specific metadata. ServiceInfo1 *string // READ-ONLY; Legacy field with optional service-specific metadata. ServiceInfo2 *string // READ-ONLY; Subscription guid. SubscriptionID *string // READ-ONLY; Subscription name. SubscriptionName *string // READ-ONLY; Term (in months). 1 month for monthly recurring purchase. 12 months for a 1 year reservation. 36 months for // a 3 year reservation. Term *string // READ-ONLY; Unit Price is the price applicable to you. (your EA or other contract price). UnitPrice *float64 }
LegacyUsageDetailProperties - The properties of the legacy usage detail.
func (LegacyUsageDetailProperties) MarshalJSON ¶
func (l LegacyUsageDetailProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type LegacyUsageDetailProperties.
func (*LegacyUsageDetailProperties) UnmarshalJSON ¶
func (l *LegacyUsageDetailProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type LegacyUsageDetailProperties.
type LookBackPeriod ¶
type LookBackPeriod string
const ( // LookBackPeriodLast07Days - Use 7 days of data for recommendations LookBackPeriodLast07Days LookBackPeriod = "Last7Days" // LookBackPeriodLast30Days - Use 30 days of data for recommendations LookBackPeriodLast30Days LookBackPeriod = "Last30Days" // LookBackPeriodLast60Days - Use 60 days of data for recommendations LookBackPeriodLast60Days LookBackPeriod = "Last60Days" )
func PossibleLookBackPeriodValues ¶
func PossibleLookBackPeriodValues() []LookBackPeriod
PossibleLookBackPeriodValues returns the possible values for the LookBackPeriod const type.
type LotProperties ¶
type LotProperties struct { // READ-ONLY; The billing currency of the lot. BillingCurrency *string // READ-ONLY; The balance as of the last invoice. ClosedBalance *Amount // READ-ONLY; The balance as of the last invoice in billing currency. ClosedBalanceInBillingCurrency *AmountWithExchangeRate // READ-ONLY; The currency of the lot. CreditCurrency *string // READ-ONLY; The eTag for the resource. ETag *string // READ-ONLY; The expiration date of a lot. ExpirationDate *time.Time // READ-ONLY; The original amount of a lot. OriginalAmount *Amount // READ-ONLY; The original amount of a lot in billing currency. OriginalAmountInBillingCurrency *AmountWithExchangeRate // READ-ONLY; The po number of the invoice on which the lot was added. This property is not available for ConsumptionCommitment // lots. PoNumber *string // READ-ONLY; The date when the lot was added. PurchasedDate *time.Time // READ-ONLY; The reseller of the lot. Reseller *Reseller // READ-ONLY; The source of the lot. Source *LotSource // READ-ONLY; The date when the lot became effective. StartDate *time.Time // READ-ONLY; The status of the lot. Status *Status }
LotProperties - The lot properties.
func (LotProperties) MarshalJSON ¶
func (l LotProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type LotProperties.
func (*LotProperties) UnmarshalJSON ¶
func (l *LotProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type LotProperties.
type LotSource ¶
type LotSource string
LotSource - The source of the lot.
func PossibleLotSourceValues ¶
func PossibleLotSourceValues() []LotSource
PossibleLotSourceValues returns the possible values for the LotSource const type.
type LotSummary ¶
type LotSummary 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 lot properties. Properties *LotProperties // READ-ONLY; Resource Id. ID *string // READ-ONLY; Resource name. Name *string // READ-ONLY; Resource type. Type *string }
LotSummary - A lot summary resource.
func (LotSummary) MarshalJSON ¶
func (l LotSummary) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type LotSummary.
func (*LotSummary) UnmarshalJSON ¶
func (l *LotSummary) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type LotSummary.
type Lots ¶
type Lots struct { // READ-ONLY; The link (url) to the next page of results. NextLink *string // READ-ONLY; The list of lot summary. Value []*LotSummary }
Lots - Result of listing lot summary.
func (Lots) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface for type Lots.
func (*Lots) UnmarshalJSON ¶ added in v1.1.0
UnmarshalJSON implements the json.Unmarshaller interface for type Lots.
type LotsClient ¶
type LotsClient struct {
// contains filtered or unexported fields
}
LotsClient contains the methods for the Lots group. Don't use this type directly, use NewLotsClient() instead.
func NewLotsClient ¶
func NewLotsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*LotsClient, error)
NewLotsClient creates a new instance of LotsClient with the specified values.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*LotsClient) NewListByBillingAccountPager ¶ added in v0.5.0
func (client *LotsClient) NewListByBillingAccountPager(billingAccountID string, options *LotsClientListByBillingAccountOptions) *runtime.Pager[LotsClientListByBillingAccountResponse]
NewListByBillingAccountPager - Lists all Microsoft Azure consumption commitments for a billing account. The API is only supported for Microsoft Customer Agreements (MCA) and Direct Enterprise Agreement (EA) billing accounts.
Generated from API version 2021-10-01
- billingAccountID - BillingAccount ID
- options - LotsClientListByBillingAccountOptions contains the optional parameters for the LotsClient.NewListByBillingAccountPager method.
Example (LotsListByBillingAccount) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/LotsListByBillingAccount.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewLotsClient().NewListByBillingAccountPager("1234:5678", &armconsumption.LotsClientListByBillingAccountOptions{Filter: 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.Lots = armconsumption.Lots{ // Value: []*armconsumption.LotSummary{ // { // Name: to.Ptr("lot1"), // Type: to.Ptr("Microsoft.Consumption/lots"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/lots/lot1"), // Properties: &armconsumption.LotProperties{ // ClosedBalance: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](60.9), // }, // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-01T00:00:00.000Z"); return t}()), // OriginalAmount: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](5000), // }, // PurchasedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-01T00:00:00.000Z"); return t}()), // Source: to.Ptr(armconsumption.LotSourceConsumptionCommitment), // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00.000Z"); return t}()), // Status: to.Ptr(armconsumption.StatusActive), // }, // }, // { // Name: to.Ptr("lot2"), // Type: to.Ptr("Microsoft.Consumption/lots"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/lots/lot2"), // Properties: &armconsumption.LotProperties{ // ClosedBalance: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](80.9), // }, // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-31T00:00:00.000Z"); return t}()), // OriginalAmount: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](6000), // }, // PurchasedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-01T00:00:00.000Z"); return t}()), // Source: to.Ptr(armconsumption.LotSourceConsumptionCommitment), // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-01T00:00:00.000Z"); return t}()), // Status: to.Ptr(armconsumption.StatusExpired), // }, // }}, // } } }
Output:
Example (LotsListByBillingAccountWithStatusFilter) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/LotsListByBillingAccountWithFilters.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewLotsClient().NewListByBillingAccountPager("1234:5678", &armconsumption.LotsClientListByBillingAccountOptions{Filter: to.Ptr("status eq 'active' AND source eq 'consumptioncommitment'")}) 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.Lots = armconsumption.Lots{ // Value: []*armconsumption.LotSummary{ // { // Name: to.Ptr("lot1"), // Type: to.Ptr("Microsoft.Consumption/lots"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/lots/lot1"), // Properties: &armconsumption.LotProperties{ // ClosedBalance: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](60.9), // }, // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-01T00:00:00.000Z"); return t}()), // OriginalAmount: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](5000), // }, // PurchasedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-01T00:00:00.000Z"); return t}()), // Source: to.Ptr(armconsumption.LotSourceConsumptionCommitment), // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00.000Z"); return t}()), // Status: to.Ptr(armconsumption.StatusActive), // }, // }}, // } } }
Output:
func (*LotsClient) NewListByBillingProfilePager ¶ added in v0.5.0
func (client *LotsClient) NewListByBillingProfilePager(billingAccountID string, billingProfileID string, options *LotsClientListByBillingProfileOptions) *runtime.Pager[LotsClientListByBillingProfileResponse]
NewListByBillingProfilePager - Lists all Azure credits for a billing account or a billing profile. The API is only supported for Microsoft Customer Agreements (MCA) billing accounts.
Generated from API version 2021-10-01
- billingAccountID - BillingAccount ID
- billingProfileID - Azure Billing Profile ID.
- options - LotsClientListByBillingProfileOptions contains the optional parameters for the LotsClient.NewListByBillingProfilePager method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/LotsListByBillingProfile.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewLotsClient().NewListByBillingProfilePager("1234:5678", "2468", 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.Lots = armconsumption.Lots{ // Value: []*armconsumption.LotSummary{ // { // Name: to.Ptr("lot1"), // Type: to.Ptr("Microsoft.Consumption/lots"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/lots/lot1"), // Properties: &armconsumption.LotProperties{ // BillingCurrency: to.Ptr("USD"), // ClosedBalance: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](60.9), // }, // ClosedBalanceInBillingCurrency: &armconsumption.AmountWithExchangeRate{ // ExchangeRate: to.Ptr[float64](5000), // ExchangeRateMonth: to.Ptr[int32](1), // }, // CreditCurrency: to.Ptr("USD"), // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.000Z"); return t}()), // OriginalAmount: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](5000), // }, // OriginalAmountInBillingCurrency: &armconsumption.AmountWithExchangeRate{ // ExchangeRate: to.Ptr[float64](5000), // ExchangeRateMonth: to.Ptr[int32](1), // }, // PoNumber: to.Ptr("3524"), // Reseller: &armconsumption.Reseller{ // ResellerDescription: to.Ptr("Reseller information."), // ResellerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/reseller/reseller1"), // }, // Source: to.Ptr(armconsumption.LotSourcePurchasedCredit), // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.000Z"); return t}()), // }, // }, // { // Name: to.Ptr("lot2"), // Type: to.Ptr("Microsoft.Consumption/lots"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/lots/lot2"), // Properties: &armconsumption.LotProperties{ // BillingCurrency: to.Ptr("USD"), // ClosedBalance: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](80.9), // }, // ClosedBalanceInBillingCurrency: &armconsumption.AmountWithExchangeRate{ // ExchangeRate: to.Ptr[float64](5000), // ExchangeRateMonth: to.Ptr[int32](1), // }, // CreditCurrency: to.Ptr("USD"), // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-31T00:00:00.000Z"); return t}()), // OriginalAmount: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](6000), // }, // OriginalAmountInBillingCurrency: &armconsumption.AmountWithExchangeRate{ // ExchangeRate: to.Ptr[float64](5000), // ExchangeRateMonth: to.Ptr[int32](1), // }, // PoNumber: to.Ptr("31224"), // Reseller: &armconsumption.Reseller{ // ResellerDescription: to.Ptr("Reseller information."), // ResellerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/reseller/reseller2"), // }, // Source: to.Ptr(armconsumption.LotSourcePurchasedCredit), // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.000Z"); return t}()), // }, // }}, // } } }
Output:
func (*LotsClient) NewListByCustomerPager ¶ added in v0.5.0
func (client *LotsClient) NewListByCustomerPager(billingAccountID string, customerID string, options *LotsClientListByCustomerOptions) *runtime.Pager[LotsClientListByCustomerResponse]
NewListByCustomerPager - Lists all Azure credits for a customer. The API is only supported for Microsoft Partner Agreements (MPA) billing accounts.
Generated from API version 2021-10-01
- billingAccountID - BillingAccount ID
- customerID - Customer ID
- options - LotsClientListByCustomerOptions contains the optional parameters for the LotsClient.NewListByCustomerPager method.
Example (LotsListByCustomer) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/LotsListByCustomer.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewLotsClient().NewListByCustomerPager("1234:5678", "1234:5678", &armconsumption.LotsClientListByCustomerOptions{Filter: 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.Lots = armconsumption.Lots{ // Value: []*armconsumption.LotSummary{ // { // Name: to.Ptr("lot1"), // Type: to.Ptr("Microsoft.Consumption/lots"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234/customers/456/providers/Microsoft.Consumption/lots/lot1"), // Properties: &armconsumption.LotProperties{ // ClosedBalance: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](60.9), // }, // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-01T00:00:00.000Z"); return t}()), // OriginalAmount: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](5000), // }, // PoNumber: to.Ptr("3524"), // Source: to.Ptr(armconsumption.LotSourcePurchasedCredit), // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-01T00:00:00.000Z"); return t}()), // }, // }, // { // Name: to.Ptr("lot2"), // Type: to.Ptr("Microsoft.Consumption/lots"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234/customers/456/providers/Microsoft.Consumption/lots/lot2"), // Properties: &armconsumption.LotProperties{ // ClosedBalance: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](80.9), // }, // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-31T00:00:00.000Z"); return t}()), // OriginalAmount: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](6000), // }, // PoNumber: to.Ptr("31224"), // Source: to.Ptr(armconsumption.LotSourcePurchasedCredit), // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-01T00:00:00.000Z"); return t}()), // }, // }}, // } } }
Output:
Example (LotsListByCustomerWithFilter) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/LotsListByCustomerWithFilters.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewLotsClient().NewListByCustomerPager("1234:5678", "1234:5678", &armconsumption.LotsClientListByCustomerOptions{Filter: to.Ptr("status eq 'active' AND source eq 'consumptioncommitment'")}) 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.Lots = armconsumption.Lots{ // Value: []*armconsumption.LotSummary{ // { // Name: to.Ptr("lot1"), // Type: to.Ptr("Microsoft.Consumption/lots"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234/customers/456/providers/Microsoft.Consumption/lots/lot1"), // Properties: &armconsumption.LotProperties{ // ClosedBalance: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](60.9), // }, // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-01T00:00:00.000Z"); return t}()), // OriginalAmount: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](5000), // }, // PoNumber: to.Ptr("3524"), // Source: to.Ptr(armconsumption.LotSourcePurchasedCredit), // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-01T00:00:00.000Z"); return t}()), // }, // }}, // } } }
Output:
type LotsClientListByBillingAccountOptions ¶ added in v0.3.0
type LotsClientListByBillingAccountOptions struct { // May be used to filter the lots by Status, Source etc. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does // not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair // string where key and value is separated by a colon (:). Filter *string }
LotsClientListByBillingAccountOptions contains the optional parameters for the LotsClient.NewListByBillingAccountPager method.
type LotsClientListByBillingAccountResponse ¶ added in v0.3.0
type LotsClientListByBillingAccountResponse struct { // Result of listing lot summary. Lots }
LotsClientListByBillingAccountResponse contains the response from method LotsClient.NewListByBillingAccountPager.
type LotsClientListByBillingProfileOptions ¶ added in v0.3.0
type LotsClientListByBillingProfileOptions struct { }
LotsClientListByBillingProfileOptions contains the optional parameters for the LotsClient.NewListByBillingProfilePager method.
type LotsClientListByBillingProfileResponse ¶ added in v0.3.0
type LotsClientListByBillingProfileResponse struct { // Result of listing lot summary. Lots }
LotsClientListByBillingProfileResponse contains the response from method LotsClient.NewListByBillingProfilePager.
type LotsClientListByCustomerOptions ¶ added in v0.4.0
type LotsClientListByCustomerOptions struct { // May be used to filter the lots by Status, Source etc. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. Tag // filter is a key value pair string where key and value is separated by a colon // (:). Filter *string }
LotsClientListByCustomerOptions contains the optional parameters for the LotsClient.NewListByCustomerPager method.
type LotsClientListByCustomerResponse ¶ added in v0.4.0
type LotsClientListByCustomerResponse struct { // Result of listing lot summary. Lots }
LotsClientListByCustomerResponse contains the response from method LotsClient.NewListByCustomerPager.
type ManagementGroupAggregatedCostProperties ¶
type ManagementGroupAggregatedCostProperties struct { // Children of a management group Children []*ManagementGroupAggregatedCostResult // List of subscription Guids excluded from the calculation of aggregated cost ExcludedSubscriptions []*string // List of subscription Guids included in the calculation of aggregated cost IncludedSubscriptions []*string // READ-ONLY; Azure Charges. AzureCharges *float64 // READ-ONLY; The id of the billing period resource that the aggregated cost belongs to. BillingPeriodID *string // READ-ONLY; Charges Billed Separately. ChargesBilledSeparately *float64 // READ-ONLY; The ISO currency in which the meter is charged, for example, USD. Currency *string // READ-ONLY; Marketplace Charges. MarketplaceCharges *float64 // READ-ONLY; The end of the date time range covered by the aggregated cost. UsageEnd *time.Time // READ-ONLY; The start of the date time range covered by aggregated cost. UsageStart *time.Time }
ManagementGroupAggregatedCostProperties - The properties of the Management Group Aggregated Cost.
func (ManagementGroupAggregatedCostProperties) MarshalJSON ¶
func (m ManagementGroupAggregatedCostProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ManagementGroupAggregatedCostProperties.
func (*ManagementGroupAggregatedCostProperties) UnmarshalJSON ¶
func (m *ManagementGroupAggregatedCostProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ManagementGroupAggregatedCostProperties.
type ManagementGroupAggregatedCostResult ¶
type ManagementGroupAggregatedCostResult struct { // The properties of the Management Group Aggregated Cost. Properties *ManagementGroupAggregatedCostProperties // READ-ONLY; The etag for the resource. Etag *string // READ-ONLY; The full qualified ARM ID of an event. ID *string // READ-ONLY; The ID that uniquely identifies an event. Name *string // READ-ONLY; Resource tags. Tags map[string]*string // READ-ONLY; Resource type. Type *string }
ManagementGroupAggregatedCostResult - A management group aggregated cost resource.
func (ManagementGroupAggregatedCostResult) MarshalJSON ¶
func (m ManagementGroupAggregatedCostResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ManagementGroupAggregatedCostResult.
func (*ManagementGroupAggregatedCostResult) UnmarshalJSON ¶
func (m *ManagementGroupAggregatedCostResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ManagementGroupAggregatedCostResult.
type Marketplace ¶
type Marketplace struct { // The properties of the marketplace usage detail. Properties *MarketplaceProperties // READ-ONLY; The etag for the resource. Etag *string // READ-ONLY; The full qualified ARM ID of an event. ID *string // READ-ONLY; The ID that uniquely identifies an event. Name *string // READ-ONLY; Resource tags. Tags map[string]*string // READ-ONLY; Resource type. Type *string }
Marketplace - A marketplace resource.
func (Marketplace) MarshalJSON ¶
func (m Marketplace) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type Marketplace.
func (*Marketplace) UnmarshalJSON ¶
func (m *Marketplace) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type Marketplace.
type MarketplaceProperties ¶
type MarketplaceProperties struct { // READ-ONLY; Account name. AccountName *string // READ-ONLY; Additional information. AdditionalInfo *string // READ-ONLY; Additional details of this usage item. By default this is not populated, unless it's specified in $expand. AdditionalProperties *string // READ-ONLY; The id of the billing period resource that the usage belongs to. BillingPeriodID *string // READ-ONLY; The quantity of usage. ConsumedQuantity *float64 // READ-ONLY; Consumed service name. ConsumedService *string // READ-ONLY; The cost center of this department if it is a department and a costcenter exists CostCenter *string // READ-ONLY; The ISO currency in which the meter is charged, for example, USD. Currency *string // READ-ONLY; Department name. DepartmentName *string // READ-ONLY; The uri of the resource instance that the usage is about. InstanceID *string // READ-ONLY; The name of the resource instance that the usage is about. InstanceName *string // READ-ONLY; The estimated usage is subject to change. IsEstimated *bool // READ-ONLY; Flag indicating whether this is a recurring charge or not. IsRecurringCharge *bool // READ-ONLY; The meter id (GUID). MeterID *string // READ-ONLY; The type of offer. OfferName *string // READ-ONLY; The order number. OrderNumber *string // READ-ONLY; The name of plan. PlanName *string // READ-ONLY; The amount of cost before tax. PretaxCost *float64 // READ-ONLY; The name of publisher. PublisherName *string // READ-ONLY; The name of resource group. ResourceGroup *string // READ-ONLY; The marketplace resource rate. ResourceRate *float64 // READ-ONLY; Subscription guid. SubscriptionGUID *string // READ-ONLY; Subscription name. SubscriptionName *string // READ-ONLY; The unit of measure. UnitOfMeasure *string // READ-ONLY; The end of the date time range covered by the usage detail. UsageEnd *time.Time // READ-ONLY; The start of the date time range covered by the usage detail. UsageStart *time.Time }
MarketplaceProperties - The properties of the marketplace usage detail.
func (MarketplaceProperties) MarshalJSON ¶
func (m MarketplaceProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MarketplaceProperties.
func (*MarketplaceProperties) UnmarshalJSON ¶
func (m *MarketplaceProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceProperties.
type MarketplacesClient ¶
type MarketplacesClient struct {
// contains filtered or unexported fields
}
MarketplacesClient contains the methods for the Marketplaces group. Don't use this type directly, use NewMarketplacesClient() instead.
func NewMarketplacesClient ¶
func NewMarketplacesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*MarketplacesClient, error)
NewMarketplacesClient creates a new instance of MarketplacesClient with the specified values.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*MarketplacesClient) NewListPager ¶ added in v0.5.0
func (client *MarketplacesClient) NewListPager(scope string, options *MarketplacesClientListOptions) *runtime.Pager[MarketplacesClientListResponse]
NewListPager - Lists the marketplaces for a scope at the defined scope. Marketplaces are available via this API only for May 1, 2014 or later.
Generated from API version 2021-10-01
- scope - The scope associated with marketplace 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 and '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For subscription, billing account, department, enrollment account and ManagementGroup, you can also add billing period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to specify billing period at department scope use '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'
- options - MarketplacesClientListOptions contains the optional parameters for the MarketplacesClient.NewListPager method.
Example (BillingAccountMarketplacesList) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/MarketplacesByBillingAccountList.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewMarketplacesClient().NewListPager("providers/Microsoft.Billing/billingAccounts/123456", &armconsumption.MarketplacesClientListOptions{Filter: nil, Top: nil, Skiptoken: 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.MarketplacesListResult = armconsumption.MarketplacesListResult{ // Value: []*armconsumption.Marketplace{ // { // Name: to.Ptr("marketplaceId1"), // Type: to.Ptr("Microsoft.Consumption/marketPlaces"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/123456/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/marketplaces/marketplaceId1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Properties: &armconsumption.MarketplaceProperties{ // AccountName: to.Ptr("Account1"), // AdditionalProperties: to.Ptr("additionalProperties"), // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/123456/providers/Microsoft.Billing/billingPeriods/201702"), // ConsumedQuantity: to.Ptr[float64](0.00328), // CostCenter: to.Ptr("Center1"), // Currency: to.Ptr("USD"), // DepartmentName: to.Ptr("Department1"), // InstanceID: to.Ptr("/subscriptions/subid/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1"), // InstanceName: to.Ptr("shared1"), // IsEstimated: to.Ptr(false), // IsRecurringCharge: to.Ptr(false), // OfferName: to.Ptr("offer1"), // OrderNumber: to.Ptr("00000000-0000-0000-0000-000000000000"), // PlanName: to.Ptr("plan1"), // PretaxCost: to.Ptr[float64](0.67), // PublisherName: to.Ptr("xyz"), // ResourceGroup: to.Ptr("TEST"), // ResourceRate: to.Ptr[float64](0.24), // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("azure subscription"), // UnitOfMeasure: to.Ptr("10 Hours"), // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T23:59:59.000Z"); return t}()), // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T00:00:00.000Z"); return t}()), // }, // }}, // } } }
Output:
Example (BillingAccountMarketplacesListForBillingPeriod) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/MarketplacesByBillingAccountListForBillingPeriod.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewMarketplacesClient().NewListPager("providers/Microsoft.Billing/billingAccounts/123456", &armconsumption.MarketplacesClientListOptions{Filter: nil, Top: nil, Skiptoken: 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.MarketplacesListResult = armconsumption.MarketplacesListResult{ // Value: []*armconsumption.Marketplace{ // { // Name: to.Ptr("marketplacesId1"), // Type: to.Ptr("Microsoft.Consumption/marketPlaces"), // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/123456/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/marketplaces/marketplaceId1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Properties: &armconsumption.MarketplaceProperties{ // AccountName: to.Ptr("Account1"), // AdditionalProperties: to.Ptr("additionalProperties"), // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/123456/providers/Microsoft.Billing/billingPeriods/201702"), // ConsumedQuantity: to.Ptr[float64](0.00328), // CostCenter: to.Ptr("Center1"), // Currency: to.Ptr("USD"), // DepartmentName: to.Ptr("Department1"), // InstanceID: to.Ptr("/subscriptions/subid/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1"), // InstanceName: to.Ptr("shared1"), // IsEstimated: to.Ptr(false), // IsRecurringCharge: to.Ptr(false), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferName: to.Ptr("offer1"), // OrderNumber: to.Ptr("00000000-0000-0000-0000-000000000000"), // PlanName: to.Ptr("plan2"), // PretaxCost: to.Ptr[float64](0.67), // PublisherName: to.Ptr("xyz"), // ResourceGroup: to.Ptr("TEST"), // ResourceRate: to.Ptr[float64](0.24), // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("azure subscription"), // UnitOfMeasure: to.Ptr("10 Hours"), // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T23:59:59.000Z"); return t}()), // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T00:00:00.000Z"); return t}()), // }, // }}, // } } }
Output:
Example (DepartmentMarketplacesList) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/MarketplacesByDepartmentList.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewMarketplacesClient().NewListPager("providers/Microsoft.Billing/departments/123456", &armconsumption.MarketplacesClientListOptions{Filter: nil, Top: nil, Skiptoken: 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.MarketplacesListResult = armconsumption.MarketplacesListResult{ // Value: []*armconsumption.Marketplace{ // { // Name: to.Ptr("marketplacesId1"), // Type: to.Ptr("Microsoft.Consumption/marketPlaces"), // ID: to.Ptr("/providers/Microsoft.Billing/departments/123456/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/marketplaces/marketplaceId1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Properties: &armconsumption.MarketplaceProperties{ // AccountName: to.Ptr("Account1"), // AdditionalProperties: to.Ptr("additionalProperties"), // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/departments/123456/providers/Microsoft.Billing/billingPeriods/201702"), // ConsumedQuantity: to.Ptr[float64](0.00328), // CostCenter: to.Ptr("Center1"), // Currency: to.Ptr("USD"), // DepartmentName: to.Ptr("Department1"), // InstanceID: to.Ptr("/subscriptions/subid/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1"), // InstanceName: to.Ptr("shared1"), // IsEstimated: to.Ptr(false), // IsRecurringCharge: to.Ptr(false), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferName: to.Ptr("offer1"), // OrderNumber: to.Ptr("00000000-0000-0000-0000-000000000000"), // PlanName: to.Ptr("plan2"), // PretaxCost: to.Ptr[float64](0.67), // PublisherName: to.Ptr("xyz"), // ResourceGroup: to.Ptr("TEST"), // ResourceRate: to.Ptr[float64](0.24), // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("azure subscription"), // UnitOfMeasure: to.Ptr("10 Hours"), // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T23:59:59.000Z"); return t}()), // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T00:00:00.000Z"); return t}()), // }, // }}, // } } }
Output:
Example (DepartmentMarketplacesListForBillingPeriod) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/MarketplacesByDepartment_ListByBillingPeriod.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewMarketplacesClient().NewListPager("providers/Microsoft.Billing/departments/123456", &armconsumption.MarketplacesClientListOptions{Filter: nil, Top: nil, Skiptoken: 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.MarketplacesListResult = armconsumption.MarketplacesListResult{ // Value: []*armconsumption.Marketplace{ // { // Name: to.Ptr("marketplacesId1"), // Type: to.Ptr("Microsoft.Consumption/marketPlaces"), // ID: to.Ptr("/providers/Microsoft.Billing/departments/123456/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/marketplaces/marketplaceId1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Properties: &armconsumption.MarketplaceProperties{ // AccountName: to.Ptr("Account1"), // AdditionalProperties: to.Ptr("additionalProperties"), // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/departments/123456/providers/Microsoft.Billing/billingPeriods/201702"), // ConsumedQuantity: to.Ptr[float64](0.00328), // CostCenter: to.Ptr("Center1"), // Currency: to.Ptr("USD"), // DepartmentName: to.Ptr("Department1"), // InstanceID: to.Ptr("/subscriptions/subid/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1"), // InstanceName: to.Ptr("shared1"), // IsEstimated: to.Ptr(false), // IsRecurringCharge: to.Ptr(false), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferName: to.Ptr("offer1"), // OrderNumber: to.Ptr("00000000-0000-0000-0000-000000000000"), // PlanName: to.Ptr("plan2"), // PretaxCost: to.Ptr[float64](0.67), // PublisherName: to.Ptr("xyz"), // ResourceGroup: to.Ptr("TEST"), // ResourceRate: to.Ptr[float64](0.24), // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("azure subscription"), // UnitOfMeasure: to.Ptr("10 Hours"), // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T23:59:59.000Z"); return t}()), // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T00:00:00.000Z"); return t}()), // }, // }}, // } } }
Output:
Example (EnrollmentAccountMarketplacesList) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/MarketplacesByEnrollmentAccountList.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewMarketplacesClient().NewListPager("providers/Microsoft.Billing/enrollmentAccounts/123456", &armconsumption.MarketplacesClientListOptions{Filter: nil, Top: nil, Skiptoken: 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.MarketplacesListResult = armconsumption.MarketplacesListResult{ // Value: []*armconsumption.Marketplace{ // { // Name: to.Ptr("marketplacesId1"), // Type: to.Ptr("Microsoft.Consumption/marketPlaces"), // ID: to.Ptr("/providers/Microsoft.Billing/enrollmentAccounts/123456/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/marketplaces/marketplaceId1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Properties: &armconsumption.MarketplaceProperties{ // AccountName: to.Ptr("Account1"), // AdditionalProperties: to.Ptr("additionalProperties"), // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/enrollmentAccounts/123456/providers/Microsoft.Billing/billingPeriods/201702"), // ConsumedQuantity: to.Ptr[float64](0.00328), // CostCenter: to.Ptr("Center1"), // Currency: to.Ptr("USD"), // DepartmentName: to.Ptr("Department1"), // InstanceID: to.Ptr("/subscriptions/subid/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1"), // InstanceName: to.Ptr("shared1"), // IsEstimated: to.Ptr(false), // IsRecurringCharge: to.Ptr(false), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferName: to.Ptr("offer1"), // OrderNumber: to.Ptr("00000000-0000-0000-0000-000000000000"), // PlanName: to.Ptr("plan2"), // PretaxCost: to.Ptr[float64](0.67), // PublisherName: to.Ptr("xyz"), // ResourceGroup: to.Ptr("TEST"), // ResourceRate: to.Ptr[float64](0.24), // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("azure subscription"), // UnitOfMeasure: to.Ptr("10 Hours"), // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T23:59:59.000Z"); return t}()), // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T00:00:00.000Z"); return t}()), // }, // }}, // } } }
Output:
Example (EnrollmentAccountMarketplacesListForBillingPeriod) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/MarketplacesByEnrollmentAccounts_ListByBillingPeriod.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewMarketplacesClient().NewListPager("providers/Microsoft.Billing/enrollmentAccounts/123456", &armconsumption.MarketplacesClientListOptions{Filter: nil, Top: nil, Skiptoken: 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.MarketplacesListResult = armconsumption.MarketplacesListResult{ // Value: []*armconsumption.Marketplace{ // { // Name: to.Ptr("marketplacesId1"), // Type: to.Ptr("Microsoft.Consumption/marketPlaces"), // ID: to.Ptr("/providers/Microsoft.Billing/enrollmentAccounts/123456/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/marketplaces/marketplaceId1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Properties: &armconsumption.MarketplaceProperties{ // AccountName: to.Ptr("Account1"), // AdditionalProperties: to.Ptr("additionalProperties"), // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/enrollmentAccounts/123456/providers/Microsoft.Billing/billingPeriods/201702"), // ConsumedQuantity: to.Ptr[float64](0.00328), // CostCenter: to.Ptr("Center1"), // Currency: to.Ptr("USD"), // DepartmentName: to.Ptr("Department1"), // InstanceID: to.Ptr("/subscriptions/subid/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1"), // InstanceName: to.Ptr("shared1"), // IsEstimated: to.Ptr(false), // IsRecurringCharge: to.Ptr(false), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferName: to.Ptr("offer1"), // OrderNumber: to.Ptr("00000000-0000-0000-0000-000000000000"), // PlanName: to.Ptr("plan2"), // PretaxCost: to.Ptr[float64](0.67), // PublisherName: to.Ptr("xyz"), // ResourceGroup: to.Ptr("TEST"), // ResourceRate: to.Ptr[float64](0.24), // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("azure subscription"), // UnitOfMeasure: to.Ptr("10 Hours"), // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T23:59:59.000Z"); return t}()), // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T00:00:00.000Z"); return t}()), // }, // }}, // } } }
Output:
Example (ManagementGroupMarketplacesList) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/MarketplacesByManagementGroupList.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewMarketplacesClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.MarketplacesClientListOptions{Filter: nil, Top: nil, Skiptoken: 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.MarketplacesListResult = armconsumption.MarketplacesListResult{ // Value: []*armconsumption.Marketplace{ // { // Name: to.Ptr("marketplacesId1"), // Type: to.Ptr("Microsoft.Consumption/marketPlaces"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201810/providers/Microsoft.Consumption/marketplaces/marketplaceId1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Properties: &armconsumption.MarketplaceProperties{ // AccountName: to.Ptr("Account1"), // AdditionalProperties: to.Ptr("additionalProperties"), // BillingPeriodID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201810"), // ConsumedQuantity: to.Ptr[float64](0.00328), // CostCenter: to.Ptr("Center1"), // Currency: to.Ptr("USD"), // DepartmentName: to.Ptr("Department1"), // InstanceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1"), // InstanceName: to.Ptr("shared1"), // IsEstimated: to.Ptr(false), // IsRecurringCharge: to.Ptr(false), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferName: to.Ptr("offer1"), // OrderNumber: to.Ptr("00000000-0000-0000-0000-000000000000"), // PlanName: to.Ptr("plan2"), // PretaxCost: to.Ptr[float64](0.67), // PublisherName: to.Ptr("xyz"), // ResourceGroup: to.Ptr("TEST"), // ResourceRate: to.Ptr[float64](0.24), // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("azure subscription"), // UnitOfMeasure: to.Ptr("10 Hours"), // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-13T23:59:59.000Z"); return t}()), // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-13T00:00:00.000Z"); return t}()), // }, // }, // { // Name: to.Ptr("marketplacesId2"), // Type: to.Ptr("Microsoft.Consumption/marketPlaces"), // ID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/providers/Microsoft.Billing/billingPeriods/201810/providers/Microsoft.Consumption/marketplaces/marketplaceId2"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Properties: &armconsumption.MarketplaceProperties{ // AccountName: to.Ptr("Account2"), // AdditionalProperties: to.Ptr("additionalProperties"), // BillingPeriodID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/providers/Microsoft.Billing/billingPeriods/201810"), // ConsumedQuantity: to.Ptr[float64](0.00328), // CostCenter: to.Ptr("Center2"), // Currency: to.Ptr("USD"), // DepartmentName: to.Ptr("Department2"), // InstanceID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared2"), // InstanceName: to.Ptr("shared2"), // IsEstimated: to.Ptr(false), // IsRecurringCharge: to.Ptr(false), // MeterID: to.Ptr("11111111-1111-1111-1111-111111111111"), // OfferName: to.Ptr("offer1"), // OrderNumber: to.Ptr("11111111-1111-1111-1111-111111111111"), // PlanName: to.Ptr("plan2"), // PretaxCost: to.Ptr[float64](0.67), // PublisherName: to.Ptr("xyz"), // ResourceGroup: to.Ptr("TEST"), // ResourceRate: to.Ptr[float64](0.24), // SubscriptionGUID: to.Ptr("11111111-1111-1111-1111-111111111111"), // SubscriptionName: to.Ptr("azure subscription"), // UnitOfMeasure: to.Ptr("10 Hours"), // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-13T23:59:59.000Z"); return t}()), // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-13T00:00:00.000Z"); return t}()), // }, // }}, // } } }
Output:
Example (ManagementGroupMarketplacesListForBillingPeriod) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/MarketplacesByManagementGroup_ListForBillingPeriod.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewMarketplacesClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.MarketplacesClientListOptions{Filter: nil, Top: nil, Skiptoken: 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.MarketplacesListResult = armconsumption.MarketplacesListResult{ // Value: []*armconsumption.Marketplace{ // { // Name: to.Ptr("marketplacesId1"), // Type: to.Ptr("Microsoft.Consumption/marketPlaces"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201808/providers/Microsoft.Consumption/marketplaces/marketplaceId1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Properties: &armconsumption.MarketplaceProperties{ // AccountName: to.Ptr("Account1"), // AdditionalProperties: to.Ptr("additionalProperties"), // BillingPeriodID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201808"), // ConsumedQuantity: to.Ptr[float64](0.00328), // CostCenter: to.Ptr("Center1"), // Currency: to.Ptr("USD"), // DepartmentName: to.Ptr("Department1"), // InstanceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1"), // InstanceName: to.Ptr("shared1"), // IsEstimated: to.Ptr(false), // IsRecurringCharge: to.Ptr(false), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferName: to.Ptr("offer1"), // OrderNumber: to.Ptr("00000000-0000-0000-0000-000000000000"), // PlanName: to.Ptr("plan2"), // PretaxCost: to.Ptr[float64](0.67), // PublisherName: to.Ptr("xyz"), // ResourceGroup: to.Ptr("TEST"), // ResourceRate: to.Ptr[float64](0.24), // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("azure subscription"), // UnitOfMeasure: to.Ptr("10 Hours"), // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-13T23:59:59.000Z"); return t}()), // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-13T00:00:00.000Z"); return t}()), // }, // }, // { // Name: to.Ptr("marketplacesId2"), // Type: to.Ptr("Microsoft.Consumption/marketPlaces"), // ID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/providers/Microsoft.Billing/billingPeriods/201808/providers/Microsoft.Consumption/marketplaces/marketplaceId2"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Properties: &armconsumption.MarketplaceProperties{ // AccountName: to.Ptr("Account2"), // AdditionalProperties: to.Ptr("additionalProperties"), // BillingPeriodID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/providers/Microsoft.Billing/billingPeriods/201810"), // ConsumedQuantity: to.Ptr[float64](0.00328), // CostCenter: to.Ptr("Center2"), // Currency: to.Ptr("USD"), // DepartmentName: to.Ptr("Department2"), // InstanceID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared2"), // InstanceName: to.Ptr("shared2"), // IsEstimated: to.Ptr(false), // IsRecurringCharge: to.Ptr(false), // MeterID: to.Ptr("11111111-1111-1111-1111-111111111111"), // OfferName: to.Ptr("offer1"), // OrderNumber: to.Ptr("11111111-1111-1111-1111-111111111111"), // PlanName: to.Ptr("plan2"), // PretaxCost: to.Ptr[float64](0.67), // PublisherName: to.Ptr("xyz"), // ResourceGroup: to.Ptr("TEST"), // ResourceRate: to.Ptr[float64](0.24), // SubscriptionGUID: to.Ptr("11111111-1111-1111-1111-111111111111"), // SubscriptionName: to.Ptr("azure subscription"), // UnitOfMeasure: to.Ptr("10 Hours"), // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-13T23:59:59.000Z"); return t}()), // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-13T00:00:00.000Z"); return t}()), // }, // }}, // } } }
Output:
Example (SubscriptionMarketplacesList) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/MarketplacesList.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewMarketplacesClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.MarketplacesClientListOptions{Filter: nil, Top: nil, Skiptoken: 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.MarketplacesListResult = armconsumption.MarketplacesListResult{ // Value: []*armconsumption.Marketplace{ // { // Name: to.Ptr("marketplaceId1"), // Type: to.Ptr("Microsoft.Consumption/marketPlaces"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/marketPlaces/marketplaceId1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Properties: &armconsumption.MarketplaceProperties{ // AccountName: to.Ptr("Account1"), // AdditionalProperties: to.Ptr("additionalProperties"), // BillingPeriodID: to.Ptr("/subscriptions/subid/providers/Microsoft.Billing/billingPeriods/201702"), // ConsumedQuantity: to.Ptr[float64](0.00328), // CostCenter: to.Ptr("Center1"), // Currency: to.Ptr("USD"), // DepartmentName: to.Ptr("Department1"), // InstanceID: to.Ptr("/subscriptions/subid/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1"), // InstanceName: to.Ptr("shared1"), // IsEstimated: to.Ptr(false), // IsRecurringCharge: to.Ptr(false), // OfferName: to.Ptr("offer1"), // OrderNumber: to.Ptr("00000000-0000-0000-0000-000000000000"), // PlanName: to.Ptr("plan1"), // PretaxCost: to.Ptr[float64](0.67), // PublisherName: to.Ptr("xyz"), // ResourceGroup: to.Ptr("TEST"), // ResourceRate: to.Ptr[float64](0.24), // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("azure subscription"), // UnitOfMeasure: to.Ptr("10 Hours"), // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T23:59:59.000Z"); return t}()), // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T00:00:00.000Z"); return t}()), // }, // }}, // } } }
Output:
Example (SubscriptionMarketplacesListForBillingPeriod) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/MarketplacesListForBillingPeriod.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewMarketplacesClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.MarketplacesClientListOptions{Filter: nil, Top: nil, Skiptoken: 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.MarketplacesListResult = armconsumption.MarketplacesListResult{ // Value: []*armconsumption.Marketplace{ // { // Name: to.Ptr("marketplacesId1"), // Type: to.Ptr("Microsoft.Consumption/marketPlaces"), // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/marketPlaces/marketplacesId1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Properties: &armconsumption.MarketplaceProperties{ // AccountName: to.Ptr("Account1"), // AdditionalProperties: to.Ptr("additionalProperties"), // BillingPeriodID: to.Ptr("/subscriptions/subid/providers/Microsoft.Billing/billingPeriods/201702"), // ConsumedQuantity: to.Ptr[float64](0.00328), // CostCenter: to.Ptr("Center1"), // Currency: to.Ptr("USD"), // DepartmentName: to.Ptr("Department1"), // InstanceID: to.Ptr("/subscriptions/subid/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1"), // InstanceName: to.Ptr("shared1"), // IsEstimated: to.Ptr(false), // IsRecurringCharge: to.Ptr(false), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferName: to.Ptr("offer1"), // OrderNumber: to.Ptr("00000000-0000-0000-0000-000000000000"), // PlanName: to.Ptr("plan2"), // PretaxCost: to.Ptr[float64](0.67), // PublisherName: to.Ptr("xyz"), // ResourceGroup: to.Ptr("TEST"), // ResourceRate: to.Ptr[float64](0.24), // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("azure subscription"), // UnitOfMeasure: to.Ptr("10 Hours"), // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T23:59:59.000Z"); return t}()), // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T00:00:00.000Z"); return t}()), // }, // }}, // } } }
Output:
type MarketplacesClientListOptions ¶ added in v0.3.0
type MarketplacesClientListOptions struct { // May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, // properties/instanceName or properties/instanceId. The filter supports // 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. 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 marketplaces. Top *int32 }
MarketplacesClientListOptions contains the optional parameters for the MarketplacesClient.NewListPager method.
type MarketplacesClientListResponse ¶ added in v0.3.0
type MarketplacesClientListResponse struct { // Result of listing marketplaces. It contains a list of available marketplaces in reverse chronological order by billing // period. MarketplacesListResult }
MarketplacesClientListResponse contains the response from method MarketplacesClient.NewListPager.
type MarketplacesListResult ¶
type MarketplacesListResult struct { // READ-ONLY; The link (url) to the next page of results. NextLink *string // READ-ONLY; The list of marketplaces. Value []*Marketplace }
MarketplacesListResult - Result of listing marketplaces. It contains a list of available marketplaces in reverse chronological order by billing period.
func (MarketplacesListResult) MarshalJSON ¶
func (m MarketplacesListResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MarketplacesListResult.
func (*MarketplacesListResult) UnmarshalJSON ¶ added in v1.1.0
func (m *MarketplacesListResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type MarketplacesListResult.
type MeterDetails ¶
type MeterDetails struct { // READ-ONLY; The category of the meter, for example, 'Cloud services', 'Networking', etc.. MeterCategory *string // READ-ONLY; The location in which the Azure service is available. MeterLocation *string // READ-ONLY; The name of the meter, within the given meter category MeterName *string // READ-ONLY; The subcategory of the meter, for example, 'A6 Cloud services', 'ExpressRoute (IXP)', etc.. MeterSubCategory *string // READ-ONLY; The pretax listing price. PretaxStandardRate *float64 // READ-ONLY; The name of the service. ServiceName *string // READ-ONLY; The service tier. ServiceTier *string // READ-ONLY; The total included quantity associated with the offer. TotalIncludedQuantity *float64 // READ-ONLY; The unit in which the meter consumption is charged, for example, 'Hours', 'GB', etc. Unit *string }
MeterDetails - The properties of the meter detail.
func (MeterDetails) MarshalJSON ¶ added in v1.1.0
func (m MeterDetails) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MeterDetails.
func (*MeterDetails) UnmarshalJSON ¶ added in v1.1.0
func (m *MeterDetails) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type MeterDetails.
type MeterDetailsResponse ¶
type MeterDetailsResponse struct { // READ-ONLY; The category of the meter, for example, 'Cloud services', 'Networking', etc.. MeterCategory *string // READ-ONLY; The name of the meter, within the given meter category MeterName *string // READ-ONLY; The subcategory of the meter, for example, 'A6 Cloud services', 'ExpressRoute (IXP)', etc.. MeterSubCategory *string // READ-ONLY; The service family. ServiceFamily *string // READ-ONLY; The unit in which the meter consumption is charged, for example, 'Hours', 'GB', etc. UnitOfMeasure *string }
MeterDetailsResponse - The properties of the meter detail.
func (MeterDetailsResponse) MarshalJSON ¶ added in v1.1.0
func (m MeterDetailsResponse) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MeterDetailsResponse.
func (*MeterDetailsResponse) UnmarshalJSON ¶ added in v1.1.0
func (m *MeterDetailsResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type MeterDetailsResponse.
type Metrictype ¶
type Metrictype string
const ( // MetrictypeActualCostMetricType - Actual cost data. MetrictypeActualCostMetricType Metrictype = "actualcost" // MetrictypeAmortizedCostMetricType - Amortized cost data. MetrictypeAmortizedCostMetricType Metrictype = "amortizedcost" // MetrictypeUsageMetricType - Usage data. MetrictypeUsageMetricType Metrictype = "usage" )
func PossibleMetrictypeValues ¶
func PossibleMetrictypeValues() []Metrictype
PossibleMetrictypeValues returns the possible values for the Metrictype const type.
type ModernChargeSummary ¶
type ModernChargeSummary struct { // REQUIRED; Specifies the kind of charge summary. Kind *ChargeSummaryKind // REQUIRED; Properties for modern charge summary Properties *ModernChargeSummaryProperties // 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 }
ModernChargeSummary - Modern charge summary.
func (*ModernChargeSummary) GetChargeSummary ¶ added in v0.3.0
func (m *ModernChargeSummary) GetChargeSummary() *ChargeSummary
GetChargeSummary implements the ChargeSummaryClassification interface for type ModernChargeSummary.
func (ModernChargeSummary) MarshalJSON ¶
func (m ModernChargeSummary) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ModernChargeSummary.
func (*ModernChargeSummary) UnmarshalJSON ¶
func (m *ModernChargeSummary) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ModernChargeSummary.
type ModernChargeSummaryProperties ¶
type ModernChargeSummaryProperties struct { // READ-ONLY; Azure Charges. AzureCharges *Amount // READ-ONLY; Billing Account Id BillingAccountID *string // READ-ONLY; The id of the billing period resource that the charge belongs to. BillingPeriodID *string // READ-ONLY; Billing Profile Id BillingProfileID *string // READ-ONLY; Charges Billed separately. ChargesBilledSeparately *Amount // READ-ONLY; Customer Id CustomerID *string // READ-ONLY; Invoice Section Id InvoiceSectionID *string // READ-ONLY; Is charge Invoiced IsInvoiced *bool // READ-ONLY; Marketplace Charges. MarketplaceCharges *Amount // READ-ONLY; Usage end date. UsageEnd *string // READ-ONLY; Usage start date. UsageStart *string }
ModernChargeSummaryProperties - The properties of modern charge summary.
func (ModernChargeSummaryProperties) MarshalJSON ¶ added in v1.1.0
func (m ModernChargeSummaryProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ModernChargeSummaryProperties.
func (*ModernChargeSummaryProperties) UnmarshalJSON ¶ added in v1.1.0
func (m *ModernChargeSummaryProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ModernChargeSummaryProperties.
type ModernReservationRecommendation ¶
type ModernReservationRecommendation struct { // REQUIRED; Specifies the kind of reservation recommendation. Kind *ReservationRecommendationKind // REQUIRED; Properties for modern reservation recommendation Properties *ModernReservationRecommendationProperties // READ-ONLY; The etag for the resource. Etag *string // READ-ONLY; The full qualified ARM ID of an event. ID *string // READ-ONLY; Resource location Location *string // READ-ONLY; The ID that uniquely identifies an event. Name *string // READ-ONLY; Resource sku SKU *string // READ-ONLY; Resource tags. Tags map[string]*string // READ-ONLY; Resource type. Type *string }
ModernReservationRecommendation - Modern reservation recommendation.
func (*ModernReservationRecommendation) GetReservationRecommendation ¶ added in v0.3.0
func (m *ModernReservationRecommendation) GetReservationRecommendation() *ReservationRecommendation
GetReservationRecommendation implements the ReservationRecommendationClassification interface for type ModernReservationRecommendation.
func (ModernReservationRecommendation) MarshalJSON ¶
func (m ModernReservationRecommendation) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ModernReservationRecommendation.
func (*ModernReservationRecommendation) UnmarshalJSON ¶
func (m *ModernReservationRecommendation) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ModernReservationRecommendation.
type ModernReservationRecommendationProperties ¶
type ModernReservationRecommendationProperties struct { // READ-ONLY; The total amount of cost without reserved instances. CostWithNoReservedInstances *Amount // READ-ONLY; The usage date for looking back. FirstUsageDate *time.Time // READ-ONLY; The instance Flexibility Group. InstanceFlexibilityGroup *string // READ-ONLY; The instance Flexibility Ratio. InstanceFlexibilityRatio *float32 // READ-ONLY; Resource Location. Location *string // READ-ONLY; The number of days of usage to look back for recommendation. LookBackPeriod *int32 // READ-ONLY; The meter id (GUID) MeterID *string // READ-ONLY; Total estimated savings with reserved instances. NetSavings *Amount // READ-ONLY; The normalized Size. NormalizedSize *string // READ-ONLY; Recommended quality for reserved instances. RecommendedQuantity *float64 // READ-ONLY; The recommended Quantity Normalized. RecommendedQuantityNormalized *float32 // READ-ONLY; This is the ARM Sku name. SKUName *string // READ-ONLY; List of sku properties SKUProperties []*SKUProperty // READ-ONLY; Shared or single recommendation. Scope *string // READ-ONLY; RI recommendations in one or three year terms. Term *string // READ-ONLY; The total amount of cost with reserved instances. TotalCostWithReservedInstances *Amount }
ModernReservationRecommendationProperties - The properties of the reservation recommendation.
func (ModernReservationRecommendationProperties) MarshalJSON ¶
func (m ModernReservationRecommendationProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ModernReservationRecommendationProperties.
func (*ModernReservationRecommendationProperties) UnmarshalJSON ¶
func (m *ModernReservationRecommendationProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ModernReservationRecommendationProperties.
type ModernReservationTransaction ¶
type ModernReservationTransaction struct { // REQUIRED; The properties of a modern reservation transaction. Properties *ModernReservationTransactionProperties // READ-ONLY; Resource Id. ID *string // READ-ONLY; Resource name. Name *string // READ-ONLY; Resource tags. Tags []*string // READ-ONLY; Resource type. Type *string }
ModernReservationTransaction - Modern Reservation transaction resource.
func (ModernReservationTransaction) MarshalJSON ¶
func (m ModernReservationTransaction) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ModernReservationTransaction.
func (*ModernReservationTransaction) UnmarshalJSON ¶ added in v1.1.0
func (m *ModernReservationTransaction) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ModernReservationTransaction.
type ModernReservationTransactionProperties ¶
type ModernReservationTransactionProperties struct { // READ-ONLY; The charge of the transaction. Amount *float64 // READ-ONLY; This is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. ArmSKUName *string // READ-ONLY; The billing frequency, which can be either one-time or recurring. BillingFrequency *string // READ-ONLY; Billing profile Id. BillingProfileID *string // READ-ONLY; Billing profile name. BillingProfileName *string // READ-ONLY; The ISO currency in which the transaction is charged, for example, USD. Currency *string // READ-ONLY; The description of the transaction. Description *string // READ-ONLY; The date of the transaction EventDate *time.Time // READ-ONLY; The type of the transaction (Purchase, Cancel, etc.) EventType *string // READ-ONLY; Invoice Number Invoice *string // READ-ONLY; Invoice Id as on the invoice where the specific transaction appears. InvoiceID *string // READ-ONLY; Invoice Section Id InvoiceSectionID *string // READ-ONLY; Invoice Section Name. InvoiceSectionName *string // READ-ONLY; The subscription guid that makes the transaction. PurchasingSubscriptionGUID *string // READ-ONLY; The subscription name that makes the transaction. PurchasingSubscriptionName *string // READ-ONLY; The quantity of the transaction. Quantity *float64 // READ-ONLY; The region of the transaction. Region *string // READ-ONLY; The reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents // a single purchase transaction. A reservation order contains reservations. The reservation // order specifies the VM size and region for the reservations. ReservationOrderID *string // READ-ONLY; The name of the reservation order. ReservationOrderName *string // READ-ONLY; This is the term of the transaction. Term *string }
ModernReservationTransactionProperties - The properties of a modern reservation transaction.
func (ModernReservationTransactionProperties) MarshalJSON ¶
func (m ModernReservationTransactionProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ModernReservationTransactionProperties.
func (*ModernReservationTransactionProperties) UnmarshalJSON ¶
func (m *ModernReservationTransactionProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ModernReservationTransactionProperties.
type ModernReservationTransactionsListResult ¶
type ModernReservationTransactionsListResult struct { // READ-ONLY; The link (url) to the next page of results. NextLink *string // READ-ONLY; The list of reservation recommendations. Value []*ModernReservationTransaction }
ModernReservationTransactionsListResult - Result of listing reservation recommendations.
func (ModernReservationTransactionsListResult) MarshalJSON ¶
func (m ModernReservationTransactionsListResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ModernReservationTransactionsListResult.
func (*ModernReservationTransactionsListResult) UnmarshalJSON ¶ added in v1.1.0
func (m *ModernReservationTransactionsListResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ModernReservationTransactionsListResult.
type ModernUsageDetail ¶
type ModernUsageDetail struct { // REQUIRED; Specifies the kind of usage details. Kind *UsageDetailsKind // REQUIRED; Properties for modern usage details Properties *ModernUsageDetailProperties // READ-ONLY; The etag for the resource. Etag *string // READ-ONLY; The full qualified ARM ID of an event. ID *string // READ-ONLY; The ID that uniquely identifies an event. Name *string // READ-ONLY; Resource tags. Tags map[string]*string // READ-ONLY; Resource type. Type *string }
ModernUsageDetail - Modern usage detail.
func (*ModernUsageDetail) GetUsageDetail ¶ added in v0.3.0
func (m *ModernUsageDetail) GetUsageDetail() *UsageDetail
GetUsageDetail implements the UsageDetailClassification interface for type ModernUsageDetail.
func (ModernUsageDetail) MarshalJSON ¶
func (m ModernUsageDetail) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ModernUsageDetail.
func (*ModernUsageDetail) UnmarshalJSON ¶
func (m *ModernUsageDetail) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ModernUsageDetail.
type ModernUsageDetailProperties ¶
type ModernUsageDetailProperties struct { // READ-ONLY; Additional details of this usage item. Use this field to get usage line item specific details such as the actual // VM Size (ServiceType) or the ratio in which the reservation discount is applied. AdditionalInfo *string // READ-ONLY; Unique identifier for the applicable benefit. BenefitID *string // READ-ONLY; Name of the applicable benefit. BenefitName *string // READ-ONLY; Billing Account identifier. BillingAccountID *string // READ-ONLY; Name of the Billing Account. BillingAccountName *string // READ-ONLY; The currency defining the billed cost. BillingCurrencyCode *string // READ-ONLY; Billing Period End Date as in the invoice. BillingPeriodEndDate *time.Time // READ-ONLY; Billing Period Start Date as in the invoice. BillingPeriodStartDate *time.Time // READ-ONLY; Identifier for the billing profile that groups costs across invoices in the a singular billing currency across // across the customers who have onboarded the Microsoft customer agreement and the // customers in CSP who have made entitlement purchases like SaaS, Marketplace, RI, etc. BillingProfileID *string // READ-ONLY; Name of the billing profile that groups costs across invoices in the a singular billing currency across across // the customers who have onboarded the Microsoft customer agreement and the customers in // CSP who have made entitlement purchases like SaaS, Marketplace, RI, etc. BillingProfileName *string // READ-ONLY; Indicates a charge represents credits, usage, a Marketplace purchase, a reservation fee, or a refund. ChargeType *string // READ-ONLY; Consumed service name. Name of the azure resource provider that emits the usage or was purchased. This value // is not provided for marketplace usage. ConsumedService *string // READ-ONLY; Name for Cost Allocation Rule. CostAllocationRuleName *string // READ-ONLY; The cost center of this department if it is a department and a cost center is provided. CostCenter *string // READ-ONLY; ExtendedCost or blended cost before tax in billed currency. CostInBillingCurrency *float64 // READ-ONLY; ExtendedCost or blended cost before tax in pricing currency to correlate with prices. CostInPricingCurrency *float64 // READ-ONLY; Estimated extendedCost or blended cost before tax in USD. CostInUSD *float64 // READ-ONLY; Name of the customer's AAD tenant. CustomerName *string // READ-ONLY; Identifier of the customer's AAD tenant. CustomerTenantID *string // READ-ONLY; Date for the usage record. Date *time.Time // READ-ONLY; Effective Price that's charged for the usage. EffectivePrice *float64 // READ-ONLY; Exchange rate used in conversion from pricing currency to billing currency. ExchangeRate *string // READ-ONLY; Date on which exchange rate used in conversion from pricing currency to billing currency. ExchangeRateDate *time.Time // READ-ONLY; Exchange Rate from pricing currency to billing currency. ExchangeRatePricingToBilling *float64 // READ-ONLY; Indicates how frequently this charge will occur. OneTime for purchases which only happen once, Monthly for fees // which recur every month, and UsageBased for charges based on how much a service is used. Frequency *string // READ-ONLY; Instance Name. InstanceName *string // READ-ONLY; Invoice ID as on the invoice where the specific transaction appears. InvoiceID *string // READ-ONLY; Identifier of the project that is being charged in the invoice. Not applicable for Microsoft Customer Agreements // onboarded by partners. InvoiceSectionID *string // READ-ONLY; Name of the project that is being charged in the invoice. Not applicable for Microsoft Customer Agreements onboarded // by partners. InvoiceSectionName *string // READ-ONLY; Determines if the cost is eligible to be paid for using Azure credits. IsAzureCreditEligible *bool // READ-ONLY; Market Price that's charged for the usage. MarketPrice *float64 // READ-ONLY; Identifies the top-level service for the usage. MeterCategory *string // READ-ONLY; The meter id (GUID). Not available for marketplace. For reserved instance this represents the primary meter // for which the reservation was purchased. For the actual VM Size for which the reservation is // purchased see productOrderName. MeterID *string // READ-ONLY; Identifies the name of the meter against which consumption is measured. MeterName *string // READ-ONLY; Identifies the location of the datacenter for certain services that are priced based on datacenter location. MeterRegion *string // READ-ONLY; Defines the type or sub-category of Azure service that can affect the rate. MeterSubCategory *string // READ-ONLY; Flag to indicate if partner earned credit has been applied or not. PartnerEarnedCreditApplied *string // READ-ONLY; Rate of discount applied if there is a partner earned credit (PEC) based on partner admin link access. PartnerEarnedCreditRate *float64 // READ-ONLY; Name of the partner' AAD tenant. PartnerName *string // READ-ONLY; Identifier for the partner's AAD tenant. PartnerTenantID *string // READ-ONLY; Retail price for the resource. PayGPrice *float64 // READ-ONLY; The amount of PayG cost before tax in billing currency. PaygCostInBillingCurrency *float64 // READ-ONLY; The amount of PayG cost before tax in US Dollar currency. PaygCostInUSD *float64 // READ-ONLY; Reference to an original invoice there is a refund (negative cost). This is populated only when there is a refund. PreviousInvoiceID *string // READ-ONLY; Pricing Billing Currency. PricingCurrencyCode *string // READ-ONLY; Identifier that indicates how the meter is priced PricingModel *PricingModelType // READ-ONLY; Name of the product that has accrued charges by consumption or purchase as listed in the invoice. Not available // for Marketplace. Product *string // READ-ONLY; Identifier for the product that has accrued charges by consumption or purchase . This is the concatenated key // of productId and SkuId in partner center. ProductIdentifier *string // READ-ONLY; The identifier for the asset or Azure plan name that the subscription belongs to. For example: Azure Plan. For // reservations this is the Reservation Order ID. ProductOrderID *string // READ-ONLY; Product Order Name. For reservations this is the SKU that was purchased. ProductOrderName *string // READ-ONLY; Identifier for Product Category or Line Of Business, Ex - Azure, Microsoft 365, AWS e.t.c Provider *string // READ-ONLY; Publisher Id. PublisherID *string // READ-ONLY; Name of the publisher of the service including Microsoft or Third Party publishers. PublisherName *string // READ-ONLY; Type of publisher that identifies if the publisher is first party, third party reseller or third party agency. PublisherType *string // READ-ONLY; Measure the quantity purchased or consumed.The amount of the meter used during the billing period. Quantity *float64 // READ-ONLY; MPNId for the reseller associated with the subscription. ResellerMpnID *string // READ-ONLY; Reseller Name. ResellerName *string // READ-ONLY; ARM resource id of the reservation. Only applies to records relevant to reservations. ReservationID *string // READ-ONLY; User provided display name of the reservation. Last known name for a particular day is populated in the daily // data. Only applies to records relevant to reservations. ReservationName *string // READ-ONLY; Name of the Azure resource group used for cohesive lifecycle management of resources. ResourceGroup *string // READ-ONLY; Name of the resource location. ResourceLocation *string // READ-ONLY; Resource Location Normalized. ResourceLocationNormalized *string // READ-ONLY; List the service family for the product purchased or charged (Example: Storage ; Compute). ServiceFamily *string // READ-ONLY; Service-specific metadata. ServiceInfo1 *string // READ-ONLY; Legacy field with optional service-specific metadata. ServiceInfo2 *string // READ-ONLY; End date for the period when the service usage was rated for charges. The prices for Azure services are determined // based on the rating period. ServicePeriodEndDate *time.Time // READ-ONLY; Start date for the rating period when the service usage was rated for charges. The prices for Azure services // are determined for the rating period. ServicePeriodStartDate *time.Time // READ-ONLY; Unique Microsoft generated identifier for the Azure Subscription. SubscriptionGUID *string // READ-ONLY; Name of the Azure Subscription. SubscriptionName *string // READ-ONLY; Term (in months). Displays the term for the validity of the offer. For example. In case of reserved instances // it displays 12 months for yearly term of reserved instance. For one time purchases or // recurring purchases, the terms displays 1 month; This is not applicable for Azure consumption. Term *string // READ-ONLY; Identifies the Unit that the service is charged in. For example, GB, hours, 10,000 s. UnitOfMeasure *string // READ-ONLY; Unit Price is the price applicable to you. (your EA or other contract price). UnitPrice *float64 }
ModernUsageDetailProperties - The properties of the usage detail.
func (ModernUsageDetailProperties) MarshalJSON ¶
func (m ModernUsageDetailProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ModernUsageDetailProperties.
func (*ModernUsageDetailProperties) UnmarshalJSON ¶
func (m *ModernUsageDetailProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ModernUsageDetailProperties.
type Notification ¶
type Notification struct { // REQUIRED; Email addresses to send the budget notification to when the threshold is exceeded. Must have at least one contact // email or contact group specified at the Subscription or Resource Group scopes. All // other scopes must have at least one contact email specified. ContactEmails []*string // REQUIRED; The notification is enabled or not. Enabled *bool // REQUIRED; The comparison operator. Operator *OperatorType // REQUIRED; Threshold value associated with a notification. Notification is sent when the cost exceeded the threshold. It // is always percent and has to be between 0 and 1000. Threshold *float64 // Action groups to send the budget notification to when the threshold is exceeded. Must be provided as a fully qualified // Azure resource id. Only supported at Subscription or Resource Group scopes. ContactGroups []*string // Contact roles to send the budget notification to when the threshold is exceeded. ContactRoles []*string // Language in which the recipient will receive the notification Locale *CultureCode // The type of threshold ThresholdType *ThresholdType }
Notification - The notification associated with a budget.
func (Notification) MarshalJSON ¶
func (n Notification) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type Notification.
func (*Notification) UnmarshalJSON ¶ added in v1.1.0
func (n *Notification) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type Notification.
type Operation ¶
type Operation struct { // The object that represents the operation. Display *OperationDisplay // READ-ONLY; Operation Id. ID *string // READ-ONLY; Operation name: {provider}/{resource}/{operation}. Name *string }
Operation - A Consumption REST API operation.
func (Operation) MarshalJSON ¶ added in v1.1.0
MarshalJSON implements the json.Marshaller interface for type Operation.
func (*Operation) UnmarshalJSON ¶ added in v1.1.0
UnmarshalJSON implements the json.Unmarshaller interface for type Operation.
type OperationDisplay ¶
type OperationDisplay struct { // READ-ONLY; Description of the operation. Description *string // READ-ONLY; Operation type: Read, write, delete, etc. Operation *string // READ-ONLY; Service provider: Microsoft.Consumption. Provider *string // READ-ONLY; Resource on which the operation is performed: UsageDetail, etc. 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 consumption operations supported by the Microsoft.Consumption resource provider. Value []*Operation }
OperationListResult - Result of listing consumption 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 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.5.0
func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse]
NewListPager - Lists all of the available consumption 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/consumption/resource-manager/Microsoft.Consumption/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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", 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 = armconsumption.OperationListResult{ // Value: []*armconsumption.Operation{ // { // Name: to.Ptr("Microsoft.Consumption/Operation"), // Display: &armconsumption.OperationDisplay{ // Description: to.Ptr("Create or Update Managed Applications"), // Operation: to.Ptr("Create or Update Managed Applications"), // Provider: to.Ptr("Microsoft Azure Distributed Managed Service"), // Resource: to.Ptr("Managed Applications"), // }, // }}, // } } }
Output:
type OperationsClientListOptions ¶ added in v0.3.0
type OperationsClientListOptions struct { }
OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.
type OperationsClientListResponse ¶ added in v0.3.0
type OperationsClientListResponse struct { // Result of listing consumption operations. It contains a list of operations and a URL link to get the next set of results. OperationListResult }
OperationsClientListResponse contains the response from method OperationsClient.NewListPager.
type OperatorType ¶
type OperatorType string
OperatorType - The comparison operator.
const ( OperatorTypeEqualTo OperatorType = "EqualTo" OperatorTypeGreaterThan OperatorType = "GreaterThan" OperatorTypeGreaterThanOrEqualTo OperatorType = "GreaterThanOrEqualTo" )
func PossibleOperatorTypeValues ¶
func PossibleOperatorTypeValues() []OperatorType
PossibleOperatorTypeValues returns the possible values for the OperatorType const type.
type PriceSheetClient ¶
type PriceSheetClient struct {
// contains filtered or unexported fields
}
PriceSheetClient contains the methods for the PriceSheet group. Don't use this type directly, use NewPriceSheetClient() instead.
func NewPriceSheetClient ¶
func NewPriceSheetClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PriceSheetClient, error)
NewPriceSheetClient creates a new instance of PriceSheetClient with the specified values.
- subscriptionID - Azure Subscription ID.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*PriceSheetClient) Get ¶
func (client *PriceSheetClient) Get(ctx context.Context, options *PriceSheetClientGetOptions) (PriceSheetClientGetResponse, error)
Get - Gets the price sheet for a subscription. Price sheet is available via this API only for May 1, 2014 or later. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2021-10-01
- options - PriceSheetClientGetOptions contains the optional parameters for the PriceSheetClient.Get method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/PriceSheet.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewPriceSheetClient().Get(ctx, &armconsumption.PriceSheetClientGetOptions{Expand: nil, Skiptoken: nil, Top: 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.PriceSheetResult = armconsumption.PriceSheetResult{ // Name: to.Ptr("default"), // Type: to.Ptr("Microsoft.Consumption/pricesheets"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/pricesheets/default"), // Properties: &armconsumption.PriceSheetModel{ // Pricesheets: []*armconsumption.PriceSheetProperties{ // { // BillingPeriodID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201702"), // CurrencyCode: to.Ptr("EUR"), // IncludedQuantity: to.Ptr[float64](100), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferID: to.Ptr("OfferId 1"), // PartNumber: to.Ptr("XX-11110"), // UnitOfMeasure: to.Ptr("100 Hours"), // UnitPrice: to.Ptr[float64](0.00328), // }}, // }, // } }
Output:
func (*PriceSheetClient) GetByBillingPeriod ¶
func (client *PriceSheetClient) GetByBillingPeriod(ctx context.Context, billingPeriodName string, options *PriceSheetClientGetByBillingPeriodOptions) (PriceSheetClientGetByBillingPeriodResponse, error)
GetByBillingPeriod - Get the price sheet for a scope by subscriptionId and billing period. Price sheet is available via this API only for May 1, 2014 or later. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2021-10-01
- billingPeriodName - Billing Period Name.
- options - PriceSheetClientGetByBillingPeriodOptions contains the optional parameters for the PriceSheetClient.GetByBillingPeriod method.
Example (PriceSheetExpand) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/PriceSheetExpand.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewPriceSheetClient().GetByBillingPeriod(ctx, "201801", &armconsumption.PriceSheetClientGetByBillingPeriodOptions{Expand: to.Ptr("meterDetails"), Skiptoken: nil, Top: 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.PriceSheetResult = armconsumption.PriceSheetResult{ // Name: to.Ptr("default"), // Type: to.Ptr("Microsoft.Consumption/pricesheets"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/pricesheets/default"), // Properties: &armconsumption.PriceSheetModel{ // Pricesheets: []*armconsumption.PriceSheetProperties{ // { // BillingPeriodID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201702"), // CurrencyCode: to.Ptr("EUR"), // IncludedQuantity: to.Ptr[float64](100), // MeterDetails: &armconsumption.MeterDetails{ // MeterCategory: to.Ptr("Networking"), // MeterLocation: to.Ptr("Zone 2"), // MeterName: to.Ptr("Data Transfer Out (GB)"), // PretaxStandardRate: to.Ptr[float64](0.138), // TotalIncludedQuantity: to.Ptr[float64](0), // Unit: to.Ptr("GB"), // }, // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferID: to.Ptr("OfferId 1"), // PartNumber: to.Ptr("XX-11110"), // UnitOfMeasure: to.Ptr("100 Hours"), // UnitPrice: to.Ptr[float64](0.00328), // }}, // }, // } }
Output:
Example (PriceSheetForBillingPeriod) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/PriceSheetForBillingPeriod.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewPriceSheetClient().GetByBillingPeriod(ctx, "201801", &armconsumption.PriceSheetClientGetByBillingPeriodOptions{Expand: nil, Skiptoken: nil, Top: 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.PriceSheetResult = armconsumption.PriceSheetResult{ // Name: to.Ptr("default"), // Type: to.Ptr("Microsoft.Consumption/pricesheets"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/pricesheets/default"), // Properties: &armconsumption.PriceSheetModel{ // Pricesheets: []*armconsumption.PriceSheetProperties{ // { // BillingPeriodID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201702"), // CurrencyCode: to.Ptr("EUR"), // IncludedQuantity: to.Ptr[float64](100), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferID: to.Ptr("OfferId 1"), // PartNumber: to.Ptr("XX-11110"), // UnitOfMeasure: to.Ptr("100 Hours"), // UnitPrice: to.Ptr[float64](0.00328), // }}, // }, // } }
Output:
type PriceSheetClientGetByBillingPeriodOptions ¶ added in v0.3.0
type PriceSheetClientGetByBillingPeriodOptions struct { // May be used to expand the properties/meterDetails within a price sheet. By default, these fields are not included when // returning price sheet. Expand *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 top N results. Top *int32 }
PriceSheetClientGetByBillingPeriodOptions contains the optional parameters for the PriceSheetClient.GetByBillingPeriod method.
type PriceSheetClientGetByBillingPeriodResponse ¶ added in v0.3.0
type PriceSheetClientGetByBillingPeriodResponse struct { // An pricesheet resource. PriceSheetResult }
PriceSheetClientGetByBillingPeriodResponse contains the response from method PriceSheetClient.GetByBillingPeriod.
type PriceSheetClientGetOptions ¶ added in v0.3.0
type PriceSheetClientGetOptions struct { // May be used to expand the properties/meterDetails within a price sheet. By default, these fields are not included when // returning price sheet. Expand *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 top N results. Top *int32 }
PriceSheetClientGetOptions contains the optional parameters for the PriceSheetClient.Get method.
type PriceSheetClientGetResponse ¶ added in v0.3.0
type PriceSheetClientGetResponse struct { // An pricesheet resource. PriceSheetResult }
PriceSheetClientGetResponse contains the response from method PriceSheetClient.Get.
type PriceSheetModel ¶
type PriceSheetModel struct { // READ-ONLY; Pricesheet download details. Download *MeterDetails // READ-ONLY; The link (url) to the next page of results. NextLink *string // READ-ONLY; Price sheet Pricesheets []*PriceSheetProperties }
PriceSheetModel - price sheet result. It contains the pricesheet associated with billing period
func (PriceSheetModel) MarshalJSON ¶
func (p PriceSheetModel) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PriceSheetModel.
func (*PriceSheetModel) UnmarshalJSON ¶ added in v1.1.0
func (p *PriceSheetModel) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PriceSheetModel.
type PriceSheetProperties ¶
type PriceSheetProperties struct { // READ-ONLY; The id of the billing period resource that the usage belongs to. BillingPeriodID *string // READ-ONLY; Currency Code CurrencyCode *string // READ-ONLY; Included quality for an offer IncludedQuantity *float64 // READ-ONLY; The details about the meter. By default this is not populated, unless it's specified in $expand. MeterDetails *MeterDetails // READ-ONLY; The meter id (GUID) MeterID *string // READ-ONLY; Offer Id OfferID *string // READ-ONLY; Part Number PartNumber *string // READ-ONLY; Unit of measure UnitOfMeasure *string // READ-ONLY; Unit Price UnitPrice *float64 }
PriceSheetProperties - The properties of the price sheet.
func (PriceSheetProperties) MarshalJSON ¶ added in v1.1.0
func (p PriceSheetProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PriceSheetProperties.
func (*PriceSheetProperties) UnmarshalJSON ¶ added in v1.1.0
func (p *PriceSheetProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PriceSheetProperties.
type PriceSheetResult ¶
type PriceSheetResult struct { // price sheet result. It contains the pricesheet associated with billing period Properties *PriceSheetModel // READ-ONLY; The etag for the resource. Etag *string // READ-ONLY; The full qualified ARM ID of an event. ID *string // READ-ONLY; The ID that uniquely identifies an event. Name *string // READ-ONLY; Resource tags. Tags map[string]*string // READ-ONLY; Resource type. Type *string }
PriceSheetResult - An pricesheet resource.
func (PriceSheetResult) MarshalJSON ¶
func (p PriceSheetResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PriceSheetResult.
func (*PriceSheetResult) UnmarshalJSON ¶
func (p *PriceSheetResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PriceSheetResult.
type PricingModelType ¶
type PricingModelType string
PricingModelType - Identifier that indicates how the meter is priced.
const ( PricingModelTypeOnDemand PricingModelType = "On Demand" PricingModelTypeReservation PricingModelType = "Reservation" PricingModelTypeSpot PricingModelType = "Spot" )
func PossiblePricingModelTypeValues ¶
func PossiblePricingModelTypeValues() []PricingModelType
PossiblePricingModelTypeValues returns the possible values for the PricingModelType 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 Reseller ¶
type Reseller struct { // READ-ONLY; The reseller property description. ResellerDescription *string // READ-ONLY; The reseller property ID. ResellerID *string }
Reseller - The reseller properties.
func (Reseller) MarshalJSON ¶ added in v1.1.0
MarshalJSON implements the json.Marshaller interface for type Reseller.
func (*Reseller) UnmarshalJSON ¶ added in v1.1.0
UnmarshalJSON implements the json.Unmarshaller interface for type Reseller.
type ReservationDetail ¶
type ReservationDetail struct { // The properties of the reservation detail. Properties *ReservationDetailProperties // READ-ONLY; The etag for the resource. Etag *string // READ-ONLY; The full qualified ARM ID of an event. ID *string // READ-ONLY; The ID that uniquely identifies an event. Name *string // READ-ONLY; Resource tags. Tags map[string]*string // READ-ONLY; Resource type. Type *string }
ReservationDetail - reservation detail resource.
func (ReservationDetail) MarshalJSON ¶
func (r ReservationDetail) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ReservationDetail.
func (*ReservationDetail) UnmarshalJSON ¶
func (r *ReservationDetail) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ReservationDetail.
type ReservationDetailProperties ¶
type ReservationDetailProperties struct { // READ-ONLY; The instance Flexibility Group. InstanceFlexibilityGroup *string // READ-ONLY; The instance Flexibility Ratio. InstanceFlexibilityRatio *string // READ-ONLY; This identifier is the name of the resource or the fully qualified Resource ID. InstanceID *string // READ-ONLY; The reservation kind. Kind *string // READ-ONLY; The reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping // for applying the benefit scope and also specifies the number of instances to which // the reservation benefit can be applied to. ReservationID *string // READ-ONLY; The reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents // a single purchase transaction. A reservation order contains reservations. The reservation // order specifies the VM size and region for the reservations. ReservationOrderID *string // READ-ONLY; This is the total hours reserved for the day. E.g. if reservation for 1 instance was made on 1 PM, this will // be 11 hours for that day and 24 hours from subsequent days. ReservedHours *float64 // READ-ONLY; This is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. SKUName *string // READ-ONLY; This is the total count of instances that are reserved for the reservationId. TotalReservedQuantity *float64 // READ-ONLY; The date on which consumption occurred. UsageDate *time.Time // READ-ONLY; This is the total hours used by the instance. UsedHours *float64 }
ReservationDetailProperties - The properties of the reservation detail.
func (ReservationDetailProperties) MarshalJSON ¶
func (r ReservationDetailProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ReservationDetailProperties.
func (*ReservationDetailProperties) UnmarshalJSON ¶
func (r *ReservationDetailProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ReservationDetailProperties.
type ReservationDetailsListResult ¶
type ReservationDetailsListResult struct { // READ-ONLY; The link (url) to the next page of results. NextLink *string // READ-ONLY; The list of reservation details. Value []*ReservationDetail }
ReservationDetailsListResult - Result of listing reservation details.
func (ReservationDetailsListResult) MarshalJSON ¶
func (r ReservationDetailsListResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ReservationDetailsListResult.
func (*ReservationDetailsListResult) UnmarshalJSON ¶ added in v1.1.0
func (r *ReservationDetailsListResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ReservationDetailsListResult.
type ReservationRecommendation ¶
type ReservationRecommendation struct { // REQUIRED; Specifies the kind of reservation recommendation. Kind *ReservationRecommendationKind // READ-ONLY; The etag for the resource. Etag *string // READ-ONLY; The full qualified ARM ID of an event. ID *string // READ-ONLY; Resource location Location *string // READ-ONLY; The ID that uniquely identifies an event. Name *string // READ-ONLY; Resource sku SKU *string // READ-ONLY; Resource tags. Tags map[string]*string // READ-ONLY; Resource type. Type *string }
ReservationRecommendation - A reservation recommendation resource.
func (*ReservationRecommendation) GetReservationRecommendation ¶
func (r *ReservationRecommendation) GetReservationRecommendation() *ReservationRecommendation
GetReservationRecommendation implements the ReservationRecommendationClassification interface for type ReservationRecommendation.
func (ReservationRecommendation) MarshalJSON ¶ added in v0.3.0
func (r ReservationRecommendation) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ReservationRecommendation.
func (*ReservationRecommendation) UnmarshalJSON ¶
func (r *ReservationRecommendation) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ReservationRecommendation.
type ReservationRecommendationClassification ¶
type ReservationRecommendationClassification interface { // GetReservationRecommendation returns the ReservationRecommendation content of the underlying type. GetReservationRecommendation() *ReservationRecommendation }
ReservationRecommendationClassification provides polymorphic access to related types. Call the interface's GetReservationRecommendation() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *LegacyReservationRecommendation, *ModernReservationRecommendation, *ReservationRecommendation
type ReservationRecommendationDetailsCalculatedSavingsProperties ¶
type ReservationRecommendationDetailsCalculatedSavingsProperties struct { // The number of reserved units used to calculate savings. Always 1 for virtual machines. ReservedUnitCount *float32 // READ-ONLY; The cost without reservation. OnDemandCost *float32 // READ-ONLY; The difference between total reservation cost and reservation cost. OverageCost *float32 // READ-ONLY; The quantity for calculated savings. Quantity *float32 // READ-ONLY; The exact cost of the estimated usage using reservation. ReservationCost *float32 // READ-ONLY; The amount saved by purchasing the recommended quantity of reservation. Savings *float32 // READ-ONLY; The cost of the suggested quantity. TotalReservationCost *float32 }
ReservationRecommendationDetailsCalculatedSavingsProperties - Details of estimated savings.
func (ReservationRecommendationDetailsCalculatedSavingsProperties) MarshalJSON ¶ added in v1.1.0
func (r ReservationRecommendationDetailsCalculatedSavingsProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ReservationRecommendationDetailsCalculatedSavingsProperties.
func (*ReservationRecommendationDetailsCalculatedSavingsProperties) UnmarshalJSON ¶ added in v1.1.0
func (r *ReservationRecommendationDetailsCalculatedSavingsProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ReservationRecommendationDetailsCalculatedSavingsProperties.
type ReservationRecommendationDetailsClient ¶
type ReservationRecommendationDetailsClient struct {
// contains filtered or unexported fields
}
ReservationRecommendationDetailsClient contains the methods for the ReservationRecommendationDetails group. Don't use this type directly, use NewReservationRecommendationDetailsClient() instead.
func NewReservationRecommendationDetailsClient ¶
func NewReservationRecommendationDetailsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ReservationRecommendationDetailsClient, error)
NewReservationRecommendationDetailsClient creates a new instance of ReservationRecommendationDetailsClient with the specified values.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*ReservationRecommendationDetailsClient) Get ¶
func (client *ReservationRecommendationDetailsClient) Get(ctx context.Context, resourceScope string, scope Scope, region string, term Term, lookBackPeriod LookBackPeriod, product string, options *ReservationRecommendationDetailsClientGetOptions) (ReservationRecommendationDetailsClientGetResponse, error)
Get - Details of a reservation recommendation for what-if analysis of reserved instances. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2021-10-01
- resourceScope - The scope associated with reservation recommendation details operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope
- scope - Scope of the reservation.
- region - Used to select the region the recommendation should be generated for.
- term - Specify length of reservation recommendation term.
- lookBackPeriod - Filter the time period on which reservation recommendation results are based.
- product - Filter the products for which reservation recommendation results are generated. Examples: StandardDS1v2 (for VM), PremiumSSDManagedDisksP30 (for Managed Disks)
- options - ReservationRecommendationDetailsClientGetOptions contains the optional parameters for the ReservationRecommendationDetailsClient.Get method.
Example (ReservationRecommendationsByBillingAccountLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationRecommendationDetailsByBillingAccount.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewReservationRecommendationDetailsClient().Get(ctx, "providers/Microsoft.Billing/billingAccounts/000000", armconsumption.ScopeShared, "eastus", armconsumption.TermP1Y, armconsumption.LookBackPeriodLast60Days, "Standard_DS14_v2", 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.ReservationRecommendationDetailsModel = armconsumption.ReservationRecommendationDetailsModel{ // Name: to.Ptr("reservationRecommendationDetails"), // Type: to.Ptr("Microsoft.Consumption/ReservationRecommendationDetails"), // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/00000000/providers/microsoft.consumption/reservationrecommendationdetails"), // Properties: &armconsumption.ReservationRecommendationDetailsProperties{ // Currency: to.Ptr("USD"), // Resource: &armconsumption.ReservationRecommendationDetailsResourceProperties{ // AppliedScopes: []*string{ // to.Ptr("00000000-0000-0000-0000-00000000"), // to.Ptr("00000000-0000-0000-0000-00000000")}, // OnDemandRate: to.Ptr[float32](1.482), // Product: to.Ptr("Standard_DS14_v2"), // Region: to.Ptr("eastus"), // ReservationRate: to.Ptr[float32](0.70570776255707), // ResourceType: to.Ptr("virtualmachines"), // }, // Savings: &armconsumption.ReservationRecommendationDetailsSavingsProperties{ // CalculatedSavings: []*armconsumption.ReservationRecommendationDetailsCalculatedSavingsProperties{ // { // OnDemandCost: to.Ptr[float32](529550.326618951), // OverageCost: to.Ptr[float32](63253.5935111345), // Quantity: to.Ptr[float32](220), // ReservationCost: to.Ptr[float32](223102.452054792), // Savings: to.Ptr[float32](243194.281053024), // TotalReservationCost: to.Ptr[float32](286356.045565927), // }, // { // OnDemandCost: to.Ptr[float32](529550.32661895), // OverageCost: to.Ptr[float32](149335.025050147), // Quantity: to.Ptr[float32](179), // ReservationCost: to.Ptr[float32](181524.267808217), // Savings: to.Ptr[float32](198691.033760586), // TotalReservationCost: to.Ptr[float32](330859.292858364), // }, // { // OnDemandCost: to.Ptr[float32](529550.32661895), // OverageCost: to.Ptr[float32](195942.319606957), // Quantity: to.Ptr[float32](157), // ReservationCost: to.Ptr[float32](159214.022602738), // Savings: to.Ptr[float32](174393.984409255), // TotalReservationCost: to.Ptr[float32](355156.342209695), // }, // { // OnDemandCost: to.Ptr[float32](529550.32661895), // OverageCost: to.Ptr[float32](30975.2311896299), // Quantity: to.Ptr[float32](241), // ReservationCost: to.Ptr[float32](244398.595205477), // Savings: to.Ptr[float32](254176.500223843), // TotalReservationCost: to.Ptr[float32](275373.826395107), // }}, // LookBackPeriod: to.Ptr[int32](60), // RecommendedQuantity: to.Ptr[float32](253), // ReservationOrderTerm: to.Ptr("P1Y"), // SavingsType: to.Ptr("instance"), // UnitOfMeasure: to.Ptr("hour"), // }, // Scope: to.Ptr("Shared"), // Usage: &armconsumption.ReservationRecommendationDetailsUsageProperties{ // FirstConsumptionDate: to.Ptr("2019-11-27T00:00:00"), // LastConsumptionDate: to.Ptr("2020-01-25T21:00:00"), // LookBackUnitType: to.Ptr("virtualMachine quantity"), // UsageData: []*float32{ // to.Ptr[float32](275.95003899999995), // to.Ptr[float32](275.916705), // to.Ptr[float32](276), // to.Ptr[float32](276), // to.Ptr[float32](275.916725), // to.Ptr[float32](275.916705), // to.Ptr[float32](275.98335299999997), // to.Ptr[float32](276), // to.Ptr[float32](276), // to.Ptr[float32](276), // to.Ptr[float32](276), // to.Ptr[float32](276), // to.Ptr[float32](275.98335299999997), // to.Ptr[float32](276), // to.Ptr[float32](276), // to.Ptr[float32](276), // to.Ptr[float32](276), // to.Ptr[float32](275.933352)}, // UsageGrain: to.Ptr("hourly"), // }, // }, // } }
Output:
Example (ReservationRecommendationsByBillingProfileModern) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationRecommendationDetailsByBillingProfile.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewReservationRecommendationDetailsClient().Get(ctx, "providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-00000000:00000000-0000-0000-0000-00000000/billingProfiles/00000000-0000-0000-0000-00000000", armconsumption.ScopeShared, "australiaeast", armconsumption.TermP1Y, armconsumption.LookBackPeriodLast07Days, "Standard_B2s", 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.ReservationRecommendationDetailsModel = armconsumption.ReservationRecommendationDetailsModel{ // Name: to.Ptr("reservationRecommendationDetails"), // Type: to.Ptr("Microsoft.Consumption/ReservationRecommendationDetails"), // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-00000000:00000000-0000-0000-0000-00000000/billingProfiles/00000000-0000-0000-0000-00000000/providers/microsoft.consumption/reservationrecommendationdetails"), // Properties: &armconsumption.ReservationRecommendationDetailsProperties{ // Currency: to.Ptr("AUD"), // Resource: &armconsumption.ReservationRecommendationDetailsResourceProperties{ // AppliedScopes: []*string{ // to.Ptr("00000000-0000-0000-0000-00000000")}, // OnDemandRate: to.Ptr[float32](0.0725), // Product: to.Ptr("Standard_B2s"), // Region: to.Ptr("australiaeast"), // ReservationRate: to.Ptr[float32](0.04414166531788041), // ResourceType: to.Ptr("virtualmachines"), // }, // Savings: &armconsumption.ReservationRecommendationDetailsSavingsProperties{ // CalculatedSavings: []*armconsumption.ReservationRecommendationDetailsCalculatedSavingsProperties{ // { // OnDemandCost: to.Ptr[float32](632.8844720496894), // OverageCost: to.Ptr[float32](0), // Quantity: to.Ptr[float32](1), // ReservationCost: to.Ptr[float32](387.74038815226174), // Savings: to.Ptr[float32](245.1440838974277), // TotalReservationCost: to.Ptr[float32](387.74038815226174), // }}, // LookBackPeriod: to.Ptr[int32](7), // RecommendedQuantity: to.Ptr[float32](1), // ReservationOrderTerm: to.Ptr("P1Y"), // SavingsType: to.Ptr("instance"), // UnitOfMeasure: to.Ptr("hour"), // }, // Scope: to.Ptr("Shared"), // Usage: &armconsumption.ReservationRecommendationDetailsUsageProperties{ // FirstConsumptionDate: to.Ptr("2020-01-19T00:00:00"), // LastConsumptionDate: to.Ptr("2020-01-25T17:00:00"), // LookBackUnitType: to.Ptr("virtualMachine quantity"), // UsageData: []*float32{ // to.Ptr[float32](1), // to.Ptr[float32](1), // to.Ptr[float32](1), // to.Ptr[float32](1), // to.Ptr[float32](1), // to.Ptr[float32](1), // to.Ptr[float32](1), // to.Ptr[float32](1), // to.Ptr[float32](1), // to.Ptr[float32](0)}, // UsageGrain: to.Ptr("hourly"), // }, // }, // } }
Output:
Example (ReservationRecommendationsByResourceGroupLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationRecommendationDetailsByResourceGroup.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewReservationRecommendationDetailsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/testGroup", armconsumption.ScopeSingle, "westus", armconsumption.TermP3Y, armconsumption.LookBackPeriodLast30Days, "Standard_DS13_v2", 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.ReservationRecommendationDetailsModel = armconsumption.ReservationRecommendationDetailsModel{ // Name: to.Ptr("reservationRecommendationDetails"), // Type: to.Ptr("Microsoft.Consumption/ReservationRecommendationDetails"), // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/testGroup/providers/microsoft.consumption/reservationrecommendationdetails"), // Properties: &armconsumption.ReservationRecommendationDetailsProperties{ // Currency: to.Ptr("USD"), // Resource: &armconsumption.ReservationRecommendationDetailsResourceProperties{ // AppliedScopes: []*string{ // to.Ptr("00000000-0000-0000-0000-00000000"), // to.Ptr("testGroup")}, // OnDemandRate: to.Ptr[float32](0.519), // Product: to.Ptr("Standard_DS13_v2"), // Region: to.Ptr("westus"), // ReservationRate: to.Ptr[float32](0.302549467275493), // ResourceType: to.Ptr("virtualmachines"), // }, // ResourceGroup: to.Ptr("testGroup"), // Savings: &armconsumption.ReservationRecommendationDetailsSavingsProperties{ // CalculatedSavings: []*armconsumption.ReservationRecommendationDetailsCalculatedSavingsProperties{ // { // OnDemandCost: to.Ptr[float32](368.4813602070006), // OverageCost: to.Ptr[float32](0), // Quantity: to.Ptr[float32](2), // ReservationCost: to.Ptr[float32](429.01514459665), // Savings: to.Ptr[float32](-60.5337843896494), // TotalReservationCost: to.Ptr[float32](429.01514459665), // }, // { // OnDemandCost: to.Ptr[float32](368.481360207), // OverageCost: to.Ptr[float32](1.557), // Quantity: to.Ptr[float32](1), // ReservationCost: to.Ptr[float32](214.507572298325), // Savings: to.Ptr[float32](152.416787908675), // TotalReservationCost: to.Ptr[float32](216.064572298325), // }}, // LookBackPeriod: to.Ptr[int32](30), // RecommendedQuantity: to.Ptr[float32](1), // ReservationOrderTerm: to.Ptr("P3Y"), // SavingsType: to.Ptr("instance"), // UnitOfMeasure: to.Ptr("hour"), // }, // Scope: to.Ptr("Single"), // Usage: &armconsumption.ReservationRecommendationDetailsUsageProperties{ // FirstConsumptionDate: to.Ptr("2020-02-03T00:00:00"), // LastConsumptionDate: to.Ptr("2020-03-03T13:00:00"), // LookBackUnitType: to.Ptr("virtualMachine quantity"), // UsageData: []*float32{ // to.Ptr[float32](1), // to.Ptr[float32](1), // to.Ptr[float32](1), // to.Ptr[float32](1), // to.Ptr[float32](1), // to.Ptr[float32](1)}, // UsageGrain: to.Ptr("hourly"), // }, // }, // } }
Output:
Example (ReservationRecommendationsBySubscriptionLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationRecommendationDetailsBySubscription.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewReservationRecommendationDetailsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-00000000", armconsumption.ScopeSingle, "westus", armconsumption.TermP3Y, armconsumption.LookBackPeriodLast30Days, "Standard_DS13_v2", 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.ReservationRecommendationDetailsModel = armconsumption.ReservationRecommendationDetailsModel{ // Name: to.Ptr("reservationRecommendationDetails"), // Type: to.Ptr("Microsoft.Consumption/ReservationRecommendationDetails"), // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-00000000/providers/microsoft.consumption/reservationrecommendationdetails"), // Properties: &armconsumption.ReservationRecommendationDetailsProperties{ // Currency: to.Ptr("USD"), // Resource: &armconsumption.ReservationRecommendationDetailsResourceProperties{ // AppliedScopes: []*string{ // to.Ptr("00000000-0000-0000-0000-00000000")}, // OnDemandRate: to.Ptr[float32](0.519), // Product: to.Ptr("Standard_DS13_v2"), // Region: to.Ptr("westus"), // ReservationRate: to.Ptr[float32](0.302549467275493), // ResourceType: to.Ptr("virtualmachines"), // }, // Savings: &armconsumption.ReservationRecommendationDetailsSavingsProperties{ // CalculatedSavings: []*armconsumption.ReservationRecommendationDetailsCalculatedSavingsProperties{ // { // OnDemandCost: to.Ptr[float32](368.4813602070006), // OverageCost: to.Ptr[float32](0), // Quantity: to.Ptr[float32](2), // ReservationCost: to.Ptr[float32](429.01514459665), // Savings: to.Ptr[float32](-60.5337843896494), // TotalReservationCost: to.Ptr[float32](429.01514459665), // }, // { // OnDemandCost: to.Ptr[float32](368.481360207), // OverageCost: to.Ptr[float32](1.557), // Quantity: to.Ptr[float32](1), // ReservationCost: to.Ptr[float32](214.507572298325), // Savings: to.Ptr[float32](152.416787908675), // TotalReservationCost: to.Ptr[float32](216.064572298325), // }}, // LookBackPeriod: to.Ptr[int32](30), // RecommendedQuantity: to.Ptr[float32](1), // ReservationOrderTerm: to.Ptr("P3Y"), // SavingsType: to.Ptr("instance"), // UnitOfMeasure: to.Ptr("hour"), // }, // Scope: to.Ptr("Single"), // Usage: &armconsumption.ReservationRecommendationDetailsUsageProperties{ // FirstConsumptionDate: to.Ptr("2020-02-03T00:00:00"), // LastConsumptionDate: to.Ptr("2020-03-03T13:00:00"), // LookBackUnitType: to.Ptr("virtualMachine quantity"), // UsageData: []*float32{ // to.Ptr[float32](1), // to.Ptr[float32](1), // to.Ptr[float32](1), // to.Ptr[float32](1), // to.Ptr[float32](1), // to.Ptr[float32](1)}, // UsageGrain: to.Ptr("hourly"), // }, // }, // } }
Output:
type ReservationRecommendationDetailsClientGetOptions ¶ added in v0.3.0
type ReservationRecommendationDetailsClientGetOptions struct { }
ReservationRecommendationDetailsClientGetOptions contains the optional parameters for the ReservationRecommendationDetailsClient.Get method.
type ReservationRecommendationDetailsClientGetResponse ¶ added in v0.3.0
type ReservationRecommendationDetailsClientGetResponse struct { // Reservation recommendation details. ReservationRecommendationDetailsModel }
ReservationRecommendationDetailsClientGetResponse contains the response from method ReservationRecommendationDetailsClient.Get.
type ReservationRecommendationDetailsModel ¶
type ReservationRecommendationDetailsModel struct { // Resource Location. Location *string // The properties of the reservation recommendation. Properties *ReservationRecommendationDetailsProperties // Resource sku SKU *string // READ-ONLY; The etag for the resource. Etag *string // READ-ONLY; The full qualified ARM ID of an event. ID *string // READ-ONLY; The ID that uniquely identifies an event. Name *string // READ-ONLY; Resource tags. Tags map[string]*string // READ-ONLY; Resource type. Type *string }
ReservationRecommendationDetailsModel - Reservation recommendation details.
func (ReservationRecommendationDetailsModel) MarshalJSON ¶
func (r ReservationRecommendationDetailsModel) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ReservationRecommendationDetailsModel.
func (*ReservationRecommendationDetailsModel) UnmarshalJSON ¶
func (r *ReservationRecommendationDetailsModel) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ReservationRecommendationDetailsModel.
type ReservationRecommendationDetailsProperties ¶
type ReservationRecommendationDetailsProperties struct { // READ-ONLY; An ISO 4217 currency code identifier for the costs and savings Currency *string // READ-ONLY; Resource specific properties. Resource *ReservationRecommendationDetailsResourceProperties // READ-ONLY; Resource Group. ResourceGroup *string // READ-ONLY; Savings information for the recommendation. Savings *ReservationRecommendationDetailsSavingsProperties // READ-ONLY; Scope of the reservation, ex: Single or Shared. Scope *string // READ-ONLY; Historical usage details used to calculate the estimated savings. Usage *ReservationRecommendationDetailsUsageProperties }
ReservationRecommendationDetailsProperties - The properties of the reservation recommendation.
func (ReservationRecommendationDetailsProperties) MarshalJSON ¶ added in v1.1.0
func (r ReservationRecommendationDetailsProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ReservationRecommendationDetailsProperties.
func (*ReservationRecommendationDetailsProperties) UnmarshalJSON ¶ added in v1.1.0
func (r *ReservationRecommendationDetailsProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ReservationRecommendationDetailsProperties.
type ReservationRecommendationDetailsResourceProperties ¶
type ReservationRecommendationDetailsResourceProperties struct { // READ-ONLY; List of subscriptions for which the reservation is applied. AppliedScopes []*string // READ-ONLY; On demand rate of the resource. OnDemandRate *float32 // READ-ONLY; Azure product ex: StandardE8sv3 etc. Product *string // READ-ONLY; Azure resource region ex:EastUS, WestUS etc. Region *string // READ-ONLY; Reservation rate of the resource. ReservationRate *float32 // READ-ONLY; The azure resource type. ResourceType *string }
ReservationRecommendationDetailsResourceProperties - Details of the resource.
func (ReservationRecommendationDetailsResourceProperties) MarshalJSON ¶
func (r ReservationRecommendationDetailsResourceProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ReservationRecommendationDetailsResourceProperties.
func (*ReservationRecommendationDetailsResourceProperties) UnmarshalJSON ¶ added in v1.1.0
func (r *ReservationRecommendationDetailsResourceProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ReservationRecommendationDetailsResourceProperties.
type ReservationRecommendationDetailsSavingsProperties ¶
type ReservationRecommendationDetailsSavingsProperties struct { // List of calculated savings. CalculatedSavings []*ReservationRecommendationDetailsCalculatedSavingsProperties // READ-ONLY; Number of days of usage to look back used for computing the recommendation. LookBackPeriod *int32 // READ-ONLY; Number of recommended units of the resource. RecommendedQuantity *float32 // READ-ONLY; Term period of the reservation, ex: P1Y or P3Y. ReservationOrderTerm *string // READ-ONLY; Type of savings, ex: instance. SavingsType *string // READ-ONLY; Measurement unit ex: hour etc. UnitOfMeasure *string }
ReservationRecommendationDetailsSavingsProperties - Details of the estimated savings.
func (ReservationRecommendationDetailsSavingsProperties) MarshalJSON ¶
func (r ReservationRecommendationDetailsSavingsProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ReservationRecommendationDetailsSavingsProperties.
func (*ReservationRecommendationDetailsSavingsProperties) UnmarshalJSON ¶ added in v1.1.0
func (r *ReservationRecommendationDetailsSavingsProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ReservationRecommendationDetailsSavingsProperties.
type ReservationRecommendationDetailsUsageProperties ¶
type ReservationRecommendationDetailsUsageProperties struct { // READ-ONLY; The first usage date used for looking back for computing the recommendation. FirstConsumptionDate *string // READ-ONLY; The last usage date used for looking back for computing the recommendation. LastConsumptionDate *string // READ-ONLY; What the usage data values represent ex: virtual machine instance. LookBackUnitType *string // READ-ONLY; The breakdown of historical resource usage. The values are in the order of usage between the firstConsumptionDate // and the lastConsumptionDate. UsageData []*float32 // READ-ONLY; The grain of the values represented in the usage data ex: hourly. UsageGrain *string }
ReservationRecommendationDetailsUsageProperties - Details about historical usage data that has been used for computing the recommendation.
func (ReservationRecommendationDetailsUsageProperties) MarshalJSON ¶
func (r ReservationRecommendationDetailsUsageProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ReservationRecommendationDetailsUsageProperties.
func (*ReservationRecommendationDetailsUsageProperties) UnmarshalJSON ¶ added in v1.1.0
func (r *ReservationRecommendationDetailsUsageProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ReservationRecommendationDetailsUsageProperties.
type ReservationRecommendationKind ¶
type ReservationRecommendationKind string
ReservationRecommendationKind - Specifies the kind of reservation recommendation.
const ( ReservationRecommendationKindLegacy ReservationRecommendationKind = "legacy" ReservationRecommendationKindModern ReservationRecommendationKind = "modern" )
func PossibleReservationRecommendationKindValues ¶
func PossibleReservationRecommendationKindValues() []ReservationRecommendationKind
PossibleReservationRecommendationKindValues returns the possible values for the ReservationRecommendationKind const type.
type ReservationRecommendationsClient ¶
type ReservationRecommendationsClient struct {
// contains filtered or unexported fields
}
ReservationRecommendationsClient contains the methods for the ReservationRecommendations group. Don't use this type directly, use NewReservationRecommendationsClient() instead.
func NewReservationRecommendationsClient ¶
func NewReservationRecommendationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ReservationRecommendationsClient, error)
NewReservationRecommendationsClient creates a new instance of ReservationRecommendationsClient with the specified values.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*ReservationRecommendationsClient) NewListPager ¶ added in v0.5.0
func (client *ReservationRecommendationsClient) NewListPager(resourceScope string, options *ReservationRecommendationsClientListOptions) *runtime.Pager[ReservationRecommendationsClientListResponse]
NewListPager - List of recommendations for purchasing reserved instances.
Generated from API version 2021-10-01
- resourceScope - The scope associated with reservation recommendations operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope
- options - ReservationRecommendationsClientListOptions contains the optional parameters for the ReservationRecommendationsClient.NewListPager method.
Example (ReservationRecommendationsByBillingAccountLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationRecommendationsByBillingAccount.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewReservationRecommendationsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/123456", &armconsumption.ReservationRecommendationsClientListOptions{Filter: 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.ReservationRecommendationsListResult = armconsumption.ReservationRecommendationsListResult{ // Value: []armconsumption.ReservationRecommendationClassification{ // &armconsumption.LegacyReservationRecommendation{ // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), // Type: to.Ptr("Microsoft.Consumption/reservationRecommendations"), // ID: to.Ptr("billingAccount/123456/providers/Microsoft.Consumption/reservationRecommendations/00000000-0000-0000-0000-000000000000"), // Location: to.Ptr("westus"), // SKU: to.Ptr("Standard_DS1_v2"), // Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy), // Properties: &armconsumption.LegacySharedScopeReservationRecommendationProperties{ // CostWithNoReservedInstances: to.Ptr[float64](12.0785105), // FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-07T07:00:00.000Z"); return t}()), // InstanceFlexibilityGroup: to.Ptr("DSv2 Series"), // InstanceFlexibilityRatio: to.Ptr[float32](1), // LookBackPeriod: to.Ptr("Last7Days"), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // NetSavings: to.Ptr[float64](0.588546019225182), // NormalizedSize: to.Ptr("Standard_DS1_v2"), // RecommendedQuantity: to.Ptr[float64](1), // RecommendedQuantityNormalized: to.Ptr[float32](1), // Scope: to.Ptr("Shared"), // SKUProperties: []*armconsumption.SKUProperty{ // { // Name: to.Ptr("Cores"), // Value: to.Ptr("1"), // }, // { // Name: to.Ptr("Ram"), // Value: to.Ptr("1"), // }}, // Term: to.Ptr("P1Y"), // TotalCostWithReservedInstances: to.Ptr[float64](11.4899644807748), // }, // }, // &armconsumption.LegacyReservationRecommendation{ // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), // Type: to.Ptr("Microsoft.Consumption/reservationRecommendations"), // ID: to.Ptr("billingAccount/123456/providers/Microsoft.Consumption/reservationRecommendations/00000000-0000-0000-0000-000000000000"), // Location: to.Ptr("westus"), // SKU: to.Ptr("Standard_DS1_v2"), // Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy), // Properties: &armconsumption.LegacySharedScopeReservationRecommendationProperties{ // CostWithNoReservedInstances: to.Ptr[float64](10.0785105), // FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-07T07:00:00.000Z"); return t}()), // InstanceFlexibilityGroup: to.Ptr("DSv2 Series"), // InstanceFlexibilityRatio: to.Ptr[float32](1), // LookBackPeriod: to.Ptr("Last7Days"), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // NetSavings: to.Ptr[float64](0.68), // NormalizedSize: to.Ptr("Standard_DS1"), // RecommendedQuantity: to.Ptr[float64](1), // RecommendedQuantityNormalized: to.Ptr[float32](1.2), // Scope: to.Ptr("Shared"), // SKUProperties: []*armconsumption.SKUProperty{ // { // Name: to.Ptr("SkuDisplayName"), // Value: to.Ptr("B"), // }, // { // Name: to.Ptr("CPU"), // Value: to.Ptr("1"), // }}, // Term: to.Ptr("P1Y"), // TotalCostWithReservedInstances: to.Ptr[float64](13.48), // }, // }}, // } } }
Output:
Example (ReservationRecommendationsByBillingProfileModern) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationRecommendationsByBillingProfile.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewReservationRecommendationsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/123456/billingProfiles/6420", &armconsumption.ReservationRecommendationsClientListOptions{Filter: 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.ReservationRecommendationsListResult = armconsumption.ReservationRecommendationsListResult{ // Value: []armconsumption.ReservationRecommendationClassification{ // &armconsumption.ModernReservationRecommendation{ // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), // Type: to.Ptr("Microsoft.Consumption/reservationRecommendations"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/123456/billingProfiles/6420/providers/Microsoft.Consumption/reservationRecommendations/00000000-0000-0000-0000-000000000000"), // Location: to.Ptr("westus"), // SKU: to.Ptr("Standard_DS1_v2"), // Kind: to.Ptr(armconsumption.ReservationRecommendationKindModern), // Properties: &armconsumption.ModernReservationRecommendationProperties{ // CostWithNoReservedInstances: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](1.4749000882), // }, // FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-07T07:00:00.000Z"); return t}()), // InstanceFlexibilityGroup: to.Ptr("DSv2 Series"), // InstanceFlexibilityRatio: to.Ptr[float32](1), // LookBackPeriod: to.Ptr[int32](7), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // NetSavings: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](0.39824251795372), // }, // NormalizedSize: to.Ptr("Standard_DS1_v2"), // RecommendedQuantity: to.Ptr[float64](1), // RecommendedQuantityNormalized: to.Ptr[float32](1), // Scope: to.Ptr("Shared"), // SKUProperties: []*armconsumption.SKUProperty{ // { // Name: to.Ptr("Cores"), // Value: to.Ptr("1"), // }, // { // Name: to.Ptr("Ram"), // Value: to.Ptr("1"), // }}, // Term: to.Ptr("P1Y"), // TotalCostWithReservedInstances: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](1.07665757024628), // }, // }, // }, // &armconsumption.ModernReservationRecommendation{ // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), // Type: to.Ptr("Microsoft.Consumption/reservationRecommendations"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/123456/billingProfiles/6420/providers/Microsoft.Consumption/reservationRecommendations/00000000-0000-0000-0000-000000000000"), // Location: to.Ptr("westus"), // SKU: to.Ptr("Standard_DS1_v2"), // Kind: to.Ptr(armconsumption.ReservationRecommendationKindModern), // Properties: &armconsumption.ModernReservationRecommendationProperties{ // CostWithNoReservedInstances: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](1.4896), // }, // FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-07T07:00:00.000Z"); return t}()), // InstanceFlexibilityGroup: to.Ptr("DSv2 Series"), // InstanceFlexibilityRatio: to.Ptr[float32](1), // LookBackPeriod: to.Ptr[int32](7), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // NetSavings: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](0.40694246575372), // }, // NormalizedSize: to.Ptr("Standard_DS1"), // RecommendedQuantity: to.Ptr[float64](1), // RecommendedQuantityNormalized: to.Ptr[float32](1.2), // Scope: to.Ptr("Shared"), // SKUProperties: []*armconsumption.SKUProperty{ // { // Name: to.Ptr("SkuDisplayName"), // Value: to.Ptr("B"), // }, // { // Name: to.Ptr("CPU"), // Value: to.Ptr("1"), // }}, // Term: to.Ptr("P1Y"), // TotalCostWithReservedInstances: &armconsumption.Amount{ // Currency: to.Ptr("USD"), // Value: to.Ptr[float64](1.08265753424628), // }, // }, // }}, // } } }
Output:
Example (ReservationRecommendationsByResourceGroupLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationRecommendationsByResourceGroup.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewReservationRecommendationsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testGroup", &armconsumption.ReservationRecommendationsClientListOptions{Filter: 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.ReservationRecommendationsListResult = armconsumption.ReservationRecommendationsListResult{ // Value: []armconsumption.ReservationRecommendationClassification{ // &armconsumption.LegacyReservationRecommendation{ // Name: to.Ptr("reservationRecommendations1"), // Type: to.Ptr("Microsoft.Consumption/reservationRecommendations"), // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGrouups/testGroup/providers/Microsoft.Consumption/reservationRecommendations/reservationRecommendations1"), // Location: to.Ptr("northeurope"), // SKU: to.Ptr("Standard_DS1_v2"), // Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy), // Properties: &armconsumption.LegacySingleScopeReservationRecommendationProperties{ // CostWithNoReservedInstances: to.Ptr[float64](0), // FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-06T00:00:00.000Z"); return t}()), // LookBackPeriod: to.Ptr("Last7Days"), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // NetSavings: to.Ptr[float64](4.634521202630137), // RecommendedQuantity: to.Ptr[float64](1), // Scope: to.Ptr("Single"), // Term: to.Ptr("P1Y"), // TotalCostWithReservedInstances: to.Ptr[float64](0), // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), // }, // }, // &armconsumption.LegacyReservationRecommendation{ // Name: to.Ptr("reservationRecommendations2"), // Type: to.Ptr("Microsoft.Consumption/reservationRecommendations"), // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testGroup/providers/Microsoft.Consumption/reservationRecommendations/reservationRecommendations2"), // Location: to.Ptr("northeurope"), // SKU: to.Ptr("Standard_DS1_v2"), // Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy), // Properties: &armconsumption.LegacySingleScopeReservationRecommendationProperties{ // CostWithNoReservedInstances: to.Ptr[float64](0), // FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-06T00:00:00.000Z"); return t}()), // LookBackPeriod: to.Ptr("Last7Days"), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // NetSavings: to.Ptr[float64](7.289315723178081), // RecommendedQuantity: to.Ptr[float64](1), // Scope: to.Ptr("Single"), // Term: to.Ptr("P3Y"), // TotalCostWithReservedInstances: to.Ptr[float64](0), // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), // }, // }}, // } } }
Output:
Example (ReservationRecommendationsBySubscriptionLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationRecommendationsBySubscription.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewReservationRecommendationsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.ReservationRecommendationsClientListOptions{Filter: 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.ReservationRecommendationsListResult = armconsumption.ReservationRecommendationsListResult{ // Value: []armconsumption.ReservationRecommendationClassification{ // &armconsumption.LegacyReservationRecommendation{ // Name: to.Ptr("reservationRecommendations1"), // Type: to.Ptr("Microsoft.Consumption/reservationRecommendations"), // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationRecommendations/reservationRecommendations1"), // Location: to.Ptr("northeurope"), // SKU: to.Ptr("Standard_DS1_v2"), // Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy), // Properties: &armconsumption.LegacySingleScopeReservationRecommendationProperties{ // CostWithNoReservedInstances: to.Ptr[float64](0), // FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-06T00:00:00.000Z"); return t}()), // LookBackPeriod: to.Ptr("Last7Days"), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // NetSavings: to.Ptr[float64](4.634521202630137), // RecommendedQuantity: to.Ptr[float64](1), // Scope: to.Ptr("Single"), // Term: to.Ptr("P1Y"), // TotalCostWithReservedInstances: to.Ptr[float64](0), // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), // }, // }, // &armconsumption.LegacyReservationRecommendation{ // Name: to.Ptr("reservationRecommendations2"), // Type: to.Ptr("Microsoft.Consumption/reservationRecommendations"), // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationRecommendations/reservationRecommendations2"), // Location: to.Ptr("northeurope"), // SKU: to.Ptr("Standard_DS1_v2"), // Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy), // Properties: &armconsumption.LegacySingleScopeReservationRecommendationProperties{ // CostWithNoReservedInstances: to.Ptr[float64](0), // FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-06T00:00:00.000Z"); return t}()), // LookBackPeriod: to.Ptr("Last7Days"), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // NetSavings: to.Ptr[float64](7.289315723178081), // RecommendedQuantity: to.Ptr[float64](1), // Scope: to.Ptr("Single"), // Term: to.Ptr("P3Y"), // TotalCostWithReservedInstances: to.Ptr[float64](0), // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), // }, // }}, // } } }
Output:
Example (ReservationRecommendationsFilterBySubscriptionForScopeLookBackPeriodLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationRecommendationsFilterBySubscriptionForScopeLookBackPeriod.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewReservationRecommendationsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.ReservationRecommendationsClientListOptions{Filter: to.Ptr("properties/scope eq 'Single' AND properties/lookBackPeriod eq 'Last7Days'")}) 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.ReservationRecommendationsListResult = armconsumption.ReservationRecommendationsListResult{ // Value: []armconsumption.ReservationRecommendationClassification{ // &armconsumption.LegacyReservationRecommendation{ // Name: to.Ptr("reservationRecommendations1"), // Type: to.Ptr("Microsoft.Consumption/reservationRecommendations"), // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationRecommendations/reservationRecommendations1"), // Location: to.Ptr("northeurope"), // SKU: to.Ptr("Standard_DS1_v2"), // Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy), // Properties: &armconsumption.LegacySingleScopeReservationRecommendationProperties{ // CostWithNoReservedInstances: to.Ptr[float64](0), // FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-06T00:00:00.000Z"); return t}()), // LookBackPeriod: to.Ptr("Last7Days"), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // NetSavings: to.Ptr[float64](4.634521202630137), // RecommendedQuantity: to.Ptr[float64](1), // Scope: to.Ptr("Single"), // SKUProperties: []*armconsumption.SKUProperty{ // { // Name: to.Ptr("Cores"), // Value: to.Ptr("1"), // }, // { // Name: to.Ptr("Ram"), // Value: to.Ptr("1"), // }}, // Term: to.Ptr("P1Y"), // TotalCostWithReservedInstances: to.Ptr[float64](0), // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), // }, // }, // &armconsumption.LegacyReservationRecommendation{ // Name: to.Ptr("reservationRecommendations2"), // Type: to.Ptr("Microsoft.Consumption/reservationRecommendations"), // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationRecommendations/reservationRecommendations2"), // Location: to.Ptr("northeurope"), // SKU: to.Ptr("Standard_DS1_v2"), // Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy), // Properties: &armconsumption.LegacySingleScopeReservationRecommendationProperties{ // CostWithNoReservedInstances: to.Ptr[float64](0), // FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-06T00:00:00.000Z"); return t}()), // LookBackPeriod: to.Ptr("Last7Days"), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // NetSavings: to.Ptr[float64](7.289315723178081), // RecommendedQuantity: to.Ptr[float64](1), // Scope: to.Ptr("Single"), // SKUProperties: []*armconsumption.SKUProperty{ // { // Name: to.Ptr("SkuDisplayName"), // Value: to.Ptr("B"), // }, // { // Name: to.Ptr("CPU"), // Value: to.Ptr("1"), // }}, // Term: to.Ptr("P3Y"), // TotalCostWithReservedInstances: to.Ptr[float64](0), // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), // }, // }}, // } } }
Output:
type ReservationRecommendationsClientListOptions ¶ added in v0.3.0
type ReservationRecommendationsClientListOptions struct { // May be used to filter reservationRecommendations by: properties/scope with allowed values ['Single', 'Shared'] and default // value 'Single'; properties/resourceType with allowed values // ['VirtualMachines', 'SQLDatabases', 'PostgreSQL', 'ManagedDisk', 'MySQL', 'RedHat', 'MariaDB', 'RedisCache', 'CosmosDB', // 'SqlDataWarehouse', 'SUSELinux', 'AppService', 'BlockBlob', // 'AzureDataExplorer', 'VMwareCloudSimple'] and default value 'VirtualMachines'; and properties/lookBackPeriod with allowed // values ['Last7Days', 'Last30Days', 'Last60Days'] and default value // 'Last7Days'. Filter *string }
ReservationRecommendationsClientListOptions contains the optional parameters for the ReservationRecommendationsClient.NewListPager method.
type ReservationRecommendationsClientListResponse ¶ added in v0.3.0
type ReservationRecommendationsClientListResponse struct { // Result of listing reservation recommendations. ReservationRecommendationsListResult }
ReservationRecommendationsClientListResponse contains the response from method ReservationRecommendationsClient.NewListPager.
type ReservationRecommendationsListResult ¶
type ReservationRecommendationsListResult struct { // READ-ONLY; The link (url) to the next page of results. NextLink *string // READ-ONLY; The link (url) to the previous page of results. PreviousLink *string // READ-ONLY; The list of reservation recommendations. Value []ReservationRecommendationClassification }
ReservationRecommendationsListResult - Result of listing reservation recommendations.
func (ReservationRecommendationsListResult) MarshalJSON ¶
func (r ReservationRecommendationsListResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ReservationRecommendationsListResult.
func (*ReservationRecommendationsListResult) UnmarshalJSON ¶
func (r *ReservationRecommendationsListResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ReservationRecommendationsListResult.
type ReservationSummariesListResult ¶
type ReservationSummariesListResult struct { // READ-ONLY; The link (url) to the next page of results. NextLink *string // READ-ONLY; The list of reservation summaries. Value []*ReservationSummary }
ReservationSummariesListResult - Result of listing reservation summaries.
func (ReservationSummariesListResult) MarshalJSON ¶
func (r ReservationSummariesListResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ReservationSummariesListResult.
func (*ReservationSummariesListResult) UnmarshalJSON ¶ added in v1.1.0
func (r *ReservationSummariesListResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ReservationSummariesListResult.
type ReservationSummary ¶
type ReservationSummary struct { // The properties of the reservation summary. Properties *ReservationSummaryProperties // READ-ONLY; The etag for the resource. Etag *string // READ-ONLY; The full qualified ARM ID of an event. ID *string // READ-ONLY; The ID that uniquely identifies an event. Name *string // READ-ONLY; Resource tags. Tags map[string]*string // READ-ONLY; Resource type. Type *string }
ReservationSummary - reservation summary resource.
func (ReservationSummary) MarshalJSON ¶
func (r ReservationSummary) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ReservationSummary.
func (*ReservationSummary) UnmarshalJSON ¶
func (r *ReservationSummary) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ReservationSummary.
type ReservationSummaryProperties ¶
type ReservationSummaryProperties struct { // READ-ONLY; This is average utilization for the entire time range. (day or month depending on the grain) AvgUtilizationPercentage *float64 // READ-ONLY; The reservation kind. Kind *string // READ-ONLY; This is the maximum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to // 12/10/2017 and on that for hour 4 and 5, utilization was 100%, this field will return 100% // for that day. MaxUtilizationPercentage *float64 // READ-ONLY; This is the minimum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to // 12/10/2017 and on that for hour 4 and 5, utilization was 10%, this field will return 10% // for that day MinUtilizationPercentage *float64 // READ-ONLY; This is the purchased quantity for the reservationId. PurchasedQuantity *float64 // READ-ONLY; This is the remaining quantity for the reservationId. RemainingQuantity *float64 // READ-ONLY; The reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping // for applying the benefit scope and also specifies the number of instances to which // the reservation benefit can be applied to. ReservationID *string // READ-ONLY; The reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents // a single purchase transaction. A reservation order contains reservations. The reservation // order specifies the VM size and region for the reservations. ReservationOrderID *string // READ-ONLY; This is the total hours reserved. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours // for that day and 24 hours from subsequent days ReservedHours *float64 // READ-ONLY; This is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. SKUName *string // READ-ONLY; This is the total count of instances that are reserved for the reservationId. TotalReservedQuantity *float64 // READ-ONLY; Data corresponding to the utilization record. If the grain of data is monthly, it will be first day of month. UsageDate *time.Time // READ-ONLY; Total used hours by the reservation UsedHours *float64 // READ-ONLY; This is the used quantity for the reservationId. UsedQuantity *float64 // READ-ONLY; This is the utilized percentage for the reservation Id. UtilizedPercentage *float64 }
ReservationSummaryProperties - The properties of the reservation summary.
func (ReservationSummaryProperties) MarshalJSON ¶
func (r ReservationSummaryProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ReservationSummaryProperties.
func (*ReservationSummaryProperties) UnmarshalJSON ¶
func (r *ReservationSummaryProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ReservationSummaryProperties.
type ReservationTransaction ¶
type ReservationTransaction struct { // The properties of a legacy reservation transaction. Properties *LegacyReservationTransactionProperties // READ-ONLY; Resource Id. ID *string // READ-ONLY; Resource name. Name *string // READ-ONLY; Resource tags. Tags []*string // READ-ONLY; Resource type. Type *string }
ReservationTransaction - Reservation transaction resource.
func (ReservationTransaction) MarshalJSON ¶
func (r ReservationTransaction) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ReservationTransaction.
func (*ReservationTransaction) UnmarshalJSON ¶ added in v1.1.0
func (r *ReservationTransaction) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ReservationTransaction.
type ReservationTransactionResource ¶
type ReservationTransactionResource struct { // READ-ONLY; Resource Id. ID *string // READ-ONLY; Resource name. Name *string // READ-ONLY; Resource tags. Tags []*string // READ-ONLY; Resource type. Type *string }
ReservationTransactionResource - The Resource model definition.
func (ReservationTransactionResource) MarshalJSON ¶
func (r ReservationTransactionResource) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ReservationTransactionResource.
func (*ReservationTransactionResource) UnmarshalJSON ¶ added in v1.1.0
func (r *ReservationTransactionResource) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ReservationTransactionResource.
type ReservationTransactionsClient ¶
type ReservationTransactionsClient struct {
// contains filtered or unexported fields
}
ReservationTransactionsClient contains the methods for the ReservationTransactions group. Don't use this type directly, use NewReservationTransactionsClient() instead.
func NewReservationTransactionsClient ¶
func NewReservationTransactionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ReservationTransactionsClient, error)
NewReservationTransactionsClient creates a new instance of ReservationTransactionsClient with the specified values.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*ReservationTransactionsClient) NewListByBillingProfilePager ¶ added in v0.5.0
func (client *ReservationTransactionsClient) NewListByBillingProfilePager(billingAccountID string, billingProfileID string, options *ReservationTransactionsClientListByBillingProfileOptions) *runtime.Pager[ReservationTransactionsClientListByBillingProfileResponse]
NewListByBillingProfilePager - List of transactions for reserved instances on billing account scope
Generated from API version 2021-10-01
- billingAccountID - BillingAccount ID
- billingProfileID - Azure Billing Profile ID.
- options - ReservationTransactionsClientListByBillingProfileOptions contains the optional parameters for the ReservationTransactionsClient.NewListByBillingProfilePager method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationTransactionsListByBillingProfileId.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewReservationTransactionsClient().NewListByBillingProfilePager("fcebaabc-fced-4284-a83d-79f83dee183c:45796ba8-988f-45ad-bea9-7b71fc6c7513_2018-09-30", "Z76D-SGAF-BG7-TGB", &armconsumption.ReservationTransactionsClientListByBillingProfileOptions{Filter: to.Ptr("properties/eventDate+ge+2020-05-20+AND+properties/eventDate+le+2020-05-30")}) 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.ModernReservationTransactionsListResult = armconsumption.ModernReservationTransactionsListResult{ // Value: []*armconsumption.ModernReservationTransaction{ // { // Name: to.Ptr("a838a8c3-a408-49e1-ac90-42cb95bff9b2"), // Type: to.Ptr("Microsoft.Consumption/reservationTransactions"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/fcebaabc-fced-4284-a83d-79f83dee183c:45796ba8-988f-45ad-bea9-7b71fc6c7513_2018-09-30/billingProfiles/Z76D-SGAF-BG7-TGB/providers/Microsoft.Consumption/reservationTransactions"), // Properties: &armconsumption.ModernReservationTransactionProperties{ // Description: to.Ptr("Reserved VM Instance, Standard_B1ls, US East, 3 Years"), // Amount: to.Ptr[float64](1.44), // ArmSKUName: to.Ptr("Standard_B1ls"), // BillingFrequency: to.Ptr("Recurring"), // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/fcebaabc-fced-4284-a83d-79f83dee183c:45796ba8-988f-45ad-bea9-7b71fc6c7513_2018-09-30/billingProfiles/Z76D-SGAF-BG7-TGB"), // BillingProfileName: to.Ptr("IT Department*"), // Currency: to.Ptr("USD"), // EventDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-25T21:21:38.000Z"); return t}()), // EventType: to.Ptr("Purchase"), // Invoice: to.Ptr("T000456437"), // InvoiceID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/fcebaabc-fced-4284-a83d-79f83dee183c:45796ba8-988f-45ad-bea9-7b71fc6c7513_2018-09-30/billingProfiles/Z76D-SGAF-BG7-TGB/invoices/T000456437"), // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/fcebaabc-fced-4284-a83d-79f83dee183c:45796ba8-988f-45ad-bea9-7b71fc6c7513_2018-09-30/invoiceSections/QBTB-EYAK-PJA-TGB"), // InvoiceSectionName: to.Ptr("IT Department"), // PurchasingSubscriptionGUID: to.Ptr("d924ad15-4a3d-4047-971d-c8b1b300a97b"), // PurchasingSubscriptionName: to.Ptr("contoso"), // Quantity: to.Ptr[float64](1), // Region: to.Ptr("eastus"), // ReservationOrderID: to.Ptr("a838a8c3-a408-49e1-ac90-42cb95bff9b2"), // ReservationOrderName: to.Ptr("VM_RI_03-25-2020_14-18"), // Term: to.Ptr("P3Y"), // }, // }}, // } } }
Output:
func (*ReservationTransactionsClient) NewListPager ¶ added in v0.5.0
func (client *ReservationTransactionsClient) NewListPager(billingAccountID string, options *ReservationTransactionsClientListOptions) *runtime.Pager[ReservationTransactionsClientListResponse]
NewListPager - List of transactions for reserved instances on billing account scope
Generated from API version 2021-10-01
- billingAccountID - BillingAccount ID
- options - ReservationTransactionsClientListOptions contains the optional parameters for the ReservationTransactionsClient.NewListPager method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationTransactionsListByEnrollmentNumber.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewReservationTransactionsClient().NewListPager("123456", &armconsumption.ReservationTransactionsClientListOptions{Filter: to.Ptr("properties/eventDate+ge+2020-05-20+AND+properties/eventDate+le+2020-05-30")}) 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.ReservationTransactionsListResult = armconsumption.ReservationTransactionsListResult{ // Value: []*armconsumption.ReservationTransaction{ // { // Name: to.Ptr("201909091919"), // Type: to.Ptr("Microsoft.Consumption/reservationTransactions"), // ID: to.Ptr("/billingAccounts/123456/providers/Microsoft.Consumption/reservationtransactions/201909091919"), // Tags: []*string{ // }, // Properties: &armconsumption.LegacyReservationTransactionProperties{ // Description: to.Ptr("Standard_DS1_v2 westus 1 Year"), // AccountName: to.Ptr("Microsoft Infrastructure"), // AccountOwnerEmail: to.Ptr("admin@microsoft.com"), // Amount: to.Ptr[float64](-21), // ArmSKUName: to.Ptr("Standard_DS1_v2"), // BillingFrequency: to.Ptr("recurring"), // BillingMonth: to.Ptr[int32](20190901), // CostCenter: to.Ptr(""), // Currency: to.Ptr("USD"), // CurrentEnrollment: to.Ptr("123456"), // DepartmentName: to.Ptr("Unassigned"), // EventDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-09T19:19:04.000Z"); return t}()), // EventType: to.Ptr("Refund"), // MonetaryCommitment: to.Ptr[float64](523123.9), // Overage: to.Ptr[float64](23234.49), // PurchasingEnrollment: to.Ptr("123456"), // PurchasingSubscriptionGUID: to.Ptr("a838a8c3-a408-49e1-ac90-42cb95bff9b2"), // PurchasingSubscriptionName: to.Ptr("Infrastructure Subscription"), // Quantity: to.Ptr[float64](1), // Region: to.Ptr("westus"), // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservationOrderName: to.Ptr("Transaction-DS1_v2"), // Term: to.Ptr("P1Y"), // }, // }, // { // Name: to.Ptr("201909091919"), // Type: to.Ptr("Microsoft.Consumption/reservationTransactions"), // ID: to.Ptr("/billingAccounts/123456/providers/Microsoft.Consumption/reservationtransactions/201909091919"), // Tags: []*string{ // }, // Properties: &armconsumption.LegacyReservationTransactionProperties{ // Description: to.Ptr("Standard_DS1_v2 westus 1 Year"), // AccountName: to.Ptr("Microsoft Infrastructure"), // AccountOwnerEmail: to.Ptr("admin@microsoft.com"), // Amount: to.Ptr[float64](21), // ArmSKUName: to.Ptr("Standard_DS1_v2"), // BillingFrequency: to.Ptr("recurring"), // BillingMonth: to.Ptr[int32](20190901), // CostCenter: to.Ptr(""), // Currency: to.Ptr("USD"), // CurrentEnrollment: to.Ptr("123456"), // DepartmentName: to.Ptr("Unassigned"), // EventDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-09T19:19:04.000Z"); return t}()), // EventType: to.Ptr("Purchase"), // MonetaryCommitment: to.Ptr[float64](523123.9), // Overage: to.Ptr[float64](23234.49), // PurchasingEnrollment: to.Ptr("123456"), // PurchasingSubscriptionGUID: to.Ptr("a838a8c3-a408-49e1-ac90-42cb95bff9b2"), // PurchasingSubscriptionName: to.Ptr("Infrastructure Subscription"), // Quantity: to.Ptr[float64](1), // Region: to.Ptr("westus"), // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservationOrderName: to.Ptr("Transaction-DS1_v2"), // Term: to.Ptr("P1Y"), // }, // }}, // } } }
Output:
type ReservationTransactionsClientListByBillingProfileOptions ¶ added in v0.3.0
type ReservationTransactionsClientListByBillingProfileOptions struct { // Filter reservation transactions by date range. The properties/EventDate for start date and end date. The filter supports // 'le' and 'ge' Filter *string }
ReservationTransactionsClientListByBillingProfileOptions contains the optional parameters for the ReservationTransactionsClient.NewListByBillingProfilePager method.
type ReservationTransactionsClientListByBillingProfileResponse ¶ added in v0.3.0
type ReservationTransactionsClientListByBillingProfileResponse struct { // Result of listing reservation recommendations. ModernReservationTransactionsListResult }
ReservationTransactionsClientListByBillingProfileResponse contains the response from method ReservationTransactionsClient.NewListByBillingProfilePager.
type ReservationTransactionsClientListOptions ¶ added in v0.3.0
type ReservationTransactionsClientListOptions struct { // Filter reservation transactions by date range. The properties/EventDate for start date and end date. The filter supports // 'le' and 'ge' Filter *string }
ReservationTransactionsClientListOptions contains the optional parameters for the ReservationTransactionsClient.NewListPager method.
type ReservationTransactionsClientListResponse ¶ added in v0.3.0
type ReservationTransactionsClientListResponse struct { // Result of listing reservation recommendations. ReservationTransactionsListResult }
ReservationTransactionsClientListResponse contains the response from method ReservationTransactionsClient.NewListPager.
type ReservationTransactionsListResult ¶
type ReservationTransactionsListResult struct { // READ-ONLY; The link (url) to the next page of results. NextLink *string // READ-ONLY; The list of reservation recommendations. Value []*ReservationTransaction }
ReservationTransactionsListResult - Result of listing reservation recommendations.
func (ReservationTransactionsListResult) MarshalJSON ¶
func (r ReservationTransactionsListResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ReservationTransactionsListResult.
func (*ReservationTransactionsListResult) UnmarshalJSON ¶ added in v1.1.0
func (r *ReservationTransactionsListResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ReservationTransactionsListResult.
type ReservationsDetailsClient ¶
type ReservationsDetailsClient struct {
// contains filtered or unexported fields
}
ReservationsDetailsClient contains the methods for the ReservationsDetails group. Don't use this type directly, use NewReservationsDetailsClient() instead.
func NewReservationsDetailsClient ¶
func NewReservationsDetailsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ReservationsDetailsClient, error)
NewReservationsDetailsClient creates a new instance of ReservationsDetailsClient with the specified values.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*ReservationsDetailsClient) NewListByReservationOrderAndReservationPager ¶ added in v0.5.0
func (client *ReservationsDetailsClient) NewListByReservationOrderAndReservationPager(reservationOrderID string, reservationID string, filter string, options *ReservationsDetailsClientListByReservationOrderAndReservationOptions) *runtime.Pager[ReservationsDetailsClientListByReservationOrderAndReservationResponse]
NewListByReservationOrderAndReservationPager - Lists the reservations details for provided date range.
Generated from API version 2021-10-01
- reservationOrderID - Order Id of the reservation
- reservationID - Id of the reservation
- filter - Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge'
- options - ReservationsDetailsClientListByReservationOrderAndReservationOptions contains the optional parameters for the ReservationsDetailsClient.NewListByReservationOrderAndReservationPager method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationDetailsWithReservationId.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewReservationsDetailsClient().NewListByReservationOrderAndReservationPager("00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000000", "properties/usageDate ge 2017-10-01 AND properties/usageDate le 2017-12-05", 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.ReservationDetailsListResult = armconsumption.ReservationDetailsListResult{ // Value: []*armconsumption.ReservationDetail{ // { // Name: to.Ptr("00000000-0000-0000-0000-000000000000_00000000-0000-0000-0000-000000000000_20171129"), // Type: to.Ptr("Microsoft.Consumption/reservationDetails"), // ID: to.Ptr("providers/Microsoft.Capacity/reservationOrders/00000000-0000-0000-0000-000000000000/reservations/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationDetails/20171129"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Properties: &armconsumption.ReservationDetailProperties{ // InstanceFlexibilityGroup: to.Ptr("D2v2 Series"), // InstanceFlexibilityRatio: to.Ptr("1"), // InstanceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/wvn-sql/providers/microsoft.compute/virtualmachines/wvn-sql2014sp33"), // Kind: to.Ptr("Reservation"), // ReservationID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservedHours: to.Ptr[float64](24), // SKUName: to.Ptr("Standard_D2_v2"), // TotalReservedQuantity: to.Ptr[float64](1), // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-29T00:00:00.000Z"); return t}()), // UsedHours: to.Ptr[float64](24), // }, // }}, // } } }
Output:
func (*ReservationsDetailsClient) NewListByReservationOrderPager ¶ added in v0.5.0
func (client *ReservationsDetailsClient) NewListByReservationOrderPager(reservationOrderID string, filter string, options *ReservationsDetailsClientListByReservationOrderOptions) *runtime.Pager[ReservationsDetailsClientListByReservationOrderResponse]
NewListByReservationOrderPager - Lists the reservations details for provided date range.
Generated from API version 2021-10-01
- reservationOrderID - Order Id of the reservation
- filter - Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge'
- options - ReservationsDetailsClientListByReservationOrderOptions contains the optional parameters for the ReservationsDetailsClient.NewListByReservationOrderPager method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationDetails.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewReservationsDetailsClient().NewListByReservationOrderPager("00000000-0000-0000-0000-000000000000", "properties/usageDate ge 2017-10-01 AND properties/usageDate le 2017-12-05", 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.ReservationDetailsListResult = armconsumption.ReservationDetailsListResult{ // Value: []*armconsumption.ReservationDetail{ // { // Name: to.Ptr("00000000-0000-0000-0000-000000000000_00000000-0000-0000-0000-000000000000_20171129"), // Type: to.Ptr("Microsoft.Consumption/reservationDetails"), // ID: to.Ptr("providers/Microsoft.Capacity/reservationOrders/00000000-0000-0000-0000-000000000000/reservations/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationDetails/20171129"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Properties: &armconsumption.ReservationDetailProperties{ // InstanceFlexibilityGroup: to.Ptr("DSv2 Series"), // InstanceFlexibilityRatio: to.Ptr("0.25"), // InstanceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/wvn-sql/providers/microsoft.compute/virtualmachines/abc-sql2014sp33"), // ReservationID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservedHours: to.Ptr[float64](24), // SKUName: to.Ptr("Standard_D2_v2"), // TotalReservedQuantity: to.Ptr[float64](1), // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-29T00:00:00.000Z"); return t}()), // UsedHours: to.Ptr[float64](24), // }, // }}, // } } }
Output:
func (*ReservationsDetailsClient) NewListPager ¶ added in v0.5.0
func (client *ReservationsDetailsClient) NewListPager(resourceScope string, options *ReservationsDetailsClientListOptions) *runtime.Pager[ReservationsDetailsClientListResponse]
NewListPager - Lists the reservations details for the defined scope and provided date range.
Generated from API version 2021-10-01
- resourceScope - The scope associated with reservations details operations. This includes '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope (modern).
- options - ReservationsDetailsClientListOptions contains the optional parameters for the ReservationsDetailsClient.NewListPager method.
Example (ReservationDetailsByBillingAccountId) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationDetailsByBillingAccountId.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewReservationsDetailsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345", &armconsumption.ReservationsDetailsClientListOptions{StartDate: nil, EndDate: nil, Filter: to.Ptr("properties/usageDate ge 2017-10-01 AND properties/usageDate le 2017-12-05"), ReservationID: nil, ReservationOrderID: 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.ReservationDetailsListResult = armconsumption.ReservationDetailsListResult{ // Value: []*armconsumption.ReservationDetail{ // { // Name: to.Ptr("reservationDetails_Id1"), // Type: to.Ptr("Microsoft.Consumption/reservationDetails"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345/providers/Microsoft.Consumption/reservationDetails/reservationDetails_Id1"), // Properties: &armconsumption.ReservationDetailProperties{ // InstanceFlexibilityGroup: to.Ptr("DSv3 Series"), // InstanceFlexibilityRatio: to.Ptr("1"), // InstanceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sqlh1/providers/microsoft.compute/virtualmachines/sqlh1"), // ReservationID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservedHours: to.Ptr[float64](48), // SKUName: to.Ptr("Standard_D2s_v3"), // TotalReservedQuantity: to.Ptr[float64](0), // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-30T08:00:00.000Z"); return t}()), // UsedHours: to.Ptr[float64](0.6), // }, // }}, // } } }
Output:
Example (ReservationDetailsByBillingProfileId) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationDetailsByBillingProfileId.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewReservationsDetailsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:2468/billingProfiles/13579", &armconsumption.ReservationsDetailsClientListOptions{StartDate: to.Ptr("2019-09-01"), EndDate: to.Ptr("2019-10-31"), Filter: nil, ReservationID: nil, ReservationOrderID: 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.ReservationDetailsListResult = armconsumption.ReservationDetailsListResult{ // Value: []*armconsumption.ReservationDetail{ // { // Name: to.Ptr("reservationDetails_Id1"), // Type: to.Ptr("Microsoft.Consumption/reservationDetails"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345:2468/billingProfiles/13579/providers/Microsoft.Consumption/reservationDetails/reservationDetails_Id1"), // Properties: &armconsumption.ReservationDetailProperties{ // InstanceFlexibilityGroup: to.Ptr("DSv3 Series"), // InstanceFlexibilityRatio: to.Ptr("1"), // InstanceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sqlh1/providers/microsoft.compute/virtualmachines/sqlh1"), // ReservationID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservedHours: to.Ptr[float64](48), // SKUName: to.Ptr("Standard_D2s_v3"), // TotalReservedQuantity: to.Ptr[float64](0), // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-30T08:00:00.000Z"); return t}()), // UsedHours: to.Ptr[float64](0.6), // }, // }}, // } } }
Output:
Example (ReservationDetailsByBillingProfileIdReservationId) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationDetailsByBillingProfileIdReservationId.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewReservationsDetailsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:2468/billingProfiles/13579", &armconsumption.ReservationsDetailsClientListOptions{StartDate: to.Ptr("2019-09-01"), EndDate: to.Ptr("2019-10-31"), Filter: nil, ReservationID: to.Ptr("1c6b6358-709f-484c-85f1-72e862a0cf3b"), ReservationOrderID: to.Ptr("9f39ba10-794f-4dcb-8f4b-8d0cb47c27dc"), }) 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.ReservationDetailsListResult = armconsumption.ReservationDetailsListResult{ // Value: []*armconsumption.ReservationDetail{ // { // Name: to.Ptr("reservationDetails_Id1"), // Type: to.Ptr("Microsoft.Consumption/reservationDetails"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345:2468/billingProfiles/13579/providers/Microsoft.Consumption/reservationDetails/reservationDetails_Id1"), // Properties: &armconsumption.ReservationDetailProperties{ // InstanceFlexibilityGroup: to.Ptr("DSv3 Series"), // InstanceFlexibilityRatio: to.Ptr("1"), // InstanceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sqlh1/providers/microsoft.compute/virtualmachines/sqlh1"), // ReservationID: to.Ptr("1c6b6358-709f-484c-85f1-72e862a0cf3b"), // ReservationOrderID: to.Ptr("9f39ba10-794f-4dcb-8f4b-8d0cb47c27dc"), // ReservedHours: to.Ptr[float64](48), // SKUName: to.Ptr("Standard_D2s_v3"), // TotalReservedQuantity: to.Ptr[float64](0), // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-30T08:00:00.000Z"); return t}()), // UsedHours: to.Ptr[float64](0.6), // }, // }}, // } } }
Output:
type ReservationsDetailsClientListByReservationOrderAndReservationOptions ¶ added in v0.3.0
type ReservationsDetailsClientListByReservationOrderAndReservationOptions struct { }
ReservationsDetailsClientListByReservationOrderAndReservationOptions contains the optional parameters for the ReservationsDetailsClient.NewListByReservationOrderAndReservationPager method.
type ReservationsDetailsClientListByReservationOrderAndReservationResponse ¶ added in v0.3.0
type ReservationsDetailsClientListByReservationOrderAndReservationResponse struct { // Result of listing reservation details. ReservationDetailsListResult }
ReservationsDetailsClientListByReservationOrderAndReservationResponse contains the response from method ReservationsDetailsClient.NewListByReservationOrderAndReservationPager.
type ReservationsDetailsClientListByReservationOrderOptions ¶ added in v0.3.0
type ReservationsDetailsClientListByReservationOrderOptions struct { }
ReservationsDetailsClientListByReservationOrderOptions contains the optional parameters for the ReservationsDetailsClient.NewListByReservationOrderPager method.
type ReservationsDetailsClientListByReservationOrderResponse ¶ added in v0.3.0
type ReservationsDetailsClientListByReservationOrderResponse struct { // Result of listing reservation details. ReservationDetailsListResult }
ReservationsDetailsClientListByReservationOrderResponse contains the response from method ReservationsDetailsClient.NewListByReservationOrderPager.
type ReservationsDetailsClientListOptions ¶ added in v0.3.0
type ReservationsDetailsClientListOptions struct { // End date. Only applicable when querying with billing profile EndDate *string // Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' // and 'ge'. Not applicable when querying with billing profile Filter *string // Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific reservation ReservationID *string // Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific reservation order ReservationOrderID *string // Start date. Only applicable when querying with billing profile StartDate *string }
ReservationsDetailsClientListOptions contains the optional parameters for the ReservationsDetailsClient.NewListPager method.
type ReservationsDetailsClientListResponse ¶ added in v0.3.0
type ReservationsDetailsClientListResponse struct { // Result of listing reservation details. ReservationDetailsListResult }
ReservationsDetailsClientListResponse contains the response from method ReservationsDetailsClient.NewListPager.
type ReservationsSummariesClient ¶
type ReservationsSummariesClient struct {
// contains filtered or unexported fields
}
ReservationsSummariesClient contains the methods for the ReservationsSummaries group. Don't use this type directly, use NewReservationsSummariesClient() instead.
func NewReservationsSummariesClient ¶
func NewReservationsSummariesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ReservationsSummariesClient, error)
NewReservationsSummariesClient creates a new instance of ReservationsSummariesClient with the specified values.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*ReservationsSummariesClient) NewListByReservationOrderAndReservationPager ¶ added in v0.5.0
func (client *ReservationsSummariesClient) NewListByReservationOrderAndReservationPager(reservationOrderID string, reservationID string, grain Datagrain, options *ReservationsSummariesClientListByReservationOrderAndReservationOptions) *runtime.Pager[ReservationsSummariesClientListByReservationOrderAndReservationResponse]
NewListByReservationOrderAndReservationPager - Lists the reservations summaries for daily or monthly grain.
Generated from API version 2021-10-01
- reservationOrderID - Order Id of the reservation
- reservationID - Id of the reservation
- grain - Can be daily or monthly
- options - ReservationsSummariesClientListByReservationOrderAndReservationOptions contains the optional parameters for the ReservationsSummariesClient.NewListByReservationOrderAndReservationPager method.
Example (ReservationSummariesDailyWithReservationId) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationSummariesDailyWithReservationId.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewReservationsSummariesClient().NewListByReservationOrderAndReservationPager("00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000000", armconsumption.DatagrainDailyGrain, &armconsumption.ReservationsSummariesClientListByReservationOrderAndReservationOptions{Filter: to.Ptr("properties/usageDate ge 2017-10-01 AND properties/usageDate le 2017-11-20")}) 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.ReservationSummariesListResult = armconsumption.ReservationSummariesListResult{ // Value: []*armconsumption.ReservationSummary{ // { // Name: to.Ptr("00000000-0000-0000-0000-000000000000_00000000-0000-0000-0000-000000000000_20171001"), // Type: to.Ptr("Microsoft.Consumption/reservationSummaries"), // ID: to.Ptr("providers/Microsoft.Capacity/reservationOrders/00000000-0000-0000-0000-000000000000/reservations/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationSummaries/20171001"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Properties: &armconsumption.ReservationSummaryProperties{ // AvgUtilizationPercentage: to.Ptr[float64](0), // Kind: to.Ptr("Reservation"), // MaxUtilizationPercentage: to.Ptr[float64](0), // MinUtilizationPercentage: to.Ptr[float64](0), // PurchasedQuantity: to.Ptr[float64](0), // RemainingQuantity: to.Ptr[float64](0), // ReservationID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservedHours: to.Ptr[float64](0), // SKUName: to.Ptr("Standard_D8s_v3"), // TotalReservedQuantity: to.Ptr[float64](155), // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-01T00:00:00.000Z"); return t}()), // UsedHours: to.Ptr[float64](0), // UsedQuantity: to.Ptr[float64](0), // UtilizedPercentage: to.Ptr[float64](0), // }, // }}, // } } }
Output:
Example (ReservationSummariesMonthlyWithReservationId) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationSummariesMonthlyWithReservationId.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewReservationsSummariesClient().NewListByReservationOrderAndReservationPager("00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000000", armconsumption.DatagrainMonthlyGrain, &armconsumption.ReservationsSummariesClientListByReservationOrderAndReservationOptions{Filter: 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.ReservationSummariesListResult = armconsumption.ReservationSummariesListResult{ // Value: []*armconsumption.ReservationSummary{ // { // Name: to.Ptr("00000000-0000-0000-0000-000000000000_00000000-0000-0000-0000-000000000000_20171001"), // Type: to.Ptr("Microsoft.Consumption/reservationSummaries"), // ID: to.Ptr("providers/Microsoft.Capacity/reservationOrders/00000000-0000-0000-0000-000000000000/reservations/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationSummaries/20171001"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Properties: &armconsumption.ReservationSummaryProperties{ // AvgUtilizationPercentage: to.Ptr[float64](0), // Kind: to.Ptr("Reservation"), // MaxUtilizationPercentage: to.Ptr[float64](0), // MinUtilizationPercentage: to.Ptr[float64](0), // PurchasedQuantity: to.Ptr[float64](0), // RemainingQuantity: to.Ptr[float64](0), // ReservationID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservedHours: to.Ptr[float64](0), // SKUName: to.Ptr("Standard_D8s_v3"), // TotalReservedQuantity: to.Ptr[float64](155), // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-01T00:00:00.000Z"); return t}()), // UsedHours: to.Ptr[float64](0), // UsedQuantity: to.Ptr[float64](0), // UtilizedPercentage: to.Ptr[float64](0), // }, // }}, // } } }
Output:
func (*ReservationsSummariesClient) NewListByReservationOrderPager ¶ added in v0.5.0
func (client *ReservationsSummariesClient) NewListByReservationOrderPager(reservationOrderID string, grain Datagrain, options *ReservationsSummariesClientListByReservationOrderOptions) *runtime.Pager[ReservationsSummariesClientListByReservationOrderResponse]
NewListByReservationOrderPager - Lists the reservations summaries for daily or monthly grain.
Generated from API version 2021-10-01
- reservationOrderID - Order Id of the reservation
- grain - Can be daily or monthly
- options - ReservationsSummariesClientListByReservationOrderOptions contains the optional parameters for the ReservationsSummariesClient.NewListByReservationOrderPager method.
Example (ReservationSummariesDaily) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationSummariesDaily.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewReservationsSummariesClient().NewListByReservationOrderPager("00000000-0000-0000-0000-000000000000", armconsumption.DatagrainDailyGrain, &armconsumption.ReservationsSummariesClientListByReservationOrderOptions{Filter: to.Ptr("properties/usageDate ge 2017-10-01 AND properties/usageDate le 2017-11-20")}) 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.ReservationSummariesListResult = armconsumption.ReservationSummariesListResult{ // Value: []*armconsumption.ReservationSummary{ // { // Name: to.Ptr("00000000-0000-0000-0000-000000000000_00000000-0000-0000-0000-000000000000_20171001"), // Type: to.Ptr("Microsoft.Consumption/reservationSummaries"), // ID: to.Ptr("providers/Microsoft.Capacity/reservationOrders/00000000-0000-0000-0000-000000000000/reservations/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationSummaries/20171001"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Properties: &armconsumption.ReservationSummaryProperties{ // AvgUtilizationPercentage: to.Ptr[float64](0), // Kind: to.Ptr("Reservation"), // MaxUtilizationPercentage: to.Ptr[float64](0), // MinUtilizationPercentage: to.Ptr[float64](0), // PurchasedQuantity: to.Ptr[float64](0), // RemainingQuantity: to.Ptr[float64](0), // ReservationID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservedHours: to.Ptr[float64](0), // SKUName: to.Ptr("Standard_D8s_v3"), // TotalReservedQuantity: to.Ptr[float64](155), // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-01T00:00:00.000Z"); return t}()), // UsedHours: to.Ptr[float64](0), // UsedQuantity: to.Ptr[float64](0), // UtilizedPercentage: to.Ptr[float64](0), // }, // }}, // } } }
Output:
Example (ReservationSummariesMonthly) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationSummariesMonthly.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewReservationsSummariesClient().NewListByReservationOrderPager("00000000-0000-0000-0000-000000000000", armconsumption.DatagrainMonthlyGrain, &armconsumption.ReservationsSummariesClientListByReservationOrderOptions{Filter: 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.ReservationSummariesListResult = armconsumption.ReservationSummariesListResult{ // Value: []*armconsumption.ReservationSummary{ // { // Name: to.Ptr("00000000-0000-0000-0000-000000000000_00000000-0000-0000-0000-000000000000_20171001"), // Type: to.Ptr("Microsoft.Consumption/reservationSummaries"), // ID: to.Ptr("providers/Microsoft.Capacity/reservationOrders/00000000-0000-0000-0000-000000000000/reservations/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationSummaries/20171001"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Properties: &armconsumption.ReservationSummaryProperties{ // AvgUtilizationPercentage: to.Ptr[float64](0), // Kind: to.Ptr("Reservation"), // MaxUtilizationPercentage: to.Ptr[float64](0), // MinUtilizationPercentage: to.Ptr[float64](0), // PurchasedQuantity: to.Ptr[float64](0), // RemainingQuantity: to.Ptr[float64](0), // ReservationID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservedHours: to.Ptr[float64](0), // SKUName: to.Ptr("Standard_D8s_v3"), // TotalReservedQuantity: to.Ptr[float64](155), // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-01T00:00:00.000Z"); return t}()), // UsedHours: to.Ptr[float64](0), // UsedQuantity: to.Ptr[float64](0), // UtilizedPercentage: to.Ptr[float64](0), // }, // }}, // } } }
Output:
func (*ReservationsSummariesClient) NewListPager ¶ added in v0.5.0
func (client *ReservationsSummariesClient) NewListPager(resourceScope string, grain Datagrain, options *ReservationsSummariesClientListOptions) *runtime.Pager[ReservationsSummariesClientListResponse]
NewListPager - Lists the reservations summaries for the defined scope daily or monthly grain.
Generated from API version 2021-10-01
- resourceScope - The scope associated with reservations summaries operations. This includes '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope (modern).
- grain - Can be daily or monthly
- options - ReservationsSummariesClientListOptions contains the optional parameters for the ReservationsSummariesClient.NewListPager method.
Example (ReservationSummariesDailyWithBillingAccountId) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationSummariesDailyWithBillingAccountId.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewReservationsSummariesClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345", armconsumption.DatagrainDailyGrain, &armconsumption.ReservationsSummariesClientListOptions{StartDate: nil, EndDate: nil, Filter: to.Ptr("properties/usageDate ge 2017-10-01 AND properties/usageDate le 2017-11-20"), ReservationID: nil, ReservationOrderID: 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.ReservationSummariesListResult = armconsumption.ReservationSummariesListResult{ // Value: []*armconsumption.ReservationSummary{ // { // Name: to.Ptr("reservationSummaries_Id1"), // Type: to.Ptr("Microsoft.Consumption/reservationSummaries"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345/providers/Microsoft.Consumption/reservationSummaries/reservationSummaries_Id1"), // Properties: &armconsumption.ReservationSummaryProperties{ // AvgUtilizationPercentage: to.Ptr[float64](0), // MaxUtilizationPercentage: to.Ptr[float64](0), // MinUtilizationPercentage: to.Ptr[float64](0), // ReservationID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservedHours: to.Ptr[float64](720), // SKUName: to.Ptr("Standard_B1s"), // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-01T07:00:00.000Z"); return t}()), // UsedHours: to.Ptr[float64](0), // }, // }}, // } } }
Output:
Example (ReservationSummariesDailyWithBillingProfileId) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationSummariesDailyWithBillingProfileId.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewReservationsSummariesClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:2468/billingProfiles/13579", armconsumption.DatagrainDailyGrain, &armconsumption.ReservationsSummariesClientListOptions{StartDate: to.Ptr("2017-10-01"), EndDate: to.Ptr("2017-11-20"), Filter: nil, ReservationID: nil, ReservationOrderID: 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.ReservationSummariesListResult = armconsumption.ReservationSummariesListResult{ // Value: []*armconsumption.ReservationSummary{ // { // Name: to.Ptr("reservationSummaries_Id1"), // Type: to.Ptr("Microsoft.Consumption/reservationSummaries"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345:2468/billingProfiles/13579/providers/Microsoft.Consumption/reservationSummaries/reservationSummaries_Id1"), // Properties: &armconsumption.ReservationSummaryProperties{ // AvgUtilizationPercentage: to.Ptr[float64](0), // MaxUtilizationPercentage: to.Ptr[float64](0), // MinUtilizationPercentage: to.Ptr[float64](0), // ReservationID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservedHours: to.Ptr[float64](720), // SKUName: to.Ptr("Standard_B1s"), // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-01T07:00:00.000Z"); return t}()), // UsedHours: to.Ptr[float64](0), // }, // }}, // } } }
Output:
Example (ReservationSummariesMonthlyWithBillingAccountId) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationSummariesMonthlyWithBillingAccountId.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewReservationsSummariesClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345", armconsumption.DatagrainMonthlyGrain, &armconsumption.ReservationsSummariesClientListOptions{StartDate: nil, EndDate: nil, Filter: nil, ReservationID: nil, ReservationOrderID: 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.ReservationSummariesListResult = armconsumption.ReservationSummariesListResult{ // Value: []*armconsumption.ReservationSummary{ // { // Name: to.Ptr("reservationSummaries_Id1"), // Type: to.Ptr("Microsoft.Consumption/reservationSummaries"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345/providers/Microsoft.Consumption/reservationSummaries/reservationSummaries_Id1"), // Properties: &armconsumption.ReservationSummaryProperties{ // AvgUtilizationPercentage: to.Ptr[float64](0), // MaxUtilizationPercentage: to.Ptr[float64](0), // MinUtilizationPercentage: to.Ptr[float64](0), // ReservationID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservedHours: to.Ptr[float64](720), // SKUName: to.Ptr("Standard_B1s"), // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-01T07:00:00.000Z"); return t}()), // UsedHours: to.Ptr[float64](0), // }, // }}, // } } }
Output:
Example (ReservationSummariesMonthlyWithBillingProfileId) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationSummariesMonthlyWithBillingProfileId.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewReservationsSummariesClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:2468/billingProfiles/13579", armconsumption.DatagrainMonthlyGrain, &armconsumption.ReservationsSummariesClientListOptions{StartDate: nil, EndDate: nil, Filter: nil, ReservationID: nil, ReservationOrderID: 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.ReservationSummariesListResult = armconsumption.ReservationSummariesListResult{ // Value: []*armconsumption.ReservationSummary{ // { // Name: to.Ptr("reservationSummaries_Id1"), // Type: to.Ptr("Microsoft.Consumption/reservationSummaries"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345:2468/billingProfiles/13579/providers/Microsoft.Consumption/reservationSummaries/reservationSummaries_Id1"), // Properties: &armconsumption.ReservationSummaryProperties{ // AvgUtilizationPercentage: to.Ptr[float64](0), // MaxUtilizationPercentage: to.Ptr[float64](0), // MinUtilizationPercentage: to.Ptr[float64](0), // ReservationID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), // ReservedHours: to.Ptr[float64](720), // SKUName: to.Ptr("Standard_B1s"), // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-01T07:00:00.000Z"); return t}()), // UsedHours: to.Ptr[float64](0), // }, // }}, // } } }
Output:
Example (ReservationSummariesMonthlyWithBillingProfileIdReservationId) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationSummariesMonthlyWithBillingProfileIdReservationId.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewReservationsSummariesClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:2468/billingProfiles/13579", armconsumption.DatagrainMonthlyGrain, &armconsumption.ReservationsSummariesClientListOptions{StartDate: nil, EndDate: nil, Filter: nil, ReservationID: to.Ptr("1c6b6358-709f-484c-85f1-72e862a0cf3b"), ReservationOrderID: to.Ptr("9f39ba10-794f-4dcb-8f4b-8d0cb47c27dc"), }) 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.ReservationSummariesListResult = armconsumption.ReservationSummariesListResult{ // Value: []*armconsumption.ReservationSummary{ // { // Name: to.Ptr("reservationSummaries_Id1"), // Type: to.Ptr("Microsoft.Consumption/reservationSummaries"), // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345:2468/billingProfiles/13579/providers/Microsoft.Consumption/reservationSummaries/reservationSummaries_Id1"), // Properties: &armconsumption.ReservationSummaryProperties{ // AvgUtilizationPercentage: to.Ptr[float64](0), // MaxUtilizationPercentage: to.Ptr[float64](0), // MinUtilizationPercentage: to.Ptr[float64](0), // ReservationID: to.Ptr("1c6b6358-709f-484c-85f1-72e862a0cf3b"), // ReservationOrderID: to.Ptr("9f39ba10-794f-4dcb-8f4b-8d0cb47c27dc"), // ReservedHours: to.Ptr[float64](720), // SKUName: to.Ptr("Standard_B1s"), // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-01T07:00:00.000Z"); return t}()), // UsedHours: to.Ptr[float64](0), // }, // }}, // } } }
Output:
type ReservationsSummariesClientListByReservationOrderAndReservationOptions ¶ added in v0.3.0
type ReservationsSummariesClientListByReservationOrderAndReservationOptions struct { // Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' Filter *string }
ReservationsSummariesClientListByReservationOrderAndReservationOptions contains the optional parameters for the ReservationsSummariesClient.NewListByReservationOrderAndReservationPager method.
type ReservationsSummariesClientListByReservationOrderAndReservationResponse ¶ added in v0.3.0
type ReservationsSummariesClientListByReservationOrderAndReservationResponse struct { // Result of listing reservation summaries. ReservationSummariesListResult }
ReservationsSummariesClientListByReservationOrderAndReservationResponse contains the response from method ReservationsSummariesClient.NewListByReservationOrderAndReservationPager.
type ReservationsSummariesClientListByReservationOrderOptions ¶ added in v0.3.0
type ReservationsSummariesClientListByReservationOrderOptions struct { // Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' Filter *string }
ReservationsSummariesClientListByReservationOrderOptions contains the optional parameters for the ReservationsSummariesClient.NewListByReservationOrderPager method.
type ReservationsSummariesClientListByReservationOrderResponse ¶ added in v0.3.0
type ReservationsSummariesClientListByReservationOrderResponse struct { // Result of listing reservation summaries. ReservationSummariesListResult }
ReservationsSummariesClientListByReservationOrderResponse contains the response from method ReservationsSummariesClient.NewListByReservationOrderPager.
type ReservationsSummariesClientListOptions ¶ added in v0.3.0
type ReservationsSummariesClientListOptions struct { // End date. Only applicable when querying with billing profile EndDate *string // Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge'. // Not applicable when querying with billing profile Filter *string // Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific reservation ReservationID *string // Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific reservation order ReservationOrderID *string // Start date. Only applicable when querying with billing profile StartDate *string }
ReservationsSummariesClientListOptions contains the optional parameters for the ReservationsSummariesClient.NewListPager method.
type ReservationsSummariesClientListResponse ¶ added in v0.3.0
type ReservationsSummariesClientListResponse struct { // Result of listing reservation summaries. ReservationSummariesListResult }
ReservationsSummariesClientListResponse contains the response from method ReservationsSummariesClient.NewListPager.
type Resource ¶
type Resource struct { // READ-ONLY; The etag for the resource. Etag *string // READ-ONLY; The full qualified ARM ID of an event. ID *string // READ-ONLY; The ID that uniquely identifies an event. Name *string // READ-ONLY; Resource tags. Tags map[string]*string // READ-ONLY; Resource type. Type *string }
Resource - The Resource model definition.
func (Resource) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface for type Resource.
func (*Resource) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaller interface for type Resource.
type ResourceAttributes ¶
type ResourceAttributes struct { // READ-ONLY; Resource location Location *string // READ-ONLY; Resource sku SKU *string }
ResourceAttributes - The Resource model definition.
func (ResourceAttributes) MarshalJSON ¶ added in v1.1.0
func (r ResourceAttributes) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ResourceAttributes.
func (*ResourceAttributes) UnmarshalJSON ¶
func (r *ResourceAttributes) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAttributes.
type SKUProperty ¶
type SKUProperty struct { // READ-ONLY; The name of sku property. Name *string // READ-ONLY; The value of sku property. Value *string }
SKUProperty - The Sku property
func (SKUProperty) MarshalJSON ¶ added in v1.1.0
func (s SKUProperty) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type SKUProperty.
func (*SKUProperty) UnmarshalJSON ¶ added in v1.1.0
func (s *SKUProperty) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type SKUProperty.
type Scope ¶
type Scope string
const ( ScopeSingle Scope = "Single" )
func PossibleScopeValues ¶
func PossibleScopeValues() []Scope
PossibleScopeValues returns the possible values for the Scope const type.
type Status ¶
type Status string
Status - The status of the lot.
func PossibleStatusValues ¶
func PossibleStatusValues() []Status
PossibleStatusValues returns the possible values for the Status const type.
type Tag ¶
Tag - The tag resource.
func (Tag) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface for type Tag.
func (*Tag) UnmarshalJSON ¶ added in v1.1.0
UnmarshalJSON implements the json.Unmarshaller interface for type Tag.
type TagProperties ¶
type TagProperties struct { // A list of Tag. Tags []*Tag // READ-ONLY; The link (url) to the next page of results. NextLink *string // READ-ONLY; The link (url) to the previous page of results. PreviousLink *string }
TagProperties - The properties of the tag.
func (TagProperties) MarshalJSON ¶
func (t TagProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type TagProperties.
func (*TagProperties) UnmarshalJSON ¶ added in v1.1.0
func (t *TagProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type TagProperties.
type TagsClient ¶
type TagsClient struct {
// contains filtered or unexported fields
}
TagsClient contains the methods for the Tags group. Don't use this type directly, use NewTagsClient() instead.
func NewTagsClient ¶
func NewTagsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*TagsClient, error)
NewTagsClient creates a new instance of TagsClient with the specified values.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*TagsClient) Get ¶
func (client *TagsClient) Get(ctx context.Context, scope string, options *TagsClientGetOptions) (TagsClientGetResponse, error)
Get - Get all available tag keys for the defined scope If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2021-10-01
- scope - The scope associated with tags 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 and '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope..
- options - TagsClientGetOptions contains the optional parameters for the TagsClient.Get method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/Tags.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewTagsClient().Get(ctx, "providers/Microsoft.CostManagement/billingAccounts/1234", 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.TagsResult = armconsumption.TagsResult{ // Name: to.Ptr("tags1"), // Type: to.Ptr("Microsoft.Consumption/tags"), // ETag: to.Ptr("\"1d34d012214157f\""), // ID: to.Ptr("providers/Microsoft.CostManagement/billingAccounts/{billingaccount-id}/providers/Microsoft.Consumption/tags/tags1"), // Properties: &armconsumption.TagProperties{ // PreviousLink: to.Ptr("https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingaccount-id}/providers/Microsoft.Consumption/tags/?$expand=properties/tags/value&api-version=2021-10-01&startDate=2020-12-01&endDate=2020-12-31&$top=1000&$skiptoken=AQAAAA%3D%3D"), // Tags: []*armconsumption.Tag{ // { // Key: to.Ptr("Department"), // }, // { // Key: to.Ptr("CostCenter"), // }, // { // Key: to.Ptr("Portal"), // }, // { // Key: to.Ptr("OrgName"), // }, // { // Key: to.Ptr("Namespace"), // }, // { // Key: to.Ptr("resourceType"), // }, // { // Key: to.Ptr("Subsystem"), // }, // { // Key: to.Ptr("Environment"), // }, // { // Key: to.Ptr("clusterName"), // }}, // }, // } }
Output:
type TagsClientGetOptions ¶ added in v0.3.0
type TagsClientGetOptions struct { }
TagsClientGetOptions contains the optional parameters for the TagsClient.Get method.
type TagsClientGetResponse ¶ added in v0.3.0
type TagsClientGetResponse struct { // A resource listing all tags. TagsResult }
TagsClientGetResponse contains the response from method TagsClient.Get.
type TagsResult ¶
type TagsResult 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 tag. Properties *TagProperties // READ-ONLY; Resource Id. ID *string // READ-ONLY; Resource name. Name *string // READ-ONLY; Resource type. Type *string }
TagsResult - A resource listing all tags.
func (TagsResult) MarshalJSON ¶ added in v1.1.0
func (t TagsResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type TagsResult.
func (*TagsResult) UnmarshalJSON ¶ added in v1.1.0
func (t *TagsResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type TagsResult.
type Term ¶
type Term string
func PossibleTermValues ¶
func PossibleTermValues() []Term
PossibleTermValues returns the possible values for the Term const type.
type ThresholdType ¶
type ThresholdType string
ThresholdType - The type of threshold
const ( ThresholdTypeActual ThresholdType = "Actual" ThresholdTypeForecasted ThresholdType = "Forecasted" )
func PossibleThresholdTypeValues ¶
func PossibleThresholdTypeValues() []ThresholdType
PossibleThresholdTypeValues returns the possible values for the ThresholdType const type.
type TimeGrainType ¶
type TimeGrainType string
TimeGrainType - The time covered by a budget. Tracking of the amount will be reset based on the time grain. BillingMonth, BillingQuarter, and BillingAnnual are only supported by WD customers
const ( TimeGrainTypeAnnually TimeGrainType = "Annually" TimeGrainTypeBillingAnnual TimeGrainType = "BillingAnnual" TimeGrainTypeBillingMonth TimeGrainType = "BillingMonth" TimeGrainTypeBillingQuarter TimeGrainType = "BillingQuarter" TimeGrainTypeMonthly TimeGrainType = "Monthly" TimeGrainTypeQuarterly TimeGrainType = "Quarterly" )
func PossibleTimeGrainTypeValues ¶
func PossibleTimeGrainTypeValues() []TimeGrainType
PossibleTimeGrainTypeValues returns the possible values for the TimeGrainType const type.
type UsageDetail ¶
type UsageDetail struct { // REQUIRED; Specifies the kind of usage details. Kind *UsageDetailsKind // READ-ONLY; The etag for the resource. Etag *string // READ-ONLY; The full qualified ARM ID of an event. ID *string // READ-ONLY; The ID that uniquely identifies an event. Name *string // READ-ONLY; Resource tags. Tags map[string]*string // READ-ONLY; Resource type. Type *string }
UsageDetail - An usage detail resource.
func (*UsageDetail) GetUsageDetail ¶
func (u *UsageDetail) GetUsageDetail() *UsageDetail
GetUsageDetail implements the UsageDetailClassification interface for type UsageDetail.
func (UsageDetail) MarshalJSON ¶ added in v0.3.0
func (u UsageDetail) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type UsageDetail.
func (*UsageDetail) UnmarshalJSON ¶
func (u *UsageDetail) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type UsageDetail.
type UsageDetailClassification ¶
type UsageDetailClassification interface { // GetUsageDetail returns the UsageDetail content of the underlying type. GetUsageDetail() *UsageDetail }
UsageDetailClassification provides polymorphic access to related types. Call the interface's GetUsageDetail() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *LegacyUsageDetail, *ModernUsageDetail, *UsageDetail
type UsageDetailsClient ¶
type UsageDetailsClient struct {
// contains filtered or unexported fields
}
UsageDetailsClient contains the methods for the UsageDetails group. Don't use this type directly, use NewUsageDetailsClient() instead.
func NewUsageDetailsClient ¶
func NewUsageDetailsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*UsageDetailsClient, error)
NewUsageDetailsClient creates a new instance of UsageDetailsClient with the specified values.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*UsageDetailsClient) NewListPager ¶ added in v0.5.0
func (client *UsageDetailsClient) NewListPager(scope string, options *UsageDetailsClientListOptions) *runtime.Pager[UsageDetailsClientListResponse]
NewListPager - Lists the usage details for the defined scope. Usage details are available via this API only for May 1, 2014 or later.
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 and '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For subscription, billing account, department, enrollment account and management group, you can also add billing period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to specify billing period at department scope use '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. 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 - UsageDetailsClientListOptions contains the optional parameters for the UsageDetailsClient.NewListPager method.
Example (BillingAccountUsageDetailsListForBillingPeriodLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListForBillingPeriodByBillingAccount.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/BillingAccounts/1234", &armconsumption.UsageDetailsClientListOptions{Expand: nil, Filter: nil, Skiptoken: nil, Top: nil, Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ // Value: []armconsumption.UsageDetailClassification{ // &armconsumption.LegacyUsageDetail{ // Name: to.Ptr("usageDetails_Id1"), // Type: to.Ptr("Microsoft.Consumption/usageDetails"), // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), // Properties: &armconsumption.LegacyUsageDetailProperties{ // AccountName: to.Ptr("Account Name 1"), // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), // BillingAccountID: to.Ptr("xxxxxxxx"), // BillingAccountName: to.Ptr("Account Name 1"), // BillingCurrency: to.Ptr("CAD"), // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.000Z"); return t}()), // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.000Z"); return t}()), // BillingProfileID: to.Ptr("xxxxxxxx"), // BillingProfileName: to.Ptr("Account Name 1"), // ChargeType: to.Ptr("Usage"), // ConsumedService: to.Ptr("Microsoft.Storage"), // Cost: to.Ptr[float64](0.000342194841184), // CostCenter: to.Ptr("DEV"), // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.000Z"); return t}()), // EffectivePrice: to.Ptr[float64](0.010534556373432), // InvoiceSection: to.Ptr("Invoice Section 1"), // IsAzureCreditEligible: to.Ptr(false), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferID: to.Ptr("Offer Id 1"), // PartNumber: to.Ptr("Part Number 1"), // Product: to.Ptr("Product Name 1"), // Quantity: to.Ptr[float64](0.8234), // ResourceGroup: to.Ptr("Resource Group 1"), // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), // ResourceLocation: to.Ptr("USEast"), // ResourceName: to.Ptr("Resource Name 1"), // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("Subscription Name 1"), // UnitPrice: to.Ptr[float64](3.74), // }, // }}, // } } }
Output:
Example (BillingAccountUsageDetailsListLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListByBillingAccount.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/BillingAccounts/1234", &armconsumption.UsageDetailsClientListOptions{Expand: nil, Filter: nil, Skiptoken: nil, Top: nil, Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ // Value: []armconsumption.UsageDetailClassification{ // &armconsumption.LegacyUsageDetail{ // Name: to.Ptr("usageDetails_Id1"), // Type: to.Ptr("Microsoft.Consumption/usageDetails"), // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), // Properties: &armconsumption.LegacyUsageDetailProperties{ // AccountName: to.Ptr("Account Name 1"), // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), // BillingAccountID: to.Ptr("xxxxxxxx"), // BillingAccountName: to.Ptr("Account Name 1"), // BillingCurrency: to.Ptr("CAD"), // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.000Z"); return t}()), // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.000Z"); return t}()), // BillingProfileID: to.Ptr("xxxxxxxx"), // BillingProfileName: to.Ptr("Account Name 1"), // ChargeType: to.Ptr("Usage"), // ConsumedService: to.Ptr("Microsoft.Storage"), // Cost: to.Ptr[float64](0.000295194820065), // CostCenter: to.Ptr("DEV"), // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.000Z"); return t}()), // EffectivePrice: to.Ptr[float64](0.000402776395232), // InvoiceSection: to.Ptr("Invoice Section 1"), // IsAzureCreditEligible: to.Ptr(false), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferID: to.Ptr("Offer Id 1"), // PartNumber: to.Ptr("Part Number 1"), // Product: to.Ptr("Product Name 1"), // Quantity: to.Ptr[float64](0.7329), // ResourceGroup: to.Ptr("Resource Group 1"), // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), // ResourceLocation: to.Ptr("USEast"), // ResourceName: to.Ptr("Resource Name 1"), // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("Subscription Name 1"), // UnitPrice: to.Ptr[float64](4.38), // }, // }}, // } } }
Output:
Example (BillingAccountUsageDetailsListModern) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListByMCABillingAccount.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/BillingAccounts/1234:56789", &armconsumption.UsageDetailsClientListOptions{Expand: nil, Filter: nil, Skiptoken: nil, Top: nil, Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ // Value: []armconsumption.UsageDetailClassification{ // &armconsumption.ModernUsageDetail{ // Name: to.Ptr("usageDetails_Id1"), // Type: to.Ptr("Microsoft.Consumption/usageDetails"), // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234:56789/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Kind: to.Ptr(armconsumption.UsageDetailsKindModern), // Properties: &armconsumption.ModernUsageDetailProperties{ // AdditionalInfo: to.Ptr("{ \"UsageType\": \"ComputeHR\", \"ImageType\": \"Windows Client BYOL\", \"ServiceType\": \"Standard_D1\", \"VMName\": null, \"VMProperties\": null, \"VCPUs\": 1, \"CPUs\": 0}"), // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), // BillingAccountID: to.Ptr("1234:56789"), // BillingAccountName: to.Ptr("Account Name 1"), // BillingCurrencyCode: to.Ptr("USD"), // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00.000Z"); return t}()), // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.000Z"); return t}()), // BillingProfileID: to.Ptr("2468"), // BillingProfileName: to.Ptr("Account Name 1"), // ChargeType: to.Ptr("Usage"), // ConsumedService: to.Ptr("Microsoft.Storage"), // CostCenter: to.Ptr("DEV"), // CostInBillingCurrency: to.Ptr[float64](1.84763819095477), // CostInPricingCurrency: to.Ptr[float64](1.84763819095477), // CostInUSD: to.Ptr[float64](1.84763819095477), // CustomerName: to.Ptr("Modern Azure Customer 1"), // CustomerTenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-30T00:00:00.000Z"); return t}()), // ExchangeRate: to.Ptr("1"), // ExchangeRateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.000Z"); return t}()), // ExchangeRatePricingToBilling: to.Ptr[float64](0.077), // Frequency: to.Ptr("UsageBased"), // InstanceName: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), // InvoiceID: to.Ptr(""), // InvoiceSectionID: to.Ptr("98765"), // InvoiceSectionName: to.Ptr("Invoice Section 1"), // IsAzureCreditEligible: to.Ptr(false), // MarketPrice: to.Ptr[float64](0.077), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // PartnerEarnedCreditApplied: to.Ptr("0"), // PartnerEarnedCreditRate: to.Ptr[float64](0.077), // PartnerName: to.Ptr("Partner Name 1"), // PartnerTenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), // PaygCostInBillingCurrency: to.Ptr[float64](1.848), // PaygCostInUSD: to.Ptr[float64](1.848), // PreviousInvoiceID: to.Ptr(""), // PricingCurrencyCode: to.Ptr("USD"), // Product: to.Ptr("Virtual Machines D Series - D1 - US East"), // ProductIdentifier: to.Ptr("DZH318Z0BQ4B00FV"), // ProductOrderID: to.Ptr("a3db7880-70eb-4b4c-6a79-1425a058df5a"), // ProductOrderName: to.Ptr("Azure plan"), // PublisherID: to.Ptr(""), // PublisherName: to.Ptr("Microsoft"), // PublisherType: to.Ptr("Microsoft"), // Quantity: to.Ptr[float64](0.7329), // ResellerMpnID: to.Ptr(""), // ResellerName: to.Ptr("Reseller Name 1"), // ReservationID: to.Ptr(""), // ReservationName: to.Ptr(""), // ResourceGroup: to.Ptr("Resource Group 1"), // ResourceLocation: to.Ptr("USEast"), // ResourceLocationNormalized: to.Ptr("US East"), // ServiceInfo1: to.Ptr(""), // ServiceInfo2: to.Ptr("Windows Client BYOL"), // ServicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T00:00:00.000Z"); return t}()), // ServicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.000Z"); return t}()), // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("Subscription Name 1"), // Term: to.Ptr(""), // UnitPrice: to.Ptr[float64](4.38), // }, // }}, // } } }
Output:
Example (BillingProfileUsageDetailsListModern) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListByMCABillingProfile.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/BillingAccounts/1234:56789/billingProfiles/2468", &armconsumption.UsageDetailsClientListOptions{Expand: nil, Filter: nil, Skiptoken: nil, Top: nil, Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ // Value: []armconsumption.UsageDetailClassification{ // &armconsumption.ModernUsageDetail{ // Name: to.Ptr("usageDetails_Id1"), // Type: to.Ptr("Microsoft.Consumption/usageDetails"), // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234:56789/billingProfiles/2468/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Kind: to.Ptr(armconsumption.UsageDetailsKindModern), // Properties: &armconsumption.ModernUsageDetailProperties{ // AdditionalInfo: to.Ptr("{ \"UsageType\": \"ComputeHR\", \"ImageType\": \"Windows Client BYOL\", \"ServiceType\": \"Standard_D1\", \"VMName\": null, \"VMProperties\": null, \"VCPUs\": 1, \"CPUs\": 0}"), // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), // BillingAccountID: to.Ptr("1234:56789"), // BillingAccountName: to.Ptr("Account Name 1"), // BillingCurrencyCode: to.Ptr("USD"), // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00.000Z"); return t}()), // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.000Z"); return t}()), // BillingProfileID: to.Ptr("2468"), // BillingProfileName: to.Ptr("Account Name 1"), // ChargeType: to.Ptr("Usage"), // ConsumedService: to.Ptr("Microsoft.Storage"), // CostCenter: to.Ptr("DEV"), // CostInBillingCurrency: to.Ptr[float64](1.84763819095477), // CostInPricingCurrency: to.Ptr[float64](1.84763819095477), // CostInUSD: to.Ptr[float64](1.84763819095477), // CustomerName: to.Ptr("Modern Azure Customer 1"), // CustomerTenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-30T00:00:00.000Z"); return t}()), // ExchangeRate: to.Ptr("1"), // ExchangeRateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.000Z"); return t}()), // ExchangeRatePricingToBilling: to.Ptr[float64](0.077), // Frequency: to.Ptr("UsageBased"), // InstanceName: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), // InvoiceID: to.Ptr(""), // InvoiceSectionID: to.Ptr("98765"), // InvoiceSectionName: to.Ptr("Invoice Section 1"), // IsAzureCreditEligible: to.Ptr(false), // MarketPrice: to.Ptr[float64](0.077), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // PartnerEarnedCreditApplied: to.Ptr("0"), // PartnerEarnedCreditRate: to.Ptr[float64](0.077), // PartnerName: to.Ptr("Partner Name 1"), // PartnerTenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), // PaygCostInBillingCurrency: to.Ptr[float64](1.848), // PaygCostInUSD: to.Ptr[float64](1.848), // PreviousInvoiceID: to.Ptr(""), // PricingCurrencyCode: to.Ptr("USD"), // Product: to.Ptr("Virtual Machines D Series - D1 - US East"), // ProductIdentifier: to.Ptr("DZH318Z0BQ4B00FV"), // ProductOrderID: to.Ptr("a3db7880-70eb-4b4c-6a79-1425a058df5a"), // ProductOrderName: to.Ptr("Azure plan"), // PublisherID: to.Ptr(""), // PublisherName: to.Ptr("Microsoft"), // PublisherType: to.Ptr("Microsoft"), // Quantity: to.Ptr[float64](0.7329), // ResellerMpnID: to.Ptr(""), // ResellerName: to.Ptr("Reseller Name 1"), // ReservationID: to.Ptr(""), // ReservationName: to.Ptr(""), // ResourceGroup: to.Ptr("Resource Group 1"), // ResourceLocation: to.Ptr("USEast"), // ResourceLocationNormalized: to.Ptr("US East"), // ServiceInfo1: to.Ptr(""), // ServiceInfo2: to.Ptr("Windows Client BYOL"), // ServicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T00:00:00.000Z"); return t}()), // ServicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.000Z"); return t}()), // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("Subscription Name 1"), // Term: to.Ptr(""), // UnitPrice: to.Ptr[float64](4.38), // }, // }}, // } } }
Output:
Example (CustomerUsageDetailsListModern) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListByMCACustomer.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/BillingAccounts/1234:56789/customers/00000000-0000-0000-0000-000000000000", &armconsumption.UsageDetailsClientListOptions{Expand: nil, Filter: nil, Skiptoken: nil, Top: nil, Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ // Value: []armconsumption.UsageDetailClassification{ // &armconsumption.ModernUsageDetail{ // Name: to.Ptr("usageDetails_Id1"), // Type: to.Ptr("Microsoft.Consumption/usageDetails"), // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234:56789/customers/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Kind: to.Ptr(armconsumption.UsageDetailsKindModern), // Properties: &armconsumption.ModernUsageDetailProperties{ // AdditionalInfo: to.Ptr("{ \"UsageType\": \"ComputeHR\", \"ImageType\": \"Windows Client BYOL\", \"ServiceType\": \"Standard_D1\", \"VMName\": null, \"VMProperties\": null, \"VCPUs\": 1, \"CPUs\": 0}"), // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), // BillingAccountID: to.Ptr("1234:56789"), // BillingAccountName: to.Ptr("Account Name 1"), // BillingCurrencyCode: to.Ptr("USD"), // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00.000Z"); return t}()), // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.000Z"); return t}()), // BillingProfileID: to.Ptr("2468"), // BillingProfileName: to.Ptr("Account Name 1"), // ChargeType: to.Ptr("Usage"), // ConsumedService: to.Ptr("Microsoft.Storage"), // CostCenter: to.Ptr("DEV"), // CostInBillingCurrency: to.Ptr[float64](1.84763819095477), // CostInPricingCurrency: to.Ptr[float64](1.84763819095477), // CostInUSD: to.Ptr[float64](1.84763819095477), // CustomerName: to.Ptr("Modern Azure Customer 1"), // CustomerTenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-30T00:00:00.000Z"); return t}()), // ExchangeRate: to.Ptr("1"), // ExchangeRateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.000Z"); return t}()), // ExchangeRatePricingToBilling: to.Ptr[float64](0.077), // Frequency: to.Ptr("UsageBased"), // InstanceName: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), // InvoiceID: to.Ptr(""), // InvoiceSectionID: to.Ptr("98765"), // InvoiceSectionName: to.Ptr("Invoice Section 1"), // IsAzureCreditEligible: to.Ptr(false), // MarketPrice: to.Ptr[float64](0.077), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // PartnerEarnedCreditApplied: to.Ptr("0"), // PartnerEarnedCreditRate: to.Ptr[float64](0.077), // PartnerName: to.Ptr("Partner Name 1"), // PartnerTenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), // PaygCostInBillingCurrency: to.Ptr[float64](1.848), // PaygCostInUSD: to.Ptr[float64](1.848), // PreviousInvoiceID: to.Ptr(""), // PricingCurrencyCode: to.Ptr("USD"), // Product: to.Ptr("Virtual Machines D Series - D1 - US East"), // ProductIdentifier: to.Ptr("DZH318Z0BQ4B00FV"), // ProductOrderID: to.Ptr("a3db7880-70eb-4b4c-6a79-1425a058df5a"), // ProductOrderName: to.Ptr("Azure plan"), // PublisherID: to.Ptr(""), // PublisherName: to.Ptr("Microsoft"), // PublisherType: to.Ptr("Microsoft"), // Quantity: to.Ptr[float64](0.7329), // ResellerMpnID: to.Ptr(""), // ResellerName: to.Ptr("Reseller Name 1"), // ReservationID: to.Ptr(""), // ReservationName: to.Ptr(""), // ResourceGroup: to.Ptr("Resource Group 1"), // ResourceLocation: to.Ptr("USEast"), // ResourceLocationNormalized: to.Ptr("US East"), // ServiceInfo1: to.Ptr(""), // ServiceInfo2: to.Ptr("Windows Client BYOL"), // ServicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T00:00:00.000Z"); return t}()), // ServicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.000Z"); return t}()), // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("Subscription Name 1"), // Term: to.Ptr(""), // UnitPrice: to.Ptr[float64](4.38), // }, // }}, // } } }
Output:
Example (DepartmentUsageDetailsListForBillingPeriodLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListForBillingPeriodByDepartment.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/Departments/1234", &armconsumption.UsageDetailsClientListOptions{Expand: nil, Filter: nil, Skiptoken: nil, Top: nil, Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ // Value: []armconsumption.UsageDetailClassification{ // &armconsumption.LegacyUsageDetail{ // Name: to.Ptr("usageDetails_Id1"), // Type: to.Ptr("Microsoft.Consumption/usageDetails"), // ID: to.Ptr("/providers/Microsoft.Billing/Departments/1234/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), // Properties: &armconsumption.LegacyUsageDetailProperties{ // AccountName: to.Ptr("Account Name 1"), // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), // BillingAccountID: to.Ptr("xxxxxxxx"), // BillingAccountName: to.Ptr("Account Name 1"), // BillingCurrency: to.Ptr("CAD"), // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.000Z"); return t}()), // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.000Z"); return t}()), // BillingProfileID: to.Ptr("xxxxxxxx"), // BillingProfileName: to.Ptr("Account Name 1"), // ChargeType: to.Ptr("Usage"), // ConsumedService: to.Ptr("Microsoft.Storage"), // Cost: to.Ptr[float64](0.000342194841184), // CostCenter: to.Ptr("DEV"), // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.000Z"); return t}()), // EffectivePrice: to.Ptr[float64](0.010534556373432), // InvoiceSection: to.Ptr("Invoice Section 1"), // IsAzureCreditEligible: to.Ptr(false), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferID: to.Ptr("Offer Id 1"), // PartNumber: to.Ptr("Part Number 1"), // Product: to.Ptr("Product Name 1"), // Quantity: to.Ptr[float64](0.8234), // ResourceGroup: to.Ptr("Resource Group 1"), // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), // ResourceLocation: to.Ptr("USEast"), // ResourceName: to.Ptr("Resource Name 1"), // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("Subscription Name 1"), // UnitPrice: to.Ptr[float64](3.74), // }, // }}, // } } }
Output:
Example (DepartmentUsageDetailsListLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListByDepartment.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/Departments/1234", &armconsumption.UsageDetailsClientListOptions{Expand: nil, Filter: nil, Skiptoken: nil, Top: nil, Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ // Value: []armconsumption.UsageDetailClassification{ // &armconsumption.LegacyUsageDetail{ // Name: to.Ptr("usageDetails_Id1"), // Type: to.Ptr("Microsoft.Consumption/usageDetails"), // ID: to.Ptr("/providers/Microsoft.Billing/Departments/1234/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), // Properties: &armconsumption.LegacyUsageDetailProperties{ // AccountName: to.Ptr("Account Name 1"), // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), // BillingAccountID: to.Ptr("xxxxxxxx"), // BillingAccountName: to.Ptr("Account Name 1"), // BillingCurrency: to.Ptr("CAD"), // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.000Z"); return t}()), // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.000Z"); return t}()), // BillingProfileID: to.Ptr("xxxxxxxx"), // BillingProfileName: to.Ptr("Account Name 1"), // ChargeType: to.Ptr("Usage"), // ConsumedService: to.Ptr("Microsoft.Storage"), // Cost: to.Ptr[float64](0.000295194820065), // CostCenter: to.Ptr("DEV"), // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.000Z"); return t}()), // EffectivePrice: to.Ptr[float64](0.000402776395232), // InvoiceSection: to.Ptr("Invoice Section 1"), // IsAzureCreditEligible: to.Ptr(false), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferID: to.Ptr("Offer Id 1"), // PartNumber: to.Ptr("Part Number 1"), // Product: to.Ptr("Product Name 1"), // Quantity: to.Ptr[float64](0.7329), // ResourceGroup: to.Ptr("Resource Group 1"), // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), // ResourceLocation: to.Ptr("USEast"), // ResourceName: to.Ptr("Resource Name 1"), // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("Subscription Name 1"), // UnitPrice: to.Ptr[float64](4.38), // }, // }}, // } } }
Output:
Example (EnrollmentAccountUsageDetailsListForBillingPeriodLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListForBillingPeriodByEnrollmentAccount.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/EnrollmentAccounts/1234", &armconsumption.UsageDetailsClientListOptions{Expand: nil, Filter: nil, Skiptoken: nil, Top: nil, Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ // Value: []armconsumption.UsageDetailClassification{ // &armconsumption.LegacyUsageDetail{ // Name: to.Ptr("usageDetails_Id1"), // Type: to.Ptr("Microsoft.Consumption/usageDetails"), // ID: to.Ptr("/providers/Microsoft.Billing/EnrollmentAccounts/1234/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), // Properties: &armconsumption.LegacyUsageDetailProperties{ // AccountName: to.Ptr("Account Name 1"), // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), // BillingAccountID: to.Ptr("xxxxxxxx"), // BillingAccountName: to.Ptr("Account Name 1"), // BillingCurrency: to.Ptr("CAD"), // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.000Z"); return t}()), // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.000Z"); return t}()), // BillingProfileID: to.Ptr("xxxxxxxx"), // BillingProfileName: to.Ptr("Account Name 1"), // ChargeType: to.Ptr("Usage"), // ConsumedService: to.Ptr("Microsoft.Storage"), // Cost: to.Ptr[float64](0.000342194841184), // CostCenter: to.Ptr("DEV"), // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.000Z"); return t}()), // EffectivePrice: to.Ptr[float64](0.010534556373432), // InvoiceSection: to.Ptr("Invoice Section 1"), // IsAzureCreditEligible: to.Ptr(false), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferID: to.Ptr("Offer Id 1"), // PartNumber: to.Ptr("Part Number 1"), // Product: to.Ptr("Product Name 1"), // Quantity: to.Ptr[float64](0.8234), // ResourceGroup: to.Ptr("Resource Group 1"), // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), // ResourceLocation: to.Ptr("USEast"), // ResourceName: to.Ptr("Resource Name 1"), // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("Subscription Name 1"), // UnitPrice: to.Ptr[float64](3.74), // }, // }}, // } } }
Output:
Example (EnrollmentAccountUsageDetailsListLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListByEnrollmentAccount.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/EnrollmentAccounts/1234", &armconsumption.UsageDetailsClientListOptions{Expand: nil, Filter: nil, Skiptoken: nil, Top: nil, Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ // Value: []armconsumption.UsageDetailClassification{ // &armconsumption.LegacyUsageDetail{ // Name: to.Ptr("usageDetails_Id1"), // Type: to.Ptr("Microsoft.Consumption/usageDetails"), // ID: to.Ptr("/providers/Microsoft.Billing/EnrollmentAccounts/1234/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), // Properties: &armconsumption.LegacyUsageDetailProperties{ // AccountName: to.Ptr("Account Name 1"), // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), // BillingAccountID: to.Ptr("xxxxxxxx"), // BillingAccountName: to.Ptr("Account Name 1"), // BillingCurrency: to.Ptr("CAD"), // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.000Z"); return t}()), // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.000Z"); return t}()), // BillingProfileID: to.Ptr("xxxxxxxx"), // BillingProfileName: to.Ptr("Account Name 1"), // ChargeType: to.Ptr("Usage"), // ConsumedService: to.Ptr("Microsoft.Storage"), // Cost: to.Ptr[float64](0.000295194820065), // CostCenter: to.Ptr("DEV"), // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.000Z"); return t}()), // EffectivePrice: to.Ptr[float64](0.000402776395232), // InvoiceSection: to.Ptr("Invoice Section 1"), // IsAzureCreditEligible: to.Ptr(false), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferID: to.Ptr("Offer Id 1"), // PartNumber: to.Ptr("Part Number 1"), // Product: to.Ptr("Product Name 1"), // Quantity: to.Ptr[float64](0.7329), // ResourceGroup: to.Ptr("Resource Group 1"), // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), // ResourceLocation: to.Ptr("USEast"), // ResourceName: to.Ptr("Resource Name 1"), // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("Subscription Name 1"), // UnitPrice: to.Ptr[float64](4.38), // }, // }}, // } } }
Output:
Example (InvoiceSectionUsageDetailsListModern) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListByMCAInvoiceSection.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/BillingAccounts/1234:56789/invoiceSections/98765", &armconsumption.UsageDetailsClientListOptions{Expand: nil, Filter: nil, Skiptoken: nil, Top: nil, Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ // Value: []armconsumption.UsageDetailClassification{ // &armconsumption.ModernUsageDetail{ // Name: to.Ptr("usageDetails_Id1"), // Type: to.Ptr("Microsoft.Consumption/usageDetails"), // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234:56789/invoiceSections/98765/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Kind: to.Ptr(armconsumption.UsageDetailsKindModern), // Properties: &armconsumption.ModernUsageDetailProperties{ // AdditionalInfo: to.Ptr("{ \"UsageType\": \"ComputeHR\", \"ImageType\": \"Windows Client BYOL\", \"ServiceType\": \"Standard_D1\", \"VMName\": null, \"VMProperties\": null, \"VCPUs\": 1, \"CPUs\": 0}"), // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), // BillingAccountID: to.Ptr("1234:56789"), // BillingAccountName: to.Ptr("Account Name 1"), // BillingCurrencyCode: to.Ptr("USD"), // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00.000Z"); return t}()), // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.000Z"); return t}()), // BillingProfileID: to.Ptr("2468"), // BillingProfileName: to.Ptr("Account Name 1"), // ChargeType: to.Ptr("Usage"), // ConsumedService: to.Ptr("Microsoft.Storage"), // CostCenter: to.Ptr("DEV"), // CostInBillingCurrency: to.Ptr[float64](1.84763819095477), // CostInPricingCurrency: to.Ptr[float64](1.84763819095477), // CostInUSD: to.Ptr[float64](1.84763819095477), // CustomerName: to.Ptr("Modern Azure Customer 1"), // CustomerTenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-30T00:00:00.000Z"); return t}()), // ExchangeRate: to.Ptr("1"), // ExchangeRateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.000Z"); return t}()), // ExchangeRatePricingToBilling: to.Ptr[float64](0.077), // Frequency: to.Ptr("UsageBased"), // InstanceName: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), // InvoiceID: to.Ptr(""), // InvoiceSectionID: to.Ptr("98765"), // InvoiceSectionName: to.Ptr("Invoice Section 1"), // IsAzureCreditEligible: to.Ptr(false), // MarketPrice: to.Ptr[float64](0.077), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // PartnerEarnedCreditApplied: to.Ptr("0"), // PartnerEarnedCreditRate: to.Ptr[float64](0.077), // PartnerName: to.Ptr("Partner Name 1"), // PartnerTenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), // PaygCostInBillingCurrency: to.Ptr[float64](1.848), // PaygCostInUSD: to.Ptr[float64](1.848), // PreviousInvoiceID: to.Ptr(""), // PricingCurrencyCode: to.Ptr("USD"), // Product: to.Ptr("Virtual Machines D Series - D1 - US East"), // ProductIdentifier: to.Ptr("DZH318Z0BQ4B00FV"), // ProductOrderID: to.Ptr("a3db7880-70eb-4b4c-6a79-1425a058df5a"), // ProductOrderName: to.Ptr("Azure plan"), // PublisherID: to.Ptr(""), // PublisherName: to.Ptr("Microsoft"), // PublisherType: to.Ptr("Microsoft"), // Quantity: to.Ptr[float64](0.7329), // ResellerMpnID: to.Ptr(""), // ResellerName: to.Ptr("Reseller Name 1"), // ReservationID: to.Ptr(""), // ReservationName: to.Ptr(""), // ResourceGroup: to.Ptr("Resource Group 1"), // ResourceLocation: to.Ptr("USEast"), // ResourceLocationNormalized: to.Ptr("US East"), // ServiceInfo1: to.Ptr(""), // ServiceInfo2: to.Ptr("Windows Client BYOL"), // ServicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T00:00:00.000Z"); return t}()), // ServicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.000Z"); return t}()), // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("Subscription Name 1"), // Term: to.Ptr(""), // UnitPrice: to.Ptr[float64](4.38), // }, // }}, // } } }
Output:
Example (ManagementGroupUsageDetailsListForBillingPeriodLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListForBillingPeriodByManagementGroup.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewUsageDetailsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.UsageDetailsClientListOptions{Expand: nil, Filter: nil, Skiptoken: nil, Top: nil, Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ // Value: []armconsumption.UsageDetailClassification{ // &armconsumption.LegacyUsageDetail{ // Name: to.Ptr("usageDetails_Id1"), // Type: to.Ptr("Microsoft.Consumption/usageDetails"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), // Properties: &armconsumption.LegacyUsageDetailProperties{ // AccountName: to.Ptr("Account Name 1"), // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), // BillingAccountID: to.Ptr("xxxxxxxx"), // BillingAccountName: to.Ptr("Account Name 1"), // BillingCurrency: to.Ptr("CAD"), // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.000Z"); return t}()), // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.000Z"); return t}()), // BillingProfileID: to.Ptr("xxxxxxxx"), // BillingProfileName: to.Ptr("Account Name 1"), // ChargeType: to.Ptr("Usage"), // ConsumedService: to.Ptr("Microsoft.Storage"), // Cost: to.Ptr[float64](0.000342194841184), // CostCenter: to.Ptr("DEV"), // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.000Z"); return t}()), // EffectivePrice: to.Ptr[float64](0.010534556373432), // InvoiceSection: to.Ptr("Invoice Section 1"), // IsAzureCreditEligible: to.Ptr(false), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferID: to.Ptr("Offer Id 1"), // PartNumber: to.Ptr("Part Number 1"), // Product: to.Ptr("Product Name 1"), // Quantity: to.Ptr[float64](0.8234), // ResourceGroup: to.Ptr("Resource Group 1"), // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), // ResourceLocation: to.Ptr("USEast"), // ResourceName: to.Ptr("Resource Name 1"), // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("Subscription Name 1"), // UnitPrice: to.Ptr[float64](3.74), // }, // }, // &armconsumption.LegacyUsageDetail{ // Name: to.Ptr("usageDetails_Id2"), // Type: to.Ptr("Microsoft.Consumption/usageDetails"), // ID: to.Ptr("/scope/providers/Microsoft.Billing/billingPeriods/billingPeriodName/providers/Microsoft.Consumption/usageDetails/usageDetails_Id2"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), // Properties: &armconsumption.LegacyUsageDetailProperties{ // AccountName: to.Ptr("Account Name 2"), // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), // BillingAccountID: to.Ptr("xxxxxxxx"), // BillingAccountName: to.Ptr("Account Name 2"), // BillingCurrency: to.Ptr("CAD"), // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.000Z"); return t}()), // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.000Z"); return t}()), // BillingProfileID: to.Ptr("xxxxxxxx"), // BillingProfileName: to.Ptr("Account Name 2"), // ChargeType: to.Ptr("UnusedReservation"), // ConsumedService: to.Ptr("Microsoft.Storage"), // Cost: to.Ptr[float64](0.000821821271948), // CostCenter: to.Ptr("DEV"), // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.000Z"); return t}()), // EffectivePrice: to.Ptr[float64](0.073488920944598), // InvoiceSection: to.Ptr("Invoice Section 2"), // IsAzureCreditEligible: to.Ptr(false), // MeterID: to.Ptr("11111111-1111-1111-1111-111111111111"), // OfferID: to.Ptr("Offer Id 2"), // PartNumber: to.Ptr("Part Number 2"), // Product: to.Ptr("Product Name 2"), // Quantity: to.Ptr[float64](0.4759), // ResourceGroup: to.Ptr("Resource Group 2"), // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 2/providers/Microsoft.Storage/storageAccounts/Resource Name 2"), // ResourceLocation: to.Ptr("USEast"), // ResourceName: to.Ptr("Resource Name 2"), // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("Subscription Name 2"), // UnitPrice: to.Ptr[float64](5.74), // }, // }}, // } } }
Output:
Example (ManagementGroupUsageDetailsListLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListByManagementGroup.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewUsageDetailsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.UsageDetailsClientListOptions{Expand: nil, Filter: nil, Skiptoken: nil, Top: nil, Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ // Value: []armconsumption.UsageDetailClassification{ // &armconsumption.LegacyUsageDetail{ // Name: to.Ptr("usageDetails_Id1"), // Type: to.Ptr("Microsoft.Consumption/usageDetails"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), // Properties: &armconsumption.LegacyUsageDetailProperties{ // AccountName: to.Ptr("Account Name 1"), // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), // BillingAccountID: to.Ptr("xxxxxxxx"), // BillingAccountName: to.Ptr("Account Name 1"), // BillingCurrency: to.Ptr("CAD"), // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.000Z"); return t}()), // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.000Z"); return t}()), // BillingProfileID: to.Ptr("xxxxxxxx"), // BillingProfileName: to.Ptr("Account Name 1"), // ChargeType: to.Ptr("Usage"), // ConsumedService: to.Ptr("Microsoft.Storage"), // Cost: to.Ptr[float64](0.000342194841184), // CostCenter: to.Ptr("DEV"), // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.000Z"); return t}()), // EffectivePrice: to.Ptr[float64](0.010534556373432), // InvoiceSection: to.Ptr("Invoice Section 1"), // IsAzureCreditEligible: to.Ptr(false), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferID: to.Ptr("Offer Id 1"), // PartNumber: to.Ptr("Part Number 1"), // Product: to.Ptr("Product Name 1"), // Quantity: to.Ptr[float64](0.8234), // ResourceGroup: to.Ptr("Resource Group 1"), // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), // ResourceLocation: to.Ptr("USEast"), // ResourceName: to.Ptr("Resource Name 1"), // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("Subscription Name 1"), // UnitPrice: to.Ptr[float64](3.74), // }, // }, // &armconsumption.LegacyUsageDetail{ // Name: to.Ptr("usageDetails_Id2"), // Type: to.Ptr("Microsoft.Consumption/usageDetails"), // ID: to.Ptr("/scope/providers/Microsoft.Billing/billingPeriods/20180801/providers/Microsoft.Consumption/usageDetails/usageDetails_Id2"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), // Properties: &armconsumption.LegacyUsageDetailProperties{ // AccountName: to.Ptr("Account Name 1"), // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), // BillingAccountID: to.Ptr("xxxxxxxx"), // BillingAccountName: to.Ptr("Account Name 2"), // BillingCurrency: to.Ptr("CAD"), // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.000Z"); return t}()), // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.000Z"); return t}()), // BillingProfileID: to.Ptr("xxxxxxxx"), // BillingProfileName: to.Ptr("Account Name 2"), // ChargeType: to.Ptr("Usage"), // ConsumedService: to.Ptr("Microsoft.Storage"), // Cost: to.Ptr[float64](0.000295194820065), // CostCenter: to.Ptr("DEV"), // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.000Z"); return t}()), // EffectivePrice: to.Ptr[float64](0.000402776395232), // InvoiceSection: to.Ptr("Invoice Section 2"), // IsAzureCreditEligible: to.Ptr(false), // MeterID: to.Ptr("11111111-1111-1111-1111-111111111111"), // OfferID: to.Ptr("Offer Id 2"), // PartNumber: to.Ptr("Part Number 2"), // Product: to.Ptr("Product Name 2"), // Quantity: to.Ptr[float64](0.7329), // ResourceGroup: to.Ptr("Resource Group 2"), // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 2/providers/Microsoft.Storage/storageAccounts/Resource Name 2"), // ResourceLocation: to.Ptr("USEast"), // ResourceName: to.Ptr("Resource Name 2"), // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("Subscription Name 1"), // UnitPrice: to.Ptr[float64](4.38), // }, // }}, // } } }
Output:
Example (UsageDetailsExpandLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsExpand.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewUsageDetailsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.UsageDetailsClientListOptions{Expand: to.Ptr("meterDetails,additionalInfo"), Filter: to.Ptr("tags eq 'dev:tools'"), Skiptoken: nil, Top: to.Ptr[int32](1), Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ // Value: []armconsumption.UsageDetailClassification{ // &armconsumption.LegacyUsageDetail{ // Name: to.Ptr("usageDetails_Id1"), // Type: to.Ptr("Microsoft.Consumption/usageDetails"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), // Properties: &armconsumption.LegacyUsageDetailProperties{ // AccountName: to.Ptr("Account Name 1"), // AdditionalInfo: to.Ptr("{\"MyType\":\"\",\"ServiceType\":\"\",\"VMName\":\"\",\"UsageType\":\"MyUsage\"}"), // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), // BillingAccountID: to.Ptr("xxxxxxxx"), // BillingAccountName: to.Ptr("Account Name 1"), // BillingCurrency: to.Ptr("CAD"), // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.000Z"); return t}()), // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.000Z"); return t}()), // BillingProfileID: to.Ptr("xxxxxxxx"), // BillingProfileName: to.Ptr("Account Name 1"), // ChargeType: to.Ptr("Usage"), // ConsumedService: to.Ptr("Microsoft.Storage"), // Cost: to.Ptr[float64](0.000342194841184), // CostCenter: to.Ptr("DEV"), // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.000Z"); return t}()), // EffectivePrice: to.Ptr[float64](0.010464556322455), // Frequency: to.Ptr("UsageBased"), // InvoiceSection: to.Ptr("Invoice Section 1"), // IsAzureCreditEligible: to.Ptr(false), // MeterDetails: &armconsumption.MeterDetailsResponse{ // MeterCategory: to.Ptr("Networking"), // MeterName: to.Ptr("Data Transfer Out (GB)"), // MeterSubCategory: to.Ptr("ExpressRoute"), // ServiceFamily: to.Ptr("Compute"), // UnitOfMeasure: to.Ptr("GB"), // }, // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferID: to.Ptr("Offer Id 1"), // PartNumber: to.Ptr("Part Number 1"), // Product: to.Ptr("Product Name 1"), // Quantity: to.Ptr[float64](0.8234), // ResourceGroup: to.Ptr("Resource Group 1"), // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), // ResourceLocation: to.Ptr("USEast"), // ResourceName: to.Ptr("Resource Name 1"), // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("Subscription Name 1"), // UnitPrice: to.Ptr[float64](3.54), // }, // }}, // } } }
Output:
Example (UsageDetailsListByMetricActualCostLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListByMetricActualCost.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewUsageDetailsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.UsageDetailsClientListOptions{Expand: nil, Filter: nil, Skiptoken: nil, Top: nil, Metric: to.Ptr(armconsumption.MetrictypeActualCostMetricType), }) 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ // Value: []armconsumption.UsageDetailClassification{ // &armconsumption.LegacyUsageDetail{ // Name: to.Ptr("usageDetails_Id1"), // Type: to.Ptr("Microsoft.Consumption/usageDetails"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), // Properties: &armconsumption.LegacyUsageDetailProperties{ // AccountName: to.Ptr("AccountName"), // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), // BillingAccountID: to.Ptr("xxxxxxxx"), // BillingAccountName: to.Ptr("Customer Name 1"), // BillingCurrency: to.Ptr("CAD"), // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-30T00:00:00.000Z"); return t}()), // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-01T00:00:00.000Z"); return t}()), // BillingProfileID: to.Ptr("xxxxxxxx"), // BillingProfileName: to.Ptr("Customer Name 1"), // ChargeType: to.Ptr("Usage"), // ConsumedService: to.Ptr("Microsoft.ClassicStorage"), // Cost: to.Ptr[float64](0.000001968949998), // CostCenter: to.Ptr("BAS"), // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-09T00:00:00.000Z"); return t}()), // EffectivePrice: to.Ptr[float64](0.054693055510767), // InvoiceSection: to.Ptr("Invoice Section 1"), // IsAzureCreditEligible: to.Ptr(false), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferID: to.Ptr("Offer Id 1"), // PartNumber: to.Ptr("Part Number 1"), // Product: to.Ptr("Product1"), // Quantity: to.Ptr[float64](0.000036), // ResourceGroup: to.Ptr("Resource-Group-westus"), // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource-Group-westus/providers/Microsoft.ClassicStorage/storageAccounts/ResourceName1"), // ResourceLocation: to.Ptr("uswest"), // ResourceName: to.Ptr("ResourceName1"), // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("SubscriptionName 1"), // UnitPrice: to.Ptr[float64](5.47), // }, // }}, // } } }
Output:
Example (UsageDetailsListByMetricAmortizedCostLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListByMetricAmortizedCost.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewUsageDetailsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.UsageDetailsClientListOptions{Expand: nil, Filter: nil, Skiptoken: nil, Top: nil, Metric: to.Ptr(armconsumption.MetrictypeAmortizedCostMetricType), }) 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ // Value: []armconsumption.UsageDetailClassification{ // &armconsumption.LegacyUsageDetail{ // Name: to.Ptr("usageDetails_Id1"), // Type: to.Ptr("Microsoft.Consumption/usageDetails"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), // Properties: &armconsumption.LegacyUsageDetailProperties{ // AccountName: to.Ptr("AccountName"), // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), // BillingAccountID: to.Ptr("xxxxxxxx"), // BillingAccountName: to.Ptr("Customer Name 1"), // BillingCurrency: to.Ptr("CAD"), // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-30T00:00:00.000Z"); return t}()), // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-01T00:00:00.000Z"); return t}()), // BillingProfileID: to.Ptr("xxxxxxxx"), // BillingProfileName: to.Ptr("Customer Name 1"), // ChargeType: to.Ptr("Usage"), // ConsumedService: to.Ptr("Microsoft.ClassicStorage"), // Cost: to.Ptr[float64](0.000001968949998), // CostCenter: to.Ptr("BAS"), // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-09T00:00:00.000Z"); return t}()), // EffectivePrice: to.Ptr[float64](0.054693055510767), // Frequency: to.Ptr("UsageBased"), // InvoiceSection: to.Ptr("Invoice Section 1"), // IsAzureCreditEligible: to.Ptr(false), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferID: to.Ptr("Offer Id 1"), // PartNumber: to.Ptr("Part Number 1"), // Product: to.Ptr("Product1"), // Quantity: to.Ptr[float64](0.000036), // ResourceGroup: to.Ptr("Resource-Group-westus"), // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource-Group-westus/providers/Microsoft.ClassicStorage/storageAccounts/ResourceName1"), // ResourceLocation: to.Ptr("uswest"), // ResourceName: to.Ptr("ResourceName1"), // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("SubscriptionName 1"), // UnitPrice: to.Ptr[float64](5.47), // }, // }}, // } } }
Output:
Example (UsageDetailsListByMetricUsageLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListByMetricUsage.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewUsageDetailsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.UsageDetailsClientListOptions{Expand: nil, Filter: nil, Skiptoken: nil, Top: nil, Metric: to.Ptr(armconsumption.MetrictypeUsageMetricType), }) 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ // Value: []armconsumption.UsageDetailClassification{ // &armconsumption.LegacyUsageDetail{ // Name: to.Ptr("usageDetails_Id1"), // Type: to.Ptr("Microsoft.Consumption/usageDetails"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), // Properties: &armconsumption.LegacyUsageDetailProperties{ // AccountName: to.Ptr("AccountName"), // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), // BillingAccountID: to.Ptr("xxxxxxxx"), // BillingAccountName: to.Ptr("Customer Name 1"), // BillingCurrency: to.Ptr("CAD"), // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-30T00:00:00.000Z"); return t}()), // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-01T00:00:00.000Z"); return t}()), // BillingProfileID: to.Ptr("xxxxxxxx"), // BillingProfileName: to.Ptr("Customer Name 1"), // ChargeType: to.Ptr("Usage"), // ConsumedService: to.Ptr("Microsoft.ClassicStorage"), // Cost: to.Ptr[float64](0.000001968949998), // CostCenter: to.Ptr("BAS"), // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-09T00:00:00.000Z"); return t}()), // EffectivePrice: to.Ptr[float64](0.054693055510767), // InvoiceSection: to.Ptr("Invoice Section 1"), // IsAzureCreditEligible: to.Ptr(false), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferID: to.Ptr("Offer Id 1"), // PartNumber: to.Ptr("Part Number 1"), // Product: to.Ptr("Product1"), // Quantity: to.Ptr[float64](0.000036), // ResourceGroup: to.Ptr("Resource-Group-westus"), // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource-Group-westus/providers/Microsoft.ClassicStorage/storageAccounts/ResourceName1"), // ResourceLocation: to.Ptr("uswest"), // ResourceName: to.Ptr("ResourceName1"), // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("SubscriptionName 1"), // UnitPrice: to.Ptr[float64](5.47), // }, // }}, // } } }
Output:
Example (UsageDetailsListFilterByTagLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListFilterByTag.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/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewUsageDetailsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.UsageDetailsClientListOptions{Expand: nil, Filter: to.Ptr("tags eq 'dev:tools'"), Skiptoken: nil, Top: nil, Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ // Value: []armconsumption.UsageDetailClassification{ // &armconsumption.LegacyUsageDetail{ // Name: to.Ptr("usageDetails_Id1"), // Type: to.Ptr("Microsoft.Consumption/usageDetails"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // }, // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), // Properties: &armconsumption.LegacyUsageDetailProperties{ // AccountName: to.Ptr("Account Name 1"), // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), // BillingAccountID: to.Ptr("xxxxxxxx"), // BillingAccountName: to.Ptr("Account Name 1"), // BillingCurrency: to.Ptr("CAD"), // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.000Z"); return t}()), // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.000Z"); return t}()), // BillingProfileID: to.Ptr("xxxxxxxx"), // BillingProfileName: to.Ptr("Account Name 1"), // ChargeType: to.Ptr("Usage"), // ConsumedService: to.Ptr("Microsoft.Storage"), // Cost: to.Ptr[float64](0.000342194841184), // CostCenter: to.Ptr("DEV"), // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.000Z"); return t}()), // EffectivePrice: to.Ptr[float64](0.010534556373432), // InvoiceSection: to.Ptr("Invoice Section 1"), // IsAzureCreditEligible: to.Ptr(false), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferID: to.Ptr("Offer Id 1"), // PartNumber: to.Ptr("Part Number 1"), // Product: to.Ptr("Product Name 1"), // Quantity: to.Ptr[float64](0.8234), // ResourceGroup: to.Ptr("Resource Group 1"), // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), // ResourceLocation: to.Ptr("USEast"), // ResourceName: to.Ptr("Resource Name 1"), // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("Subscription Name 1"), // UnitPrice: to.Ptr[float64](3.74), // }, // }}, // } } }
Output:
Example (UsageDetailsListForBillingPeriodLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListForBillingPeriod.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewUsageDetailsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.UsageDetailsClientListOptions{Expand: nil, Filter: nil, Skiptoken: nil, Top: nil, Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ // Value: []armconsumption.UsageDetailClassification{ // &armconsumption.LegacyUsageDetail{ // Name: to.Ptr("usageDetails_Id1"), // Type: to.Ptr("Microsoft.Consumption/usageDetails"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), // Properties: &armconsumption.LegacyUsageDetailProperties{ // AccountName: to.Ptr("Account Name 1"), // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), // BillingAccountID: to.Ptr("xxxxxxxx"), // BillingAccountName: to.Ptr("Account Name 1"), // BillingCurrency: to.Ptr("CAD"), // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.000Z"); return t}()), // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.000Z"); return t}()), // BillingProfileID: to.Ptr("xxxxxxxx"), // BillingProfileName: to.Ptr("Account Name 1"), // ChargeType: to.Ptr("Usage"), // ConsumedService: to.Ptr("Microsoft.Storage"), // Cost: to.Ptr[float64](0.000342194841184), // CostCenter: to.Ptr("DEV"), // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.000Z"); return t}()), // EffectivePrice: to.Ptr[float64](0.010534556373432), // InvoiceSection: to.Ptr("Invoice Section 1"), // IsAzureCreditEligible: to.Ptr(false), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferID: to.Ptr("Offer Id 1"), // PartNumber: to.Ptr("Part Number 1"), // Product: to.Ptr("Product Name 1"), // Quantity: to.Ptr[float64](0.8234), // ResourceGroup: to.Ptr("Resource Group 1"), // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), // ResourceLocation: to.Ptr("USEast"), // ResourceName: to.Ptr("Resource Name 1"), // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("Subscription Name 1"), // UnitPrice: to.Ptr[float64](3.74), // }, // }}, // } } }
Output:
Example (UsageDetailsListLegacy) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsList.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armconsumption.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewUsageDetailsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.UsageDetailsClientListOptions{Expand: nil, Filter: nil, Skiptoken: nil, Top: nil, Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ // Value: []armconsumption.UsageDetailClassification{ // &armconsumption.LegacyUsageDetail{ // Name: to.Ptr("usageDetails_Id1"), // Type: to.Ptr("Microsoft.Consumption/usageDetails"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), // Tags: map[string]*string{ // "dev": to.Ptr("tools"), // "env": to.Ptr("newcrp"), // }, // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), // Properties: &armconsumption.LegacyUsageDetailProperties{ // AccountName: to.Ptr("AccountName"), // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), // BillingAccountID: to.Ptr("xxxxxxxx"), // BillingAccountName: to.Ptr("Customer Name 1"), // BillingCurrency: to.Ptr("CAD"), // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-30T00:00:00.000Z"); return t}()), // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-01T00:00:00.000Z"); return t}()), // BillingProfileID: to.Ptr("xxxxxxxx"), // BillingProfileName: to.Ptr("Customer Name 1"), // ChargeType: to.Ptr("Usage"), // ConsumedService: to.Ptr("Microsoft.ClassicStorage"), // Cost: to.Ptr[float64](0.000001980949998), // CostCenter: to.Ptr("BAS"), // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-09T00:00:00.000Z"); return t}()), // EffectivePrice: to.Ptr[float64](0.054693034210767), // Frequency: to.Ptr("UsageBased"), // InvoiceSection: to.Ptr("Invoice Section 1"), // IsAzureCreditEligible: to.Ptr(false), // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), // OfferID: to.Ptr("Offer Id 1"), // PartNumber: to.Ptr("Part Number 1"), // Product: to.Ptr("Product1"), // Quantity: to.Ptr[float64](0.000036), // ResourceGroup: to.Ptr("Resource-Group-westus"), // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource-Group-westus/providers/Microsoft.ClassicStorage/storageAccounts/ResourceName1"), // ResourceLocation: to.Ptr("uswest"), // ResourceName: to.Ptr("ResourceName1"), // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), // SubscriptionName: to.Ptr("SubscriptionName 1"), // UnitPrice: to.Ptr[float64](5.47), // }, // }}, // } } }
Output:
type UsageDetailsClientListOptions ¶ added in v0.3.0
type UsageDetailsClientListOptions struct { // May be used to expand the properties/additionalInfo or properties/meterDetails within a list of usage details. By default, // these fields are not included when listing usage details. Expand *string // May be used to filter usageDetails by properties/resourceGroup, properties/resourceName, properties/resourceId, properties/chargeType, // properties/reservationId, properties/publisherType or tags. The // filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter // is a key value pair string where key and value is separated by a colon (:). // PublisherType Filter accepts two values azure and marketplace and it is currently supported for Web Direct Offer Type Filter *string // Allows to select different type of cost/usage records. Metric *Metrictype // 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 usageDetails. Top *int32 }
UsageDetailsClientListOptions contains the optional parameters for the UsageDetailsClient.NewListPager method.
type UsageDetailsClientListResponse ¶ added in v0.3.0
type UsageDetailsClientListResponse struct { // Result of listing usage details. It contains a list of available usage details in reverse chronological order by billing // period. UsageDetailsListResult }
UsageDetailsClientListResponse contains the response from method UsageDetailsClient.NewListPager.
type UsageDetailsKind ¶
type UsageDetailsKind string
UsageDetailsKind - Specifies the kind of usage details.
const ( UsageDetailsKindLegacy UsageDetailsKind = "legacy" UsageDetailsKindModern UsageDetailsKind = "modern" )
func PossibleUsageDetailsKindValues ¶
func PossibleUsageDetailsKindValues() []UsageDetailsKind
PossibleUsageDetailsKindValues returns the possible values for the UsageDetailsKind const type.
type UsageDetailsListResult ¶
type UsageDetailsListResult struct { // READ-ONLY; The link (url) to the next page of results. NextLink *string // READ-ONLY; The list of usage details. Value []UsageDetailClassification }
UsageDetailsListResult - Result of listing usage details. It contains a list of available usage details in reverse chronological order by billing period.
func (UsageDetailsListResult) MarshalJSON ¶
func (u UsageDetailsListResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type UsageDetailsListResult.
func (*UsageDetailsListResult) UnmarshalJSON ¶
func (u *UsageDetailsListResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type UsageDetailsListResult.
Source Files ¶
- aggregatedcost_client.go
- balances_client.go
- budgets_client.go
- build.go
- charges_client.go
- client_factory.go
- constants.go
- credits_client.go
- events_client.go
- interfaces.go
- lots_client.go
- marketplaces_client.go
- models.go
- models_serde.go
- operations_client.go
- options.go
- polymorphic_helpers.go
- pricesheet_client.go
- reservationrecommendationdetails_client.go
- reservationrecommendations_client.go
- reservationsdetails_client.go
- reservationssummaries_client.go
- reservationtransactions_client.go
- response_types.go
- tags_client.go
- time_rfc3339.go
- usagedetails_client.go