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 CreatedByType
- type CreditBalanceSummary
- type CreditSummary
- type CreditSummaryProperties
- type CreditsClient
- type CreditsClientGetOptions
- type CreditsClientGetResponse
- type CultureCode
- type CurrentSpend
- type Datagrain
- 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 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 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
- func (m *ModernReservationRecommendationProperties) GetModernReservationRecommendationProperties() *ModernReservationRecommendationProperties
- func (m ModernReservationRecommendationProperties) MarshalJSON() ([]byte, error)
- func (m *ModernReservationRecommendationProperties) UnmarshalJSON(data []byte) error
- type ModernReservationRecommendationPropertiesClassification
- type ModernReservationTransaction
- type ModernReservationTransactionProperties
- type ModernReservationTransactionsListResult
- type ModernSharedScopeReservationRecommendationProperties
- func (m *ModernSharedScopeReservationRecommendationProperties) GetModernReservationRecommendationProperties() *ModernReservationRecommendationProperties
- func (m ModernSharedScopeReservationRecommendationProperties) MarshalJSON() ([]byte, error)
- func (m *ModernSharedScopeReservationRecommendationProperties) UnmarshalJSON(data []byte) error
- type ModernSingleScopeReservationRecommendationProperties
- func (m *ModernSingleScopeReservationRecommendationProperties) GetModernReservationRecommendationProperties() *ModernReservationRecommendationProperties
- func (m ModernSingleScopeReservationRecommendationProperties) MarshalJSON() ([]byte, error)
- func (m *ModernSingleScopeReservationRecommendationProperties) UnmarshalJSON(data []byte) error
- type ModernUsageDetail
- type ModernUsageDetailProperties
- type Notification
- type Operation
- type OperationDisplay
- type OperationListResult
- type OperationStatus
- type OperationStatusType
- type OperationsClient
- type OperationsClientListOptions
- type OperationsClientListResponse
- type OperatorType
- type OrganizationType
- type PriceSheetClient
- func (client *PriceSheetClient) BeginDownloadByBillingAccountPeriod(ctx context.Context, billingAccountID string, billingPeriodName string, ...) (*runtime.Poller[PriceSheetClientDownloadByBillingAccountPeriodResponse], error)
- func (client *PriceSheetClient) Get(ctx context.Context, options *PriceSheetClientGetOptions) (PriceSheetClientGetResponse, error)
- func (client *PriceSheetClient) GetByBillingPeriod(ctx context.Context, billingPeriodName string, ...) (PriceSheetClientGetByBillingPeriodResponse, error)
- type PriceSheetClientBeginDownloadByBillingAccountPeriodOptions
- type PriceSheetClientDownloadByBillingAccountPeriodResponse
- type PriceSheetClientGetByBillingPeriodOptions
- type PriceSheetClientGetByBillingPeriodResponse
- type PriceSheetClientGetOptions
- type PriceSheetClientGetResponse
- type PriceSheetModel
- type PriceSheetProperties
- type PriceSheetResult
- type PricesheetDownloadProperties
- type PricingModelType
- 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 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 SKUProperty
- type SavingsPlan
- type Scope
- type Status
- type SystemData
- 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 (EventsGetByBillingAccountContributor)
- EventsClient.NewListByBillingAccountPager (EventsGetByBillingAccountPrimary)
- EventsClient.NewListByBillingAccountPager (EventsGetByBillingAccountWithFilters)
- EventsClient.NewListByBillingAccountPager (EventsGetByBillingAccountWithFiltersContributorJson)
- EventsClient.NewListByBillingAccountPager (EventsGetByBillingAccountWithFiltersPrimary)
- EventsClient.NewListByBillingProfilePager
- LotsClient.NewListByBillingAccountPager (LotsListByBillingAccount)
- LotsClient.NewListByBillingAccountPager (LotsListByBillingAccountContributor)
- LotsClient.NewListByBillingAccountPager (LotsListByBillingAccountPrimary)
- LotsClient.NewListByBillingAccountPager (LotsListByBillingAccountWithStatusFilter)
- LotsClient.NewListByBillingAccountPager (LotsListByBillingAccountWithStatusFilterContributor)
- LotsClient.NewListByBillingAccountPager (LotsListByBillingAccountWithStatusFilterPrimary)
- 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.BeginDownloadByBillingAccountPeriod
- PriceSheetClient.Get
- PriceSheetClient.GetByBillingPeriod (PriceSheetExpand)
- PriceSheetClient.GetByBillingPeriod (PriceSheetForBillingPeriod)
- ReservationRecommendationDetailsClient.Get (ReservationRecommendationsByBillingAccountLegacy)
- ReservationRecommendationDetailsClient.Get (ReservationRecommendationsByBillingProfileModern)
- ReservationRecommendationDetailsClient.Get (ReservationRecommendationsByResourceGroupLegacy)
- ReservationRecommendationDetailsClient.Get (ReservationRecommendationsBySubscriptionLegacy)
- ReservationRecommendationsClient.NewListPager (ReservationRecommendationsByBillingAccountFilterForScope)
- 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.
Generated from API version 2024-08-01
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 - Contains optional client configuration. 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.
- managementGroupID - Order Id of the reservation
- options - AggregatedCostClientGetByManagementGroupOptions contains the optional parameters for the AggregatedCostClient.GetByManagementGroup method.
Example (AggregatedCostByManagementGroup) ¶
Generated from example definition: 2024-08-01/AggregatedCostByManagementGroup.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewAggregatedCostClient().GetByManagementGroup(ctx, "managementGroupForTest", 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 = armconsumption.AggregatedCostClientGetByManagementGroupResponse{
// 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, "2024-08-01T00:00:00.0000000Z"); return t}()),
// UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T00:00:00.0000000Z"); 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, "2024-08-01T00:00:00.0000000Z"); return t}()),
// UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T00:00:00.0000000Z"); return t}()),
// },
// },
// }
}
Output:
Example (AggregatedCostByManagementGroupFilterByDate) ¶
Generated from example definition: 2024-08-01/AggregatedCostByManagementGroupFilterByDate.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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 = armconsumption.AggregatedCostClientGetByManagementGroupResponse{
// 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.0000000Z"); return t}()),
// UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-15T00:00:00.0000000Z"); 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.0000000Z"); return t}()),
// UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-15T00:00:00.0000000Z"); 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.
- managementGroupID - Order Id of the reservation
- billingPeriodName - Billing Period Name.
- options - AggregatedCostClientGetForBillingPeriodByManagementGroupOptions contains the optional parameters for the AggregatedCostClient.GetForBillingPeriodByManagementGroup method.
Example ¶
Generated from example definition: 2024-08-01/AggregatedCostForBillingPeriodByManagementGroup.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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 = armconsumption.AggregatedCostClientGetForBillingPeriodByManagementGroupResponse{
// 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.0000000Z"); return t}()),
// UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-07-01T00:00:00.0000000Z"); 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.0000000Z"); return t}()),
// UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-07-01T00:00:00.0000000Z"); return t}()),
// },
// },
// }
}
Output:
type AggregatedCostClientGetByManagementGroupOptions ¶
type AggregatedCostClientGetByManagementGroupOptions struct {
// Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge'
Filter *string
}
AggregatedCostClientGetByManagementGroupOptions contains the optional parameters for the AggregatedCostClient.GetByManagementGroup method.
type AggregatedCostClientGetByManagementGroupResponse ¶
type AggregatedCostClientGetByManagementGroupResponse struct {
// A management group aggregated cost resource.
ManagementGroupAggregatedCostResult
}
AggregatedCostClientGetByManagementGroupResponse contains the response from method AggregatedCostClient.GetByManagementGroup.
type AggregatedCostClientGetForBillingPeriodByManagementGroupOptions ¶
type AggregatedCostClientGetForBillingPeriodByManagementGroupOptions struct {
}
AggregatedCostClientGetForBillingPeriodByManagementGroupOptions contains the optional parameters for the AggregatedCostClient.GetForBillingPeriodByManagementGroup method.
type AggregatedCostClientGetForBillingPeriodByManagementGroupResponse ¶
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 ¶
MarshalJSON implements the json.Marshaller interface for type Amount.
func (*Amount) UnmarshalJSON ¶
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 ¶
func (a AmountWithExchangeRate) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AmountWithExchangeRate.
func (*AmountWithExchangeRate) UnmarshalJSON ¶
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; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; Resource tags.
Tags map[string]*string
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
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; Overage Refunds
OverageRefund *float64
// 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 ¶
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 ¶
func (b BalancePropertiesAdjustmentDetailsItem) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BalancePropertiesAdjustmentDetailsItem.
func (*BalancePropertiesAdjustmentDetailsItem) UnmarshalJSON ¶
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 ¶
func (b BalancePropertiesNewPurchasesDetailsItem) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BalancePropertiesNewPurchasesDetailsItem.
func (*BalancePropertiesNewPurchasesDetailsItem) UnmarshalJSON ¶
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.
Generated from API version 2024-08-01
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 - Contains optional client configuration. 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.
- billingAccountID - BillingAccount ID
- options - BalancesClientGetByBillingAccountOptions contains the optional parameters for the BalancesClient.GetByBillingAccount method.
Example ¶
Generated from example definition: 2024-08-01/BalancesByBillingAccount.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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 = armconsumption.BalancesClientGetByBillingAccountResponse{
// 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),
// },
// },
// OverageRefund: to.Ptr[float64](2012.61),
// 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.
- billingAccountID - BillingAccount ID
- billingPeriodName - Billing Period Name.
- options - BalancesClientGetForBillingPeriodByBillingAccountOptions contains the optional parameters for the BalancesClient.GetForBillingPeriodByBillingAccount method.
Example ¶
Generated from example definition: 2024-08-01/BalancesByBillingAccountForBillingPeriod.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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 = armconsumption.BalancesClientGetForBillingPeriodByBillingAccountResponse{
// 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),
// },
// },
// OverageRefund: to.Ptr[float64](2012.61),
// 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 ¶
type BalancesClientGetByBillingAccountOptions struct {
}
BalancesClientGetByBillingAccountOptions contains the optional parameters for the BalancesClient.GetByBillingAccount method.
type BalancesClientGetByBillingAccountResponse ¶
type BalancesClientGetByBillingAccountResponse struct {
// A balance resource.
Balance
}
BalancesClientGetByBillingAccountResponse contains the response from method BalancesClient.GetByBillingAccount.
type BalancesClientGetForBillingPeriodByBillingAccountOptions ¶
type BalancesClientGetForBillingPeriodByBillingAccountOptions struct {
}
BalancesClientGetForBillingPeriodByBillingAccountOptions contains the optional parameters for the BalancesClient.GetForBillingPeriodByBillingAccount method.
type BalancesClientGetForBillingPeriodByBillingAccountResponse ¶
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; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type *string
}
Budget - A budget resource.
func (Budget) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface for type Budget.
func (*Budget) UnmarshalJSON ¶
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 ¶
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 ¶
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 ¶
func (b BudgetFilterProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BudgetFilterProperties.
func (*BudgetFilterProperties) UnmarshalJSON ¶
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 ¶
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.
Generated from API version 2024-08-01
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 - Contains optional client configuration. 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.
- scope - The fully qualified Azure Resource manager identifier of the resource.
- 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: 2024-08-01/CreateOrUpdateBudget.json
package main
import (
"context"
"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/v2"
"log"
"time"
)
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("", 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:00Z"); return t }()),
StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-01T00:00:00Z"); 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 = armconsumption.BudgetsClientCreateOrUpdateResponse{
// 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:00Z"); return t}()),
// StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-01T00:00:00Z"); 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.
- scope - The fully qualified Azure Resource manager identifier of the resource.
- budgetName - Budget Name.
- options - BudgetsClientDeleteOptions contains the optional parameters for the BudgetsClient.Delete method.
Example ¶
Generated from example definition: 2024-08-01/DeleteBudget.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, 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)
}
// 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 = armconsumption.BudgetsClientDeleteResponse{
// }
}
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.
- scope - The fully qualified Azure Resource manager identifier of the resource.
- budgetName - Budget Name.
- options - BudgetsClientGetOptions contains the optional parameters for the BudgetsClient.Get method.
Example ¶
Generated from example definition: 2024-08-01/Budget.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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 = armconsumption.BudgetsClientGetResponse{
// 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:00Z"); return t}()),
// StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-01T00:00:00Z"); return t}()),
// },
// },
// },
// }
}
Output:
func (*BudgetsClient) NewListPager ¶
func (client *BudgetsClient) NewListPager(scope string, options *BudgetsClientListOptions) *runtime.Pager[BudgetsClientListResponse]
NewListPager - Lists all budgets for the defined scope.
- scope - The fully qualified Azure Resource manager identifier of the resource.
- options - BudgetsClientListOptions contains the optional parameters for the BudgetsClient.NewListPager method.
Example ¶
Generated from example definition: 2024-08-01/BudgetsList.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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 = armconsumption.BudgetsClientListResponse{
// 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),
// ThresholdType: to.Ptr(armconsumption.ThresholdTypeActual),
// },
// "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: 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:00Z"); return t}()),
// StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-01T00:00:00Z"); 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),
// 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:00Z"); return t}()),
// StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-01T00:00:00Z"); return t}()),
// },
// },
// },
// },
// },
// }
}
}
Output:
type BudgetsClientCreateOrUpdateOptions ¶
type BudgetsClientCreateOrUpdateOptions struct {
}
BudgetsClientCreateOrUpdateOptions contains the optional parameters for the BudgetsClient.CreateOrUpdate method.
type BudgetsClientCreateOrUpdateResponse ¶
type BudgetsClientCreateOrUpdateResponse struct {
// A budget resource.
Budget
}
BudgetsClientCreateOrUpdateResponse contains the response from method BudgetsClient.CreateOrUpdate.
type BudgetsClientDeleteOptions ¶
type BudgetsClientDeleteOptions struct {
}
BudgetsClientDeleteOptions contains the optional parameters for the BudgetsClient.Delete method.
type BudgetsClientDeleteResponse ¶
type BudgetsClientDeleteResponse struct {
}
BudgetsClientDeleteResponse contains the response from method BudgetsClient.Delete.
type BudgetsClientGetOptions ¶
type BudgetsClientGetOptions struct {
}
BudgetsClientGetOptions contains the optional parameters for the BudgetsClient.Get method.
type BudgetsClientGetResponse ¶
type BudgetsClientGetResponse struct {
// A budget resource.
Budget
}
BudgetsClientGetResponse contains the response from method BudgetsClient.Get.
type BudgetsClientListOptions ¶
type BudgetsClientListOptions struct {
}
BudgetsClientListOptions contains the optional parameters for the BudgetsClient.NewListPager method.
type BudgetsClientListResponse ¶
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 ¶
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; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
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 ¶
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.
Generated from API version 2024-08-01
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 - Contains optional client configuration. 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.
- scope - The fully qualified Azure Resource manager identifier of the resource.
- options - ChargesClientListOptions contains the optional parameters for the ChargesClient.List method.
Example (ChangesForBillingPeriodByDepartmentLegacy) ¶
Generated from example definition: 2024-08-01/ChargesForBillingPeriodByDepartment.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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", 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 = armconsumption.ChargesClientListResponse{
// 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),
// MarketplaceCharges: to.Ptr[float64](100),
// BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/providers/Microsoft.Billing/billingPeriods/201804"),
// ChargesBilledSeparately: to.Ptr[float64](60.9),
// Currency: to.Ptr("USD"),
// UsageEnd: to.Ptr("2018-04-30"),
// UsageStart: to.Ptr("2018-04-01"),
// },
// },
// },
// },
// }
}
Output:
Example (ChangesForBillingPeriodByEnrollmentAccountLegacy) ¶
Generated from example definition: 2024-08-01/ChargesForBillingPeriodByEnrollmentAccount.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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", 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 = armconsumption.ChargesClientListResponse{
// 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),
// MarketplaceCharges: to.Ptr[float64](100),
// BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/providers/Microsoft.Billing/billingPeriods/201804"),
// ChargesBilledSeparately: to.Ptr[float64](60.9),
// Currency: to.Ptr("USD"),
// UsageEnd: to.Ptr("2018-04-30"),
// UsageStart: to.Ptr("2018-04-01"),
// },
// },
// },
// },
// }
}
Output:
Example (ChargesListByBillingAccountGroupByBillingProfileIdModern) ¶
Generated from example definition: 2024-08-01/ChargesListByModernBillingAccountGroupByBillingProfileId.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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{
Apply: to.Ptr("groupby((properties/billingProfileId))"),
EndDate: to.Ptr("2019-09-30"),
StartDate: to.Ptr("2019-09-01")})
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 = armconsumption.ChargesClientListResponse{
// 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: 2024-08-01/ChargesListByModernBillingAccountGroupByCustomerId.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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{
Apply: to.Ptr("groupby((properties/customerId))"),
EndDate: to.Ptr("2019-09-30"),
StartDate: to.Ptr("2019-09-01")})
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 = armconsumption.ChargesClientListResponse{
// 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: 2024-08-01/ChargesListByModernBillingAccountGroupByInvoiceSectionId.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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{
Apply: to.Ptr("groupby((properties/invoiceSectionId))"),
EndDate: to.Ptr("2019-09-30"),
StartDate: to.Ptr("2019-09-01")})
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 = armconsumption.ChargesClientListResponse{
// 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: 2024-08-01/ChargesListByModernBillingAccount.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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{
EndDate: to.Ptr("2019-10-31"),
StartDate: to.Ptr("2019-09-01")})
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 = armconsumption.ChargesClientListResponse{
// 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("2019-09-01"),
// },
// },
// },
// },
// }
}
Output:
Example (ChargesListByBillingProfileGroupByInvoiceSectionIdModern) ¶
Generated from example definition: 2024-08-01/ChargesListByModernBillingProfileGroupByInvoiceSectionId.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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{
Apply: to.Ptr("groupby((properties/invoiceSectionId))"),
EndDate: to.Ptr("2019-09-30"),
StartDate: to.Ptr("2019-09-01")})
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 = armconsumption.ChargesClientListResponse{
// 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: 2024-08-01/ChargesListByModernBillingProfileInvoiceSection.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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{
EndDate: to.Ptr("2019-10-31"),
StartDate: to.Ptr("2019-09-01")})
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 = armconsumption.ChargesClientListResponse{
// 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("2019-09-01"),
// },
// },
// },
// },
// }
}
Output:
Example (ChargesListByBillingProfileModern) ¶
Generated from example definition: 2024-08-01/ChargesListByModernBillingProfile.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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", 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 = armconsumption.ChargesClientListResponse{
// 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("2023-05-31"),
// UsageStart: to.Ptr("2023-03-01"),
// },
// },
// },
// },
// }
}
Output:
Example (ChargesListByCustomerModern) ¶
Generated from example definition: 2024-08-01/ChargesListByModernCustomer.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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", 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 = armconsumption.ChargesClientListResponse{
// 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("2023-05-31"),
// UsageStart: to.Ptr("2023-03-01"),
// },
// },
// },
// },
// }
}
Output:
Example (ChargesListByDepartmentLegacy) ¶
Generated from example definition: 2024-08-01/ChargesListForDepartmentFilterByStartEndDate.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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{
Filter: to.Ptr("usageStart eq '2018-04-01' AND usageEnd eq '2018-05-30'")})
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 = armconsumption.ChargesClientListResponse{
// 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),
// MarketplaceCharges: to.Ptr[float64](100),
// BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/providers/Microsoft.Billing/billingPeriods/201804"),
// ChargesBilledSeparately: to.Ptr[float64](60.9),
// Currency: to.Ptr("USD"),
// UsageEnd: to.Ptr("2018-04-30"),
// UsageStart: to.Ptr("2018-04-01"),
// },
// },
// },
// },
// }
}
Output:
Example (ChargesListByInvoiceSectionIdModern) ¶
Generated from example definition: 2024-08-01/ChargesListByModernInvoiceSectionId.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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", 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 = armconsumption.ChargesClientListResponse{
// 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("2023-05-31"),
// UsageStart: to.Ptr("2023-03-01"),
// },
// },
// },
// },
// }
}
Output:
Example (ChargesListForEnrollmentAccountLegacy) ¶
Generated from example definition: 2024-08-01/ChargesListForEnrollmentAccountFilterByStartEndDate.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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", 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 = armconsumption.ChargesClientListResponse{
// 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),
// MarketplaceCharges: to.Ptr[float64](100),
// BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/providers/Microsoft.Billing/billingPeriods/201804"),
// ChargesBilledSeparately: to.Ptr[float64](60.9),
// Currency: to.Ptr("USD"),
// UsageEnd: to.Ptr("2018-04-30"),
// UsageStart: to.Ptr("2018-04-01"),
// },
// },
// },
// },
// }
}
Output:
type ChargesClientListOptions ¶
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 ¶
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 ¶
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 ¶
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 - The ID of the target subscription. The value must be an UUID.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*ClientFactory) NewAggregatedCostClient ¶
func (c *ClientFactory) NewAggregatedCostClient() *AggregatedCostClient
NewAggregatedCostClient creates a new instance of AggregatedCostClient.
func (*ClientFactory) NewBalancesClient ¶
func (c *ClientFactory) NewBalancesClient() *BalancesClient
NewBalancesClient creates a new instance of BalancesClient.
func (*ClientFactory) NewBudgetsClient ¶
func (c *ClientFactory) NewBudgetsClient() *BudgetsClient
NewBudgetsClient creates a new instance of BudgetsClient.
func (*ClientFactory) NewChargesClient ¶
func (c *ClientFactory) NewChargesClient() *ChargesClient
NewChargesClient creates a new instance of ChargesClient.
func (*ClientFactory) NewCreditsClient ¶
func (c *ClientFactory) NewCreditsClient() *CreditsClient
NewCreditsClient creates a new instance of CreditsClient.
func (*ClientFactory) NewEventsClient ¶
func (c *ClientFactory) NewEventsClient() *EventsClient
NewEventsClient creates a new instance of EventsClient.
func (*ClientFactory) NewLotsClient ¶
func (c *ClientFactory) NewLotsClient() *LotsClient
NewLotsClient creates a new instance of LotsClient.
func (*ClientFactory) NewMarketplacesClient ¶
func (c *ClientFactory) NewMarketplacesClient() *MarketplacesClient
NewMarketplacesClient creates a new instance of MarketplacesClient.
func (*ClientFactory) NewOperationsClient ¶
func (c *ClientFactory) NewOperationsClient() *OperationsClient
NewOperationsClient creates a new instance of OperationsClient.
func (*ClientFactory) NewPriceSheetClient ¶
func (c *ClientFactory) NewPriceSheetClient() *PriceSheetClient
NewPriceSheetClient creates a new instance of PriceSheetClient.
func (*ClientFactory) NewReservationRecommendationDetailsClient ¶
func (c *ClientFactory) NewReservationRecommendationDetailsClient() *ReservationRecommendationDetailsClient
NewReservationRecommendationDetailsClient creates a new instance of ReservationRecommendationDetailsClient.
func (*ClientFactory) NewReservationRecommendationsClient ¶
func (c *ClientFactory) NewReservationRecommendationsClient() *ReservationRecommendationsClient
NewReservationRecommendationsClient creates a new instance of ReservationRecommendationsClient.
func (*ClientFactory) NewReservationTransactionsClient ¶
func (c *ClientFactory) NewReservationTransactionsClient() *ReservationTransactionsClient
NewReservationTransactionsClient creates a new instance of ReservationTransactionsClient.
func (*ClientFactory) NewReservationsDetailsClient ¶
func (c *ClientFactory) NewReservationsDetailsClient() *ReservationsDetailsClient
NewReservationsDetailsClient creates a new instance of ReservationsDetailsClient.
func (*ClientFactory) NewReservationsSummariesClient ¶
func (c *ClientFactory) NewReservationsSummariesClient() *ReservationsSummariesClient
NewReservationsSummariesClient creates a new instance of ReservationsSummariesClient.
func (*ClientFactory) NewTagsClient ¶
func (c *ClientFactory) NewTagsClient() *TagsClient
NewTagsClient creates a new instance of TagsClient.
func (*ClientFactory) NewUsageDetailsClient ¶
func (c *ClientFactory) NewUsageDetailsClient() *UsageDetailsClient
NewUsageDetailsClient creates a new instance of UsageDetailsClient.
type CreatedByType ¶
type CreatedByType string
CreatedByType - The kind of entity that created the resource.
const ( // CreatedByTypeApplication - The entity was created by an application. CreatedByTypeApplication CreatedByType = "Application" // CreatedByTypeKey - The entity was created by a key. CreatedByTypeKey CreatedByType = "Key" // CreatedByTypeManagedIdentity - The entity was created by a managed identity. CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" // CreatedByTypeUser - The entity was created by a user. CreatedByTypeUser CreatedByType = "User" )
func PossibleCreatedByTypeValues ¶
func PossibleCreatedByTypeValues() []CreatedByType
PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type.
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 ¶
func (c CreditBalanceSummary) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type CreditBalanceSummary.
func (*CreditBalanceSummary) UnmarshalJSON ¶
func (c *CreditBalanceSummary) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type CreditBalanceSummary.
type CreditSummary ¶
type CreditSummary 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 credit summary.
Properties *CreditSummaryProperties
// A list of Tag.
Tags map[string]*string
// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
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; If true, the listed details are based on an estimation and it will be subjected to change.
IsEstimatedBalance *bool
// 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 ¶
func (c CreditSummaryProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type CreditSummaryProperties.
func (*CreditSummaryProperties) UnmarshalJSON ¶
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.
Generated from API version 2024-08-01
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 - Contains optional client configuration. 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.
- billingAccountID - BillingAccount ID
- billingProfileID - Azure Billing Profile ID.
- options - CreditsClientGetOptions contains the optional parameters for the CreditsClient.Get method.
Example ¶
Generated from example definition: 2024-08-01/CreditSummaryByBillingProfile.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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 = armconsumption.CreditsClientGetResponse{
// 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),
// },
// IsEstimatedBalance: to.Ptr(false),
// 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 ¶
type CreditsClientGetOptions struct {
}
CreditsClientGetOptions contains the optional parameters for the CreditsClient.Get method.
type CreditsClientGetResponse ¶
type CreditsClientGetResponse struct {
// A credit summary resource.
CreditSummary
}
CreditsClientGetResponse contains the response from method CreditsClient.Get.
type CultureCode ¶
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 ¶
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 ¶
func (c CurrentSpend) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type CurrentSpend.
func (*CurrentSpend) UnmarshalJSON ¶
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 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; Name of the billing account.
BillingAccountDisplayName *string
// READ-ONLY; Identifier of the billing account.
BillingAccountID *string
// 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, Note: This will not be returned for Contributor Organization Type in Multi-Entity
// consumption commitment
ClosedBalance *Amount
// READ-ONLY; The balance in billing currency after the event, Note: This will not be returned for Contributor Organization
// Type in Multi-Entity consumption commitment
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; If true, the listed details are based on an estimation and it will be subjected to change.
IsEstimatedBalance *bool
// 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 {
// The event properties.
Properties *EventProperties
// READ-ONLY; The eTag for the resource.
ETag *string
// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
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 ( EventTypeCreditExpired EventType = "CreditExpired" 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 ¶
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.
Generated from API version 2024-08-01
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 - Contains optional client configuration. Pass nil to accept the default values.
func (*EventsClient) NewListByBillingAccountPager ¶
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.
- billingAccountID - BillingAccount ID
- options - EventsClientListByBillingAccountOptions contains the optional parameters for the EventsClient.NewListByBillingAccountPager method.
Example (EventsGetByBillingAccount) ¶
Generated from example definition: 2024-08-01/EventsGetByBillingAccount.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewEventsClient().NewListByBillingAccountPager("1234:5678", 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 = armconsumption.EventsClientListByBillingAccountResponse{
// 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"),
// BillingAccountDisplayName: to.Ptr("TestBillingAccount"),
// BillingAccountID: to.Ptr("1234:5678"),
// 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:00Z"); 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:00Z"); return t}()),
// },
// },
// },
// },
// }
}
}
Output:
Example (EventsGetByBillingAccountContributor) ¶
Generated from example definition: 2024-08-01/EventsGetByBillingAccount-Contributor.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewEventsClient().NewListByBillingAccountPager("1234:5678", 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 = armconsumption.EventsClientListByBillingAccountResponse{
// 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),
// },
// 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:00Z"); 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),
// },
// 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:00Z"); return t}()),
// },
// },
// },
// },
// }
}
}
Output:
Example (EventsGetByBillingAccountPrimary) ¶
Generated from example definition: 2024-08-01/EventsGetByBillingAccount-Primary.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewEventsClient().NewListByBillingAccountPager("1234:5678", 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 = armconsumption.EventsClientListByBillingAccountResponse{
// 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"),
// BillingAccountDisplayName: to.Ptr("TestBillingAccount"),
// BillingAccountID: to.Ptr("1234:5678"),
// 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:00Z"); 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"),
// BillingAccountDisplayName: to.Ptr("TestBillingAccount"),
// BillingAccountID: to.Ptr("1234:5678"),
// 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:00Z"); return t}()),
// },
// },
// },
// },
// }
}
}
Output:
Example (EventsGetByBillingAccountWithFilters) ¶
Generated from example definition: 2024-08-01/EventsGetByBillingAccountWithFilters.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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 = armconsumption.EventsClientListByBillingAccountResponse{
// 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"),
// BillingAccountDisplayName: to.Ptr("TestBillingAccount"),
// BillingAccountID: to.Ptr("1234:5678"),
// 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:00Z"); return t}()),
// },
// },
// },
// },
// }
}
}
Output:
Example (EventsGetByBillingAccountWithFiltersContributorJson) ¶
Generated from example definition: 2024-08-01/EventsGetByBillingAccountWithFilters-Contributor.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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 = armconsumption.EventsClientListByBillingAccountResponse{
// 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),
// },
// 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:00Z"); return t}()),
// },
// },
// },
// },
// }
}
}
Output:
Example (EventsGetByBillingAccountWithFiltersPrimary) ¶
Generated from example definition: 2024-08-01/EventsGetByBillingAccountWithFilters-Primary.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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 = armconsumption.EventsClientListByBillingAccountResponse{
// 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"),
// BillingAccountDisplayName: to.Ptr("TestBillingAccount"),
// BillingAccountID: to.Ptr("1234:5678"),
// 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:00Z"); return t}()),
// },
// },
// },
// },
// }
}
}
Output:
func (*EventsClient) NewListByBillingProfilePager ¶
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.
- 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: 2024-08-01/EventsListByBillingProfile.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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 = armconsumption.EventsClientListByBillingProfileResponse{
// 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"),
// IsEstimatedBalance: to.Ptr(false),
// 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:00Z"); 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"),
// IsEstimatedBalance: to.Ptr(false),
// 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:00Z"); 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(""),
// IsEstimatedBalance: to.Ptr(false),
// 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:00Z"); 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"),
// IsEstimatedBalance: to.Ptr(false),
// 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, "2019-10-01T00:00:00Z"); return t}()),
// },
// },
// },
// },
// }
}
}
Output:
type EventsClientListByBillingAccountOptions ¶
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 ¶
type EventsClientListByBillingAccountResponse struct {
// Result of listing event summary.
Events
}
EventsClientListByBillingAccountResponse contains the response from method EventsClient.NewListByBillingAccountPager.
type EventsClientListByBillingProfileOptions ¶
type EventsClientListByBillingProfileOptions struct {
}
EventsClientListByBillingProfileOptions contains the optional parameters for the EventsClient.NewListByBillingProfilePager method.
type EventsClientListByBillingProfileResponse ¶
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 ¶
func (f ForecastSpend) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ForecastSpend.
func (*ForecastSpend) UnmarshalJSON ¶
func (f *ForecastSpend) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ForecastSpend.
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; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type *string
}
LegacyChargeSummary - Legacy charge summary.
func (*LegacyChargeSummary) GetChargeSummary ¶
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 ¶
func (l LegacyChargeSummaryProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type LegacyChargeSummaryProperties.
func (*LegacyChargeSummaryProperties) UnmarshalJSON ¶
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; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; Resource location
Location *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Resource sku
SKU *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; Resource tags.
Tags map[string]*string
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type *string
}
LegacyReservationRecommendation - Legacy reservation recommendation.
func (*LegacyReservationRecommendation) GetReservationRecommendation ¶
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 last usage date used for looking back for computing the recommendation.
LastUsageDate *time.Time
// 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; Term period of the reservation. ex: P1M, P1Y or P3Y.
Term *string
// READ-ONLY; The total amount of cost with reserved instances.
TotalCostWithReservedInstances *float64
// READ-ONLY; The total hours for which the cost is covered.
TotalHours *int32
}
LegacyReservationRecommendationProperties - The properties of the reservation recommendation.
func (*LegacyReservationRecommendationProperties) GetLegacyReservationRecommendationProperties ¶
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 ¶
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 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 or Refund).
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 ¶
type LegacySharedScopeReservationRecommendationProperties struct {
Scope *string
CostWithNoReservedInstances *float64
FirstUsageDate *time.Time
InstanceFlexibilityGroup *string
InstanceFlexibilityRatio *float32
LastUsageDate *time.Time
LookBackPeriod *string
MeterID *string
NetSavings *float64
NormalizedSize *string
RecommendedQuantity *float64
RecommendedQuantityNormalized *float32
ResourceType *string
SKUProperties []*SKUProperty
Term *string
TotalCostWithReservedInstances *float64
TotalHours *int32
}
LegacySharedScopeReservationRecommendationProperties - The properties of the legacy reservation recommendation for shared scope.
func (*LegacySharedScopeReservationRecommendationProperties) GetLegacyReservationRecommendationProperties ¶
func (l *LegacySharedScopeReservationRecommendationProperties) GetLegacyReservationRecommendationProperties() *LegacyReservationRecommendationProperties
GetLegacyReservationRecommendationProperties implements the LegacyReservationRecommendationPropertiesClassification interface for type LegacySharedScopeReservationRecommendationProperties.
func (LegacySharedScopeReservationRecommendationProperties) MarshalJSON ¶
func (l LegacySharedScopeReservationRecommendationProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type LegacySharedScopeReservationRecommendationProperties.
func (*LegacySharedScopeReservationRecommendationProperties) UnmarshalJSON ¶
func (l *LegacySharedScopeReservationRecommendationProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type LegacySharedScopeReservationRecommendationProperties.
type LegacySingleScopeReservationRecommendationProperties ¶
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 last usage date used for looking back for computing the recommendation.
LastUsageDate *time.Time
// 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; Term period of the reservation. ex: P1M, P1Y or P3Y.
Term *string
// READ-ONLY; The total amount of cost with reserved instances.
TotalCostWithReservedInstances *float64
// READ-ONLY; The total hours for which the cost is covered.
TotalHours *int32
}
LegacySingleScopeReservationRecommendationProperties - The properties of the legacy reservation recommendation for single scope.
func (*LegacySingleScopeReservationRecommendationProperties) GetLegacyReservationRecommendationProperties ¶
func (l *LegacySingleScopeReservationRecommendationProperties) GetLegacyReservationRecommendationProperties() *LegacyReservationRecommendationProperties
GetLegacyReservationRecommendationProperties implements the LegacyReservationRecommendationPropertiesClassification interface for type LegacySingleScopeReservationRecommendationProperties.
func (LegacySingleScopeReservationRecommendationProperties) MarshalJSON ¶
func (l LegacySingleScopeReservationRecommendationProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type LegacySingleScopeReservationRecommendationProperties.
func (*LegacySingleScopeReservationRecommendationProperties) UnmarshalJSON ¶
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; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; Resource tags.
Tags map[string]*string
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type *string
}
LegacyUsageDetail - Legacy usage detail.
func (*LegacyUsageDetail) GetUsageDetail ¶
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; If true, the listed details are based on an estimation and it will be subjected to change.
IsEstimatedBalance *bool
// READ-ONLY; The organization type of the lot.
OrganizationType *OrganizationType
// READ-ONLY; The original amount of a lot, Note: This will not be returned for Contributor Organization Type in Multi-Entity
// consumption commitment
OriginalAmount *Amount
// READ-ONLY; The original amount of a lot in billing currency, Note: This will not be returned for Contributor Organization
// Type in Multi-Entity consumption commitment
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
// READ-ONLY; Amount consumed from the commitment.
UsedAmount *Amount
}
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; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
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; URL to get the next set of operation list results if there are any.
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 ¶
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.
Generated from API version 2024-08-01
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 - Contains optional client configuration. Pass nil to accept the default values.
func (*LotsClient) NewListByBillingAccountPager ¶
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.
- billingAccountID - BillingAccount ID
- options - LotsClientListByBillingAccountOptions contains the optional parameters for the LotsClient.NewListByBillingAccountPager method.
Example (LotsListByBillingAccount) ¶
Generated from example definition: 2024-08-01/LotsListByBillingAccount.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewLotsClient().NewListByBillingAccountPager("1234:5678", 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 = armconsumption.LotsClientListByBillingAccountResponse{
// 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:00Z"); 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:00Z"); return t}()),
// Source: to.Ptr(armconsumption.LotSourceConsumptionCommitment),
// StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00Z"); 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:00Z"); 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:00Z"); return t}()),
// Source: to.Ptr(armconsumption.LotSourceConsumptionCommitment),
// StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-01T00:00:00Z"); return t}()),
// Status: to.Ptr(armconsumption.StatusExpired),
// },
// },
// },
// },
// }
}
}
Output:
Example (LotsListByBillingAccountContributor) ¶
Generated from example definition: 2024-08-01/LotsListByBillingAccount-Contributor.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewLotsClient().NewListByBillingAccountPager("1234:5678", 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 = armconsumption.LotsClientListByBillingAccountResponse{
// 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{
// OrganizationType: to.Ptr(armconsumption.OrganizationTypeContributorOrganizationType),
// ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-01T00:00:00Z"); return t}()),
// PurchasedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-01T00:00:00Z"); return t}()),
// Source: to.Ptr(armconsumption.LotSourceConsumptionCommitment),
// StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00Z"); return t}()),
// Status: to.Ptr(armconsumption.StatusActive),
// UsedAmount: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float64](550),
// },
// },
// },
// },
// },
// }
}
}
Output:
Example (LotsListByBillingAccountPrimary) ¶
Generated from example definition: 2024-08-01/LotsListByBillingAccount-Primary.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewLotsClient().NewListByBillingAccountPager("1234:5678", 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 = armconsumption.LotsClientListByBillingAccountResponse{
// 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{
// OrganizationType: to.Ptr(armconsumption.OrganizationTypePrimaryOrganizationType),
// 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:00Z"); 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:00Z"); return t}()),
// Source: to.Ptr(armconsumption.LotSourceConsumptionCommitment),
// StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00Z"); return t}()),
// Status: to.Ptr(armconsumption.StatusActive),
// UsedAmount: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float64](550),
// },
// },
// },
// },
// },
// }
}
}
Output:
Example (LotsListByBillingAccountWithStatusFilter) ¶
Generated from example definition: 2024-08-01/LotsListByBillingAccountWithFilters.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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 = armconsumption.LotsClientListByBillingAccountResponse{
// 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:00Z"); 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:00Z"); return t}()),
// Source: to.Ptr(armconsumption.LotSourceConsumptionCommitment),
// StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00Z"); return t}()),
// Status: to.Ptr(armconsumption.StatusActive),
// },
// },
// },
// },
// }
}
}
Output:
Example (LotsListByBillingAccountWithStatusFilterContributor) ¶
Generated from example definition: 2024-08-01/LotsListByBillingAccountWithFilters-Contributor.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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 = armconsumption.LotsClientListByBillingAccountResponse{
// 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{
// OrganizationType: to.Ptr(armconsumption.OrganizationTypeContributorOrganizationType),
// ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-01T00:00:00Z"); return t}()),
// PurchasedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-01T00:00:00Z"); return t}()),
// Source: to.Ptr(armconsumption.LotSourceConsumptionCommitment),
// StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00Z"); return t}()),
// Status: to.Ptr(armconsumption.StatusActive),
// UsedAmount: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float64](550),
// },
// },
// },
// },
// },
// }
}
}
Output:
Example (LotsListByBillingAccountWithStatusFilterPrimary) ¶
Generated from example definition: 2024-08-01/LotsListByBillingAccountWithFilters-Primary.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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 = armconsumption.LotsClientListByBillingAccountResponse{
// 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{
// OrganizationType: to.Ptr(armconsumption.OrganizationTypePrimaryOrganizationType),
// 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:00Z"); 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:00Z"); return t}()),
// Source: to.Ptr(armconsumption.LotSourceConsumptionCommitment),
// StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00Z"); return t}()),
// Status: to.Ptr(armconsumption.StatusActive),
// UsedAmount: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float64](550),
// },
// },
// },
// },
// },
// }
}
}
Output:
func (*LotsClient) NewListByBillingProfilePager ¶
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.
- billingAccountID - BillingAccount ID
- billingProfileID - Azure Billing Profile ID.
- options - LotsClientListByBillingProfileOptions contains the optional parameters for the LotsClient.NewListByBillingProfilePager method.
Example ¶
Generated from example definition: 2024-08-01/LotsListByBillingProfile.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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 = armconsumption.LotsClientListByBillingProfileResponse{
// 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, "2024-08-01T00:00:00Z"); return t}()),
// IsEstimatedBalance: to.Ptr(false),
// 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, "2024-08-01T00:00:00Z"); 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, "2023-05-31T00:00:00Z"); return t}()),
// IsEstimatedBalance: to.Ptr(false),
// 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, "2024-08-01T00:00:00Z"); return t}()),
// },
// },
// },
// },
// }
}
}
Output:
func (*LotsClient) NewListByCustomerPager ¶
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.
- billingAccountID - BillingAccount ID
- customerID - Customer ID
- options - LotsClientListByCustomerOptions contains the optional parameters for the LotsClient.NewListByCustomerPager method.
Example (LotsListByCustomer) ¶
Generated from example definition: 2024-08-01/LotsListByCustomer.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewLotsClient().NewListByCustomerPager("1234:5678", "1234:5678", 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 = armconsumption.LotsClientListByCustomerResponse{
// 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:00Z"); return t}()),
// IsEstimatedBalance: to.Ptr(false),
// 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:00Z"); 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:00Z"); return t}()),
// IsEstimatedBalance: to.Ptr(false),
// 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:00Z"); return t}()),
// },
// },
// },
// },
// }
}
}
Output:
Example (LotsListByCustomerWithFilter) ¶
Generated from example definition: 2024-08-01/LotsListByCustomerWithFilters.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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 = armconsumption.LotsClientListByCustomerResponse{
// 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:00Z"); return t}()),
// IsEstimatedBalance: to.Ptr(false),
// 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:00Z"); return t}()),
// },
// },
// },
// },
// }
}
}
Output:
type LotsClientListByBillingAccountOptions ¶
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 ¶
type LotsClientListByBillingAccountResponse struct {
// Result of listing lot summary.
Lots
}
LotsClientListByBillingAccountResponse contains the response from method LotsClient.NewListByBillingAccountPager.
type LotsClientListByBillingProfileOptions ¶
type LotsClientListByBillingProfileOptions struct {
}
LotsClientListByBillingProfileOptions contains the optional parameters for the LotsClient.NewListByBillingProfilePager method.
type LotsClientListByBillingProfileResponse ¶
type LotsClientListByBillingProfileResponse struct {
// Result of listing lot summary.
Lots
}
LotsClientListByBillingProfileResponse contains the response from method LotsClient.NewListByBillingProfilePager.
type LotsClientListByCustomerOptions ¶
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 ¶
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; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; Resource tags.
Tags map[string]*string
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
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; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; Resource tags.
Tags map[string]*string
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
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.
Generated from API version 2024-08-01
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 - Contains optional client configuration. Pass nil to accept the default values.
func (*MarketplacesClient) NewListPager ¶
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.
- scope - The fully qualified Azure Resource manager identifier of the resource.
- options - MarketplacesClientListOptions contains the optional parameters for the MarketplacesClient.NewListPager method.
Example (BillingAccountMarketplacesList) ¶
Generated from example definition: 2024-08-01/MarketplacesByBillingAccountList.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewMarketplacesClient().NewListPager("providers/Microsoft.Billing/billingAccounts/123456", 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 = armconsumption.MarketplacesClientListResponse{
// 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"),
// 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:59Z"); return t}()),
// UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T00:00:00Z"); return t}()),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (BillingAccountMarketplacesListForBillingPeriod) ¶
Generated from example definition: 2024-08-01/MarketplacesByBillingAccountListForBillingPeriod.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewMarketplacesClient().NewListPager("providers/Microsoft.Billing/billingAccounts/123456", 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 = armconsumption.MarketplacesClientListResponse{
// 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"),
// 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:59Z"); return t}()),
// UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T00:00:00Z"); return t}()),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (DepartmentMarketplacesList) ¶
Generated from example definition: 2024-08-01/MarketplacesByDepartmentList.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewMarketplacesClient().NewListPager("providers/Microsoft.Billing/departments/123456", 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 = armconsumption.MarketplacesClientListResponse{
// 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"),
// 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:59Z"); return t}()),
// UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T00:00:00Z"); return t}()),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (DepartmentMarketplacesListForBillingPeriod) ¶
Generated from example definition: 2024-08-01/MarketplacesByDepartment_ListByBillingPeriod.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewMarketplacesClient().NewListPager("providers/Microsoft.Billing/departments/123456", 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 = armconsumption.MarketplacesClientListResponse{
// 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"),
// 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:59Z"); return t}()),
// UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T00:00:00Z"); return t}()),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (EnrollmentAccountMarketplacesList) ¶
Generated from example definition: 2024-08-01/MarketplacesByEnrollmentAccountList.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewMarketplacesClient().NewListPager("providers/Microsoft.Billing/enrollmentAccounts/123456", 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 = armconsumption.MarketplacesClientListResponse{
// 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"),
// 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:59Z"); return t}()),
// UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T00:00:00Z"); return t}()),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (EnrollmentAccountMarketplacesListForBillingPeriod) ¶
Generated from example definition: 2024-08-01/MarketplacesByEnrollmentAccounts_ListByBillingPeriod.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewMarketplacesClient().NewListPager("providers/Microsoft.Billing/enrollmentAccounts/123456", 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 = armconsumption.MarketplacesClientListResponse{
// 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"),
// 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:59Z"); return t}()),
// UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T00:00:00Z"); return t}()),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (ManagementGroupMarketplacesList) ¶
Generated from example definition: 2024-08-01/MarketplacesByManagementGroupList.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewMarketplacesClient().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 = armconsumption.MarketplacesClientListResponse{
// 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"),
// 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:59Z"); return t}()),
// UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-13T00:00:00Z"); return t}()),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// {
// 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"),
// 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:59Z"); return t}()),
// UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-13T00:00:00Z"); return t}()),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (ManagementGroupMarketplacesListForBillingPeriod) ¶
Generated from example definition: 2024-08-01/MarketplacesByManagementGroup_ListForBillingPeriod.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewMarketplacesClient().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 = armconsumption.MarketplacesClientListResponse{
// 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"),
// 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:59Z"); return t}()),
// UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-13T00:00:00Z"); return t}()),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// {
// 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"),
// 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:59Z"); return t}()),
// UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-13T00:00:00Z"); return t}()),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (SubscriptionMarketplacesList) ¶
Generated from example definition: 2024-08-01/MarketplacesList.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewMarketplacesClient().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 = armconsumption.MarketplacesClientListResponse{
// 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"),
// 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:59Z"); return t}()),
// UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T00:00:00Z"); return t}()),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (SubscriptionMarketplacesListForBillingPeriod) ¶
Generated from example definition: 2024-08-01/MarketplacesListForBillingPeriod.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewMarketplacesClient().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 = armconsumption.MarketplacesClientListResponse{
// 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"),
// 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:59Z"); return t}()),
// UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T00:00:00Z"); return t}()),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
type MarketplacesClientListOptions ¶
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 ¶
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 ¶
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 ¶
func (m MeterDetails) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MeterDetails.
func (*MeterDetails) UnmarshalJSON ¶
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 ¶
func (m MeterDetailsResponse) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MeterDetailsResponse.
func (*MeterDetailsResponse) UnmarshalJSON ¶
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; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type *string
}
ModernChargeSummary - Modern charge summary.
func (*ModernChargeSummary) GetChargeSummary ¶
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; Subscription guid.
SubscriptionID *string
// READ-ONLY; Usage end date.
UsageEnd *string
// READ-ONLY; Usage start date.
UsageStart *string
}
ModernChargeSummaryProperties - The properties of modern charge summary.
func (ModernChargeSummaryProperties) MarshalJSON ¶
func (m ModernChargeSummaryProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ModernChargeSummaryProperties.
func (*ModernChargeSummaryProperties) UnmarshalJSON ¶
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 ModernReservationRecommendationPropertiesClassification
// READ-ONLY; The etag for the resource.
Etag *string
// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; Resource location
Location *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Resource sku
SKU *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; Resource tags.
Tags map[string]*string
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type *string
}
ModernReservationRecommendation - Modern reservation recommendation.
func (*ModernReservationRecommendation) GetReservationRecommendation ¶
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 {
// REQUIRED; Shared or single recommendation.
Scope *string
// 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; The last usage date used for looking back for computing the recommendation.
LastUsageDate *time.Time
// 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; Resource type.
ResourceType *string
// READ-ONLY; This is the ARM Sku name.
SKUName *string
// READ-ONLY; List of sku properties
SKUProperties []*SKUProperty
// READ-ONLY; Term period of the reservation. ex: P1M, P1Y or P3Y.
Term *string
// READ-ONLY; The total amount of cost with reserved instances.
TotalCostWithReservedInstances *Amount
// READ-ONLY; The total hours for which the cost is covered.
TotalHours *int32
}
ModernReservationRecommendationProperties - The properties of the reservation recommendation.
func (*ModernReservationRecommendationProperties) GetModernReservationRecommendationProperties ¶
func (m *ModernReservationRecommendationProperties) GetModernReservationRecommendationProperties() *ModernReservationRecommendationProperties
GetModernReservationRecommendationProperties implements the ModernReservationRecommendationPropertiesClassification interface for type ModernReservationRecommendationProperties.
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 ModernReservationRecommendationPropertiesClassification ¶
type ModernReservationRecommendationPropertiesClassification interface {
// GetModernReservationRecommendationProperties returns the ModernReservationRecommendationProperties content of the underlying type.
GetModernReservationRecommendationProperties() *ModernReservationRecommendationProperties
}
ModernReservationRecommendationPropertiesClassification provides polymorphic access to related types. Call the interface's GetModernReservationRecommendationProperties() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *ModernReservationRecommendationProperties, *ModernSharedScopeReservationRecommendationProperties, *ModernSingleScopeReservationRecommendationProperties
type ModernReservationTransaction ¶
type ModernReservationTransaction struct {
// REQUIRED; The properties of a modern reservation transaction.
Properties *ModernReservationTransactionProperties
// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; Resource tags.
Tags []*string
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
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 ¶
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 or Refund).
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 ¶
func (m *ModernReservationTransactionsListResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ModernReservationTransactionsListResult.
type ModernSharedScopeReservationRecommendationProperties ¶
type ModernSharedScopeReservationRecommendationProperties struct {
Scope *string
CostWithNoReservedInstances *Amount
FirstUsageDate *time.Time
InstanceFlexibilityGroup *string
InstanceFlexibilityRatio *float32
LastUsageDate *time.Time
Location *string
LookBackPeriod *int32
MeterID *string
NetSavings *Amount
NormalizedSize *string
RecommendedQuantity *float64
RecommendedQuantityNormalized *float32
ResourceType *string
SKUName *string
SKUProperties []*SKUProperty
Term *string
TotalCostWithReservedInstances *Amount
TotalHours *int32
}
ModernSharedScopeReservationRecommendationProperties - The properties of the modern reservation recommendation for shared scope.
func (*ModernSharedScopeReservationRecommendationProperties) GetModernReservationRecommendationProperties ¶
func (m *ModernSharedScopeReservationRecommendationProperties) GetModernReservationRecommendationProperties() *ModernReservationRecommendationProperties
GetModernReservationRecommendationProperties implements the ModernReservationRecommendationPropertiesClassification interface for type ModernSharedScopeReservationRecommendationProperties.
func (ModernSharedScopeReservationRecommendationProperties) MarshalJSON ¶
func (m ModernSharedScopeReservationRecommendationProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ModernSharedScopeReservationRecommendationProperties.
func (*ModernSharedScopeReservationRecommendationProperties) UnmarshalJSON ¶
func (m *ModernSharedScopeReservationRecommendationProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ModernSharedScopeReservationRecommendationProperties.
type ModernSingleScopeReservationRecommendationProperties ¶
type ModernSingleScopeReservationRecommendationProperties struct {
// REQUIRED; Shared or single recommendation.
Scope *string
// 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; The last usage date used for looking back for computing the recommendation.
LastUsageDate *time.Time
// 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; Resource type.
ResourceType *string
// READ-ONLY; This is the ARM Sku name.
SKUName *string
// READ-ONLY; List of sku properties
SKUProperties []*SKUProperty
// READ-ONLY; Subscription ID associated with single scoped recommendation.
SubscriptionID *string
// READ-ONLY; Term period of the reservation. ex: P1M, P1Y or P3Y.
Term *string
// READ-ONLY; The total amount of cost with reserved instances.
TotalCostWithReservedInstances *Amount
// READ-ONLY; The total hours for which the cost is covered.
TotalHours *int32
}
ModernSingleScopeReservationRecommendationProperties - The properties of the modern reservation recommendation for single scope.
func (*ModernSingleScopeReservationRecommendationProperties) GetModernReservationRecommendationProperties ¶
func (m *ModernSingleScopeReservationRecommendationProperties) GetModernReservationRecommendationProperties() *ModernReservationRecommendationProperties
GetModernReservationRecommendationProperties implements the ModernReservationRecommendationPropertiesClassification interface for type ModernSingleScopeReservationRecommendationProperties.
func (ModernSingleScopeReservationRecommendationProperties) MarshalJSON ¶
func (m ModernSingleScopeReservationRecommendationProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ModernSingleScopeReservationRecommendationProperties.
func (*ModernSingleScopeReservationRecommendationProperties) UnmarshalJSON ¶
func (m *ModernSingleScopeReservationRecommendationProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ModernSingleScopeReservationRecommendationProperties.
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; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; Resource tags.
Tags map[string]*string
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type *string
}
ModernUsageDetail - Modern usage detail.
func (*ModernUsageDetail) GetUsageDetail ¶
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 ¶
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 ¶
MarshalJSON implements the json.Marshaller interface for type Operation.
func (*Operation) UnmarshalJSON ¶
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 ¶
func (o OperationDisplay) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type OperationDisplay.
func (*OperationDisplay) UnmarshalJSON ¶
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 ¶
func (o *OperationListResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult.
type OperationStatus ¶
type OperationStatus struct {
// The properties of the resource generated.
Properties *PricesheetDownloadProperties
// The status of the long running operation.
Status *OperationStatusType
}
OperationStatus - The status of the long running operation.
func (OperationStatus) MarshalJSON ¶
func (o OperationStatus) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type OperationStatus.
func (*OperationStatus) UnmarshalJSON ¶
func (o *OperationStatus) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatus.
type OperationStatusType ¶
type OperationStatusType string
OperationStatusType - The status of the long running operation.
const ( OperationStatusTypeCompleted OperationStatusType = "Completed" OperationStatusTypeFailed OperationStatusType = "Failed" OperationStatusTypeRunning OperationStatusType = "Running" )
func PossibleOperationStatusTypeValues ¶
func PossibleOperationStatusTypeValues() []OperationStatusType
PossibleOperationStatusTypeValues returns the possible values for the OperationStatusType const type.
type OperationsClient ¶
type OperationsClient struct {
// contains filtered or unexported fields
}
OperationsClient contains the methods for the Operations group. Don't use this type directly, use NewOperationsClient() instead.
Generated from API version 2024-08-01
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 - Contains optional client configuration. Pass nil to accept the default values.
func (*OperationsClient) NewListPager ¶
func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse]
NewListPager - List the operations for the provider
- options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.
Example ¶
Generated from example definition: 2024-08-01/OperationList.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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 = armconsumption.OperationsClientListResponse{
// OperationListResult: armconsumption.OperationListResult{
// Value: []*armconsumption.Operation{
// {
// Name: to.Ptr("Microsoft.Consumption/usageDetails/read"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("List the usage details for a scope for EA and WebDirect subscriptions."),
// Operation: to.Ptr("List Usage Details"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("UsageDetails"),
// },
// ID: to.Ptr("Microsoft.Consumption/usageDetails/read"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/reservationSummaries/read"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("List the utilization summary for reserved instances by reservation order or managment groups. The summary data is either at monthly or daily level."),
// Operation: to.Ptr("List Reservation Utilization Summaries"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("ReservationSummaries"),
// },
// ID: to.Ptr("Microsoft.Consumption/reservationSummaries/read"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/reservationDetails/read"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("List the utilization details for reserved instances by reservation order or managment groups. The details data is per instance per day level."),
// Operation: to.Ptr("List Reservation Utilization Details"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("ReservationDetails"),
// },
// ID: to.Ptr("Microsoft.Consumption/reservationDetails/read"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/reservationTransactions/read"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("List the transaction history for reserved instances by management groups."),
// Operation: to.Ptr("List Reservation Transactions history"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("ReservationTransactions"),
// },
// ID: to.Ptr("Microsoft.Consumption/reservationTransactions/read"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/balances/read"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("List the utilization summary for a billing period for a management group."),
// Operation: to.Ptr("List utlization summary"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("Balances"),
// },
// ID: to.Ptr("Microsoft.Consumption/balances/read"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/pricesheets/read"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("List the Pricesheets data for a subscription or a management group."),
// Operation: to.Ptr("List Price sheets"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("Pricesheets"),
// },
// ID: to.Ptr("Microsoft.Consumption/pricesheets/read"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/marketplaces/read"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("List the marketplace resource usage details for a scope for EA and WebDirect subscriptions."),
// Operation: to.Ptr("List Marketplace resource usage"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("Marketplaces"),
// },
// ID: to.Ptr("Microsoft.Consumption/marketplaces/read"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/budgets/read"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("List the budgets by a subscription or a management group."),
// Operation: to.Ptr("List budgets"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("Budgets"),
// },
// ID: to.Ptr("Microsoft.Consumption/budgets/read"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/budgets/write"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("Creates and update the budgets by a subscription or a management group."),
// Operation: to.Ptr("Create and update budgets"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("Budgets"),
// },
// ID: to.Ptr("Microsoft.Consumption/budgets/write"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/budgets/delete"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("Delete the budgets by a subscription or a management group."),
// Operation: to.Ptr("Delete budgets"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("Budgets"),
// },
// ID: to.Ptr("Microsoft.Consumption/budgets/delete"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/charges/read"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("List charges"),
// Operation: to.Ptr("List charges"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("Charges"),
// },
// ID: to.Ptr("Microsoft.Consumption/charges/read"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/credits/read"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("List credits"),
// Operation: to.Ptr("List credits"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("Credits"),
// },
// ID: to.Ptr("Microsoft.Consumption/credits/read"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/events/read"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("List events"),
// Operation: to.Ptr("List events"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("Events"),
// },
// ID: to.Ptr("Microsoft.Consumption/events/read"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/forecasts/read"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("List forecasts"),
// Operation: to.Ptr("List forecasts"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("Forecasts"),
// },
// ID: to.Ptr("Microsoft.Consumption/forecasts/read"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/lots/read"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("List lots"),
// Operation: to.Ptr("List lots"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("Lots"),
// },
// ID: to.Ptr("Microsoft.Consumption/lots/read"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/operationstatus/read"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("List operationstatus"),
// Operation: to.Ptr("List operationstatus"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("Operationstatus"),
// },
// ID: to.Ptr("Microsoft.Consumption/operationstatus/read"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/operationresults/read"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("List operationresults"),
// Operation: to.Ptr("List operationresults"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("Operationresults"),
// },
// ID: to.Ptr("Microsoft.Consumption/operationresults/read"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/register/action"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("Register to Consumption RP"),
// Operation: to.Ptr("Register to Consumption RP"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("Register"),
// },
// ID: to.Ptr("Microsoft.Consumption/register/action"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/tags/read"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("List tags for EA and subscriptions."),
// Operation: to.Ptr("List tags"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("Tags"),
// },
// ID: to.Ptr("Microsoft.Consumption/tags/read"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/tenants/register/action"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("Register action for scope of Microsoft.Consumption by a tenant."),
// Operation: to.Ptr("register tenants"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("tenants/register"),
// },
// ID: to.Ptr("Microsoft.Consumption/tenants/register/action"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/terms/read"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("List the terms for a subscription or a management group."),
// Operation: to.Ptr("List Terms"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("Terms"),
// },
// ID: to.Ptr("Microsoft.Consumption/terms/read"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/reservationRecommendations/read"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("List single or shared recommendations for Reserved instances for a subscription."),
// Operation: to.Ptr("List reserved instances recommendations"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("ReservationRecommendations"),
// },
// ID: to.Ptr("Microsoft.Consumption/reservationRecommendations/read"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/operations/read"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("List all supported operations by Microsoft.Consumption resource provider."),
// Operation: to.Ptr("List supported operations"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("Operations"),
// },
// ID: to.Ptr("Microsoft.Consumption/operations/read"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/tenants/read"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("List tenants"),
// Operation: to.Ptr("List tenants"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("Tenants"),
// },
// ID: to.Ptr("Microsoft.Consumption/tenants/read"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/externalBillingAccounts/tags/read"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("List tags for EA and subscriptions."),
// Operation: to.Ptr("List tags"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("externalBillingAccounts/Tags"),
// },
// ID: to.Ptr("Microsoft.Consumption/externalBillingAccounts/tags/read"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/externalSubscriptions/tags/read"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("List tags for EA and subscriptions."),
// Operation: to.Ptr("List tags"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("externalSubscriptions/Tags"),
// },
// ID: to.Ptr("Microsoft.Consumption/externalSubscriptions/tags/read"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/aggregatedcost/read"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("List AggregatedCost for management group."),
// Operation: to.Ptr("List AggregatedCost"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("AggregatedCost"),
// },
// ID: to.Ptr("Microsoft.Consumption/aggregatedcost/read"),
// },
// {
// Name: to.Ptr("Microsoft.Consumption/reservationRecommendationDetails/read"),
// Display: &armconsumption.OperationDisplay{
// Description: to.Ptr("List Reservation Recommendation Details"),
// Operation: to.Ptr("List Reservation Recommendation Details"),
// Provider: to.Ptr("Microsoft.Consumption"),
// Resource: to.Ptr("ReservationRecommendationDetails"),
// },
// ID: to.Ptr("Microsoft.Consumption/reservationRecommendationDetails/read"),
// },
// },
// },
// }
}
}
Output:
type OperationsClientListOptions ¶
type OperationsClientListOptions struct {
}
OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.
type OperationsClientListResponse ¶
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 - Alert will be triggered if the evaluated cost is the same as threshold value. Note: It’s not recommended // to use this OperatorType as there’s low chance of cost being exactly the same as threshold value, leading to missing of // your alert. This OperatorType will be deprecated in future. OperatorTypeEqualTo OperatorType = "EqualTo" // OperatorTypeGreaterThan - Alert will be triggered if the evaluated cost is greater than the threshold value. Note: This // is the recommended OperatorType while configuring Budget Alert. OperatorTypeGreaterThan OperatorType = "GreaterThan" // OperatorTypeGreaterThanOrEqualTo - Alert will be triggered if the evaluated cost is greater than or equal to the threshold // value. OperatorTypeGreaterThanOrEqualTo OperatorType = "GreaterThanOrEqualTo" )
func PossibleOperatorTypeValues ¶
func PossibleOperatorTypeValues() []OperatorType
PossibleOperatorTypeValues returns the possible values for the OperatorType const type.
type OrganizationType ¶
type OrganizationType string
OrganizationType - The organization type of the lot.
const ( // OrganizationTypeContributorOrganizationType - Contributor organization type for Multi-Entity consumption commitment. OrganizationTypeContributorOrganizationType OrganizationType = "Contributor" // OrganizationTypePrimaryOrganizationType - Primary organization type for Multi-Entity consumption commitment. OrganizationTypePrimaryOrganizationType OrganizationType = "Primary" )
func PossibleOrganizationTypeValues ¶
func PossibleOrganizationTypeValues() []OrganizationType
PossibleOrganizationTypeValues returns the possible values for the OrganizationType 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.
Generated from API version 2024-08-01
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 - The ID of the target subscription. The value must be an UUID.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - Contains optional client configuration. Pass nil to accept the default values.
func (*PriceSheetClient) BeginDownloadByBillingAccountPeriod ¶
func (client *PriceSheetClient) BeginDownloadByBillingAccountPeriod(ctx context.Context, billingAccountID string, billingPeriodName string, options *PriceSheetClientBeginDownloadByBillingAccountPeriodOptions) (*runtime.Poller[PriceSheetClientDownloadByBillingAccountPeriodResponse], error)
BeginDownloadByBillingAccountPeriod - Generates the pricesheet for the provided billing period asynchronously based on the enrollment id If the operation fails it returns an *azcore.ResponseError type.
- billingAccountID - BillingAccount ID
- billingPeriodName - Billing Period Name.
- options - PriceSheetClientBeginDownloadByBillingAccountPeriodOptions contains the optional parameters for the PriceSheetClient.BeginDownloadByBillingAccountPeriod method.
Example ¶
Generated from example definition: 2024-08-01/EAPriceSheetForBillingPeriod.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewPriceSheetClient().BeginDownloadByBillingAccountPeriod(ctx, "0000000", "202305", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armconsumption.PriceSheetClientDownloadByBillingAccountPeriodResponse{
// OperationStatus: armconsumption.OperationStatus{
// Properties: &armconsumption.PricesheetDownloadProperties{
// DownloadURL: to.Ptr("https://xxxxxx.blob.core.windows.net/armpricesheetreportdownloadcontainer/20230510/00000000-0000-0000-0000-000000000000"),
// ValidTill: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-11T05:12:50.4266333Z"); return t}()),
// },
// Status: to.Ptr(armconsumption.OperationStatusTypeCompleted),
// },
// }
}
Output:
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.
- options - PriceSheetClientGetOptions contains the optional parameters for the PriceSheetClient.Get method.
Example ¶
Generated from example definition: 2024-08-01/PriceSheet.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPriceSheetClient().Get(ctx, 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 = armconsumption.PriceSheetClientGetResponse{
// 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{
// NextLink: to.Ptr("https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.consumption/pricesheets/default?api-version=2018-01-31&$skiptoken=AQAAAA%3D%3D"),
// 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"),
// SavingsPlan: &armconsumption.SavingsPlan{
// EffectivePrice: to.Ptr[float64](0.002),
// MarketPrice: to.Ptr[float64](0.00328),
// Term: to.Ptr("P3Y"),
// },
// 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.
- billingPeriodName - Billing Period Name.
- options - PriceSheetClientGetByBillingPeriodOptions contains the optional parameters for the PriceSheetClient.GetByBillingPeriod method.
Example (PriceSheetExpand) ¶
Generated from example definition: 2024-08-01/PriceSheetExpand.json
package main
import (
"context"
"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/v2"
"log"
)
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("00000000-0000-0000-0000-000000000000", 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")})
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 = armconsumption.PriceSheetClientGetByBillingPeriodResponse{
// 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{
// NextLink: to.Ptr("https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.consumption/pricesheets/default?api-version=2018-01-31&$skiptoken=AQAAAA%3D%3D&$expand=properties/pricesheets/meterDetails"),
// 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: 2024-08-01/PriceSheetForBillingPeriod.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPriceSheetClient().GetByBillingPeriod(ctx, "201801", 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 = armconsumption.PriceSheetClientGetByBillingPeriodResponse{
// 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{
// NextLink: to.Ptr("https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201702/providers/microsoft.consumption/pricesheets/default?api-version=2018-01-31"),
// 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 PriceSheetClientBeginDownloadByBillingAccountPeriodOptions ¶
type PriceSheetClientBeginDownloadByBillingAccountPeriodOptions struct {
// Resumes the long-running operation from the provided token.
ResumeToken string
}
PriceSheetClientBeginDownloadByBillingAccountPeriodOptions contains the optional parameters for the PriceSheetClient.BeginDownloadByBillingAccountPeriod method.
type PriceSheetClientDownloadByBillingAccountPeriodResponse ¶
type PriceSheetClientDownloadByBillingAccountPeriodResponse struct {
// The status of the long running operation.
OperationStatus
}
PriceSheetClientDownloadByBillingAccountPeriodResponse contains the response from method PriceSheetClient.BeginDownloadByBillingAccountPeriod.
type PriceSheetClientGetByBillingPeriodOptions ¶
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 ¶
type PriceSheetClientGetByBillingPeriodResponse struct {
// An pricesheet resource.
PriceSheetResult
}
PriceSheetClientGetByBillingPeriodResponse contains the response from method PriceSheetClient.GetByBillingPeriod.
type PriceSheetClientGetOptions ¶
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 ¶
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 ¶
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; SavingsPlan Details
SavingsPlan *SavingsPlan
// READ-ONLY; Unit of measure
UnitOfMeasure *string
// READ-ONLY; Unit Price
UnitPrice *float64
}
PriceSheetProperties - The properties of the price sheet.
func (PriceSheetProperties) MarshalJSON ¶
func (p PriceSheetProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PriceSheetProperties.
func (*PriceSheetProperties) UnmarshalJSON ¶
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; 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; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; Resource tags.
Tags map[string]*string
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
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 PricesheetDownloadProperties ¶
type PricesheetDownloadProperties struct {
// READ-ONLY; The link (url) to download the pricesheet.
DownloadURL *string
// READ-ONLY; Download link validity.
ValidTill *time.Time
}
PricesheetDownloadProperties - The properties of the price sheet download.
func (PricesheetDownloadProperties) MarshalJSON ¶
func (p PricesheetDownloadProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PricesheetDownloadProperties.
func (*PricesheetDownloadProperties) UnmarshalJSON ¶
func (p *PricesheetDownloadProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PricesheetDownloadProperties.
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 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 ¶
MarshalJSON implements the json.Marshaller interface for type Reseller.
func (*Reseller) UnmarshalJSON ¶
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; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; Resource tags.
Tags map[string]*string
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
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 ¶
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; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; Resource location
Location *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Resource sku
SKU *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; Resource tags.
Tags map[string]*string
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
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 ¶
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. Includes hardware and software cost.
OnDemandCost *float32
// READ-ONLY; The estimated cost for resource meters that are not covered by the reservation and are billed at pay-as-you-go
// rates.
OverageCost *float32
// READ-ONLY; The quantity for calculated savings.
Quantity *float32
// READ-ONLY; Hardware cost of the resources covered by the reservation.
ReservationCost *float32
// READ-ONLY; The amount saved by purchasing the recommended quantity of reservation. This is equal to onDemandCost - totalReservationCost.
Savings *float32
// READ-ONLY; Reservation cost + software cost of the resources covered by the reservation + overage cost.
TotalReservationCost *float32
}
ReservationRecommendationDetailsCalculatedSavingsProperties - Details of estimated savings. The costs and savings are estimated for the term.
func (ReservationRecommendationDetailsCalculatedSavingsProperties) MarshalJSON ¶
func (r ReservationRecommendationDetailsCalculatedSavingsProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ReservationRecommendationDetailsCalculatedSavingsProperties.
func (*ReservationRecommendationDetailsCalculatedSavingsProperties) UnmarshalJSON ¶
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.
Generated from API version 2024-08-01
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 - Contains optional client configuration. 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.
- 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: Standard_DS1_v2 (for VM), Premium_SSD_Managed_Disks_P30 (for Managed Disks)
- options - ReservationRecommendationDetailsClientGetOptions contains the optional parameters for the ReservationRecommendationDetailsClient.Get method.
Example (ReservationRecommendationsByBillingAccountLegacy) ¶
Generated from example definition: 2024-08-01/ReservationRecommendationDetailsByBillingAccount.json
package main
import (
"context"
"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/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewReservationRecommendationDetailsClient().Get(ctx, "providers/Microsoft.Billing/billingAccounts/00000000", armconsumption.ScopeShared, "eastus", armconsumption.TermP1Y, armconsumption.LookBackPeriodLast60Days, "Standard_DS14_v2", &armconsumption.ReservationRecommendationDetailsClientGetOptions{
Filter: to.Ptr("properties/subscriptionId eq 00000000-0000-0000-0000-00000000")})
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 = armconsumption.ReservationRecommendationDetailsClientGetResponse{
// 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: 2024-08-01/ReservationRecommendationDetailsByBillingProfile.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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", &armconsumption.ReservationRecommendationDetailsClientGetOptions{
Filter: to.Ptr("properties/subscriptionId eq 00000000-0000-0000-0000-00000000")})
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 = armconsumption.ReservationRecommendationDetailsClientGetResponse{
// 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: 2024-08-01/ReservationRecommendationDetailsByResourceGroup.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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 = armconsumption.ReservationRecommendationDetailsClientGetResponse{
// 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: 2024-08-01/ReservationRecommendationDetailsBySubscription.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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 = armconsumption.ReservationRecommendationDetailsClientGetResponse{
// 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 ¶
type ReservationRecommendationDetailsClientGetOptions struct {
// Used to filter reservation recommendation details by: properties/subscriptionId can be specified for billing account and
// billing profile paths.
Filter *string
}
ReservationRecommendationDetailsClientGetOptions contains the optional parameters for the ReservationRecommendationDetailsClient.Get method.
type ReservationRecommendationDetailsClientGetResponse ¶
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; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; Resource tags.
Tags map[string]*string
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
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 ¶
func (r ReservationRecommendationDetailsProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ReservationRecommendationDetailsProperties.
func (*ReservationRecommendationDetailsProperties) UnmarshalJSON ¶
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. Most resources use hourly rates, except for BlockBlob, ManagedDisk, Backup,
// and Azure Files, which use monthly rates. Only hardware rates are included; software rates are excluded. Note: there could
// be new resources that use hourly rates in the future.
OnDemandRate *float32
// READ-ONLY; Azure product ex: Standard_E8s_v3 etc.
Product *string
// READ-ONLY; Azure resource region ex:EastUS, WestUS etc.
Region *string
// READ-ONLY; Hourly reservation rate of the resource. Varies based on the term.
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 ¶
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: P1M, 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 ¶
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 ¶
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.
Generated from API version 2024-08-01
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 - Contains optional client configuration. Pass nil to accept the default values.
func (*ReservationRecommendationsClient) NewListPager ¶
func (client *ReservationRecommendationsClient) NewListPager(resourceScope string, options *ReservationRecommendationsClientListOptions) *runtime.Pager[ReservationRecommendationsClientListResponse]
NewListPager - List of recommendations for purchasing reserved instances.
- resourceScope - The fully qualified Azure Resource manager identifier of the resource.
- options - ReservationRecommendationsClientListOptions contains the optional parameters for the ReservationRecommendationsClient.NewListPager method.
Example (ReservationRecommendationsByBillingAccountFilterForScope) ¶
Generated from example definition: 2024-08-01/ReservationRecommendationsByBillingAccountFilterByScope.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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: to.Ptr("properties/scope eq 'Single'")})
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 = armconsumption.ReservationRecommendationsClientListResponse{
// ReservationRecommendationsListResult: armconsumption.ReservationRecommendationsListResult{
// Value: []armconsumption.ReservationRecommendationClassification{
// &armconsumption.LegacyReservationRecommendation{
// Name: to.Ptr("71fd91a7-13b9-4ade-bb11-85cfd6422d9d"),
// Type: to.Ptr("Microsoft.Consumption/reservationRecommendations"),
// ID: to.Ptr("billingAccount/123456/providers/Microsoft.Consumption/reservationRecommendations/71fd91a7-13b9-4ade-bb11-85cfd6422d9d"),
// Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy),
// Location: to.Ptr("westus3"),
// Properties: &armconsumption.LegacySingleScopeReservationRecommendationProperties{
// CostWithNoReservedInstances: to.Ptr[float64](0.332),
// FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-30T07:00:00Z"); return t}()),
// InstanceFlexibilityGroup: to.Ptr("BS Series High Memory"),
// InstanceFlexibilityRatio: to.Ptr[float32](8),
// LookBackPeriod: to.Ptr("Last7Days"),
// MeterID: to.Ptr("9a3781ce-d0dc-5f76-99d7-29eb5aec447f"),
// NetSavings: to.Ptr[float64](0.13725114155251145),
// NormalizedSize: to.Ptr("Standard_B1ms"),
// RecommendedQuantity: to.Ptr[float64](1),
// RecommendedQuantityNormalized: to.Ptr[float32](8),
// ResourceType: to.Ptr("virtualmachines"),
// Scope: to.Ptr("Single"),
// SKUProperties: []*armconsumption.SKUProperty{
// },
// SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// Term: to.Ptr("P1Y"),
// TotalCostWithReservedInstances: to.Ptr[float64](0.19474885844748857),
// },
// SKU: to.Ptr("Standard_B4ms"),
// },
// &armconsumption.LegacyReservationRecommendation{
// Name: to.Ptr("904b99c2-baf3-4bff-98ff-a96238ccbc96"),
// Type: to.Ptr("Microsoft.Consumption/reservationRecommendations"),
// ID: to.Ptr("billingAccount/123456/providers/Microsoft.Consumption/reservationRecommendations/904b99c2-baf3-4bff-98ff-a96238ccbc96"),
// Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy),
// Location: to.Ptr("westus3"),
// Properties: &armconsumption.LegacySingleScopeReservationRecommendationProperties{
// CostWithNoReservedInstances: to.Ptr[float64](0.332),
// FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-30T07:00:00Z"); return t}()),
// InstanceFlexibilityGroup: to.Ptr("BS Series High Memory"),
// InstanceFlexibilityRatio: to.Ptr[float32](8),
// LookBackPeriod: to.Ptr("Last7Days"),
// MeterID: to.Ptr("9a3781ce-d0dc-5f76-99d7-29eb5aec447f"),
// NetSavings: to.Ptr[float64](0.20688584474885846),
// NormalizedSize: to.Ptr("Standard_B1ms"),
// RecommendedQuantity: to.Ptr[float64](1),
// RecommendedQuantityNormalized: to.Ptr[float32](8),
// ResourceType: to.Ptr("virtualmachines"),
// Scope: to.Ptr("Single"),
// SKUProperties: []*armconsumption.SKUProperty{
// },
// SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// Term: to.Ptr("P3Y"),
// TotalCostWithReservedInstances: to.Ptr[float64](0.12511415525114156),
// },
// SKU: to.Ptr("Standard_B4ms"),
// },
// },
// },
// }
}
}
Output:
Example (ReservationRecommendationsByBillingAccountLegacy) ¶
Generated from example definition: 2024-08-01/ReservationRecommendationsByBillingAccount.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewReservationRecommendationsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/123456", 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 = armconsumption.ReservationRecommendationsClientListResponse{
// ReservationRecommendationsListResult: armconsumption.ReservationRecommendationsListResult{
// NextLink: to.Ptr("https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationRecommendations?api-version=2024-08-01&$skiptoken=AQAAAA%3D%3D&"),
// 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"),
// Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy),
// Location: to.Ptr("westus"),
// Properties: &armconsumption.LegacySharedScopeReservationRecommendationProperties{
// CostWithNoReservedInstances: to.Ptr[float64](12.0785105),
// FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-07T00:00:00-07:00"); return t}()),
// InstanceFlexibilityGroup: to.Ptr("DSv2 Series"),
// InstanceFlexibilityRatio: to.Ptr[float32](1),
// LastUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-07T00:00:00-07:00"); return t}()),
// 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),
// TotalHours: to.Ptr[int32](701),
// },
// SKU: to.Ptr("Standard_DS1_v2"),
// },
// &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"),
// Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy),
// Location: to.Ptr("westus"),
// Properties: &armconsumption.LegacySharedScopeReservationRecommendationProperties{
// CostWithNoReservedInstances: to.Ptr[float64](10.0785105),
// FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-07T00:00:00-07:00"); return t}()),
// InstanceFlexibilityGroup: to.Ptr("DSv2 Series"),
// InstanceFlexibilityRatio: to.Ptr[float32](1),
// LastUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-09T00:00:00-07:00"); return t}()),
// 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),
// TotalHours: to.Ptr[int32](805),
// },
// SKU: to.Ptr("Standard_DS1_v2"),
// },
// },
// },
// }
}
}
Output:
Example (ReservationRecommendationsByBillingProfileModern) ¶
Generated from example definition: 2024-08-01/ReservationRecommendationsByBillingProfile.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewReservationRecommendationsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/123456/billingProfiles/6420", 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 = armconsumption.ReservationRecommendationsClientListResponse{
// ReservationRecommendationsListResult: armconsumption.ReservationRecommendationsListResult{
// NextLink: to.Ptr("https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationRecommendations?api-version=2024-08-01&$skiptoken=AQAAAA%3D%3D&"),
// 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"),
// Kind: to.Ptr(armconsumption.ReservationRecommendationKindModern),
// Properties: &armconsumption.ModernSingleScopeReservationRecommendationProperties{
// CostWithNoReservedInstances: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float64](279881.9457795231),
// },
// FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-22T00:00:00Z"); return t}()),
// InstanceFlexibilityGroup: to.Ptr("NA"),
// InstanceFlexibilityRatio: to.Ptr[float32](1),
// LastUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-22T00:00:00Z"); return t}()),
// Location: to.Ptr("westus2"),
// LookBackPeriod: to.Ptr[int32](60),
// MeterID: to.Ptr("30f7049a-b092-42f4-9173-9ec31ab945ad"),
// NetSavings: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float64](153766.87728637524),
// },
// NormalizedSize: to.Ptr("SQLDB_BC_Compute_Gen5"),
// RecommendedQuantity: to.Ptr[float64](35),
// RecommendedQuantityNormalized: to.Ptr[float32](35),
// ResourceType: to.Ptr("sqldatabases"),
// Scope: to.Ptr("Single"),
// SKUName: to.Ptr("SQLDB_BC_Compute_Gen5"),
// SubscriptionID: to.Ptr("c6aa8a01-a744-44a7-a4f1-caad17512f27"),
// Term: to.Ptr("P3Y"),
// TotalCostWithReservedInstances: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float64](126115.06849314792),
// },
// TotalHours: to.Ptr[int32](717),
// },
// },
// &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"),
// Kind: to.Ptr(armconsumption.ReservationRecommendationKindModern),
// Properties: &armconsumption.ModernSingleScopeReservationRecommendationProperties{
// CostWithNoReservedInstances: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float64](93208.8596802244),
// },
// FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-22T00:00:00Z"); return t}()),
// InstanceFlexibilityGroup: to.Ptr("NA"),
// InstanceFlexibilityRatio: to.Ptr[float32](1),
// LastUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-27T00:00:00Z"); return t}()),
// Location: to.Ptr("westus2"),
// LookBackPeriod: to.Ptr[int32](60),
// MeterID: to.Ptr("30f7049a-b092-42f4-9173-9ec31ab945ad"),
// NetSavings: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float64](32553.85968022456),
// },
// NormalizedSize: to.Ptr("SQLDB_BC_Compute_Gen5"),
// RecommendedQuantity: to.Ptr[float64](35),
// RecommendedQuantityNormalized: to.Ptr[float32](35),
// ResourceType: to.Ptr("sqldatabases"),
// Scope: to.Ptr("Single"),
// SKUName: to.Ptr("SQLDB_BC_Compute_Gen5"),
// SubscriptionID: to.Ptr("c6aa8a01-a744-44a7-a4f1-caad17512f27"),
// Term: to.Ptr("P1Y"),
// TotalCostWithReservedInstances: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float64](60654.99999999984),
// },
// TotalHours: to.Ptr[int32](527),
// },
// },
// },
// },
// }
}
}
Output:
Example (ReservationRecommendationsByResourceGroupLegacy) ¶
Generated from example definition: 2024-08-01/ReservationRecommendationsByResourceGroup.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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", 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 = armconsumption.ReservationRecommendationsClientListResponse{
// ReservationRecommendationsListResult: armconsumption.ReservationRecommendationsListResult{
// NextLink: to.Ptr("https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testGroup/providers/Microsoft.Consumption/reservationRecommendations?api-version=2024-08-01&$skiptoken=AQAAAA%3D%3D&"),
// 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"),
// Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy),
// Location: to.Ptr("northeurope"),
// Properties: &armconsumption.LegacySingleScopeReservationRecommendationProperties{
// CostWithNoReservedInstances: to.Ptr[float64](0),
// FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-06T00:00:00Z"); return t}()),
// LastUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-08T00:00:00Z"); 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"),
// SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// Term: to.Ptr("P1Y"),
// TotalCostWithReservedInstances: to.Ptr[float64](0),
// TotalHours: to.Ptr[int32](427),
// },
// SKU: to.Ptr("Standard_DS1_v2"),
// },
// &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"),
// Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy),
// Location: to.Ptr("northeurope"),
// Properties: &armconsumption.LegacySingleScopeReservationRecommendationProperties{
// CostWithNoReservedInstances: to.Ptr[float64](0),
// FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-06T00:00:00Z"); return t}()),
// LastUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-09T00:00:00Z"); 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"),
// SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// Term: to.Ptr("P3Y"),
// TotalCostWithReservedInstances: to.Ptr[float64](0),
// TotalHours: to.Ptr[int32](327),
// },
// SKU: to.Ptr("Standard_DS1_v2"),
// },
// },
// },
// }
}
}
Output:
Example (ReservationRecommendationsBySubscriptionLegacy) ¶
Generated from example definition: 2024-08-01/ReservationRecommendationsBySubscription.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewReservationRecommendationsClient().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 = armconsumption.ReservationRecommendationsClientListResponse{
// ReservationRecommendationsListResult: armconsumption.ReservationRecommendationsListResult{
// NextLink: to.Ptr("https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationRecommendations?api-version=2024-08-01&$skiptoken=AQAAAA%3D%3D&"),
// 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"),
// Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy),
// Location: to.Ptr("northeurope"),
// Properties: &armconsumption.LegacySingleScopeReservationRecommendationProperties{
// CostWithNoReservedInstances: to.Ptr[float64](0),
// FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-06T00:00:00Z"); return t}()),
// LastUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-10T00:00:00Z"); 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"),
// SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// Term: to.Ptr("P1Y"),
// TotalCostWithReservedInstances: to.Ptr[float64](0),
// TotalHours: to.Ptr[int32](827),
// },
// SKU: to.Ptr("Standard_DS1_v2"),
// },
// &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"),
// Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy),
// Location: to.Ptr("northeurope"),
// Properties: &armconsumption.LegacySingleScopeReservationRecommendationProperties{
// CostWithNoReservedInstances: to.Ptr[float64](0),
// FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-06T00:00:00Z"); return t}()),
// LastUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-15T00:00:00Z"); 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"),
// SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// Term: to.Ptr("P3Y"),
// TotalCostWithReservedInstances: to.Ptr[float64](0),
// TotalHours: to.Ptr[int32](927),
// },
// SKU: to.Ptr("Standard_DS1_v2"),
// },
// },
// },
// }
}
}
Output:
Example (ReservationRecommendationsFilterBySubscriptionForScopeLookBackPeriodLegacy) ¶
Generated from example definition: 2024-08-01/ReservationRecommendationsFilterBySubscriptionForScopeLookBackPeriod.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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 = armconsumption.ReservationRecommendationsClientListResponse{
// ReservationRecommendationsListResult: armconsumption.ReservationRecommendationsListResult{
// NextLink: to.Ptr("https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationRecommendations?api-version=2024-08-01&$filter=properties/scope+eq+'Single'+AND+properties/lookBackPeriod+eq+'Last7Days'&$skiptoken=AQAAAA%3D%3D&"),
// 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"),
// Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy),
// Location: to.Ptr("northeurope"),
// Properties: &armconsumption.LegacySingleScopeReservationRecommendationProperties{
// CostWithNoReservedInstances: to.Ptr[float64](0),
// FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-06T00:00:00Z"); return t}()),
// LastUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-15T00:00:00Z"); 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"),
// },
// },
// SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// Term: to.Ptr("P1Y"),
// TotalCostWithReservedInstances: to.Ptr[float64](0),
// TotalHours: to.Ptr[int32](527),
// },
// SKU: to.Ptr("Standard_DS1_v2"),
// },
// &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"),
// Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy),
// Location: to.Ptr("northeurope"),
// Properties: &armconsumption.LegacySingleScopeReservationRecommendationProperties{
// CostWithNoReservedInstances: to.Ptr[float64](0),
// FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-06T00:00:00Z"); return t}()),
// LastUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-08T00:00:00Z"); 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"),
// },
// },
// SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// Term: to.Ptr("P3Y"),
// TotalCostWithReservedInstances: to.Ptr[float64](0),
// TotalHours: to.Ptr[int32](427),
// },
// SKU: to.Ptr("Standard_DS1_v2"),
// },
// },
// },
// }
}
}
Output:
type ReservationRecommendationsClientListOptions ¶
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 ¶
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 ¶
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; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; Resource tags.
Tags map[string]*string
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
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; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; Resource tags.
Tags []*string
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
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 ¶
func (r *ReservationTransaction) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ReservationTransaction.
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.
Generated from API version 2024-08-01
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 - Contains optional client configuration. Pass nil to accept the default values.
func (*ReservationTransactionsClient) NewListByBillingProfilePager ¶
func (client *ReservationTransactionsClient) NewListByBillingProfilePager(billingAccountID string, billingProfileID string, options *ReservationTransactionsClientListByBillingProfileOptions) *runtime.Pager[ReservationTransactionsClientListByBillingProfileResponse]
NewListByBillingProfilePager - List of transactions for reserved instances on billing profile scope. The refund transactions are posted along with its purchase transaction (i.e. in the purchase billing month). For example, The refund is requested in May 2021. This refund transaction will have event date as May 2021 but the billing month as April 2020 when the reservation purchase was made. Note: ARM has a payload size limit of 12MB, so currently callers get 400 when the response size exceeds the ARM limit. In such cases, API call should be made with smaller date ranges.
- billingAccountID - BillingAccount ID
- billingProfileID - Azure Billing Profile ID.
- options - ReservationTransactionsClientListByBillingProfileOptions contains the optional parameters for the ReservationTransactionsClient.NewListByBillingProfilePager method.
Example ¶
Generated from example definition: 2024-08-01/ReservationTransactionsListByBillingProfileId.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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 = armconsumption.ReservationTransactionsClientListByBillingProfileResponse{
// 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:38Z"); 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 ¶
func (client *ReservationTransactionsClient) NewListPager(billingAccountID string, options *ReservationTransactionsClientListOptions) *runtime.Pager[ReservationTransactionsClientListResponse]
NewListPager - List of transactions for reserved instances on billing account scope. Note: The refund transactions are posted along with its purchase transaction (i.e. in the purchase billing month). For example, The refund is requested in May 2021. This refund transaction will have event date as May 2021 but the billing month as April 2020 when the reservation purchase was made. Note: ARM has a payload size limit of 12MB, so currently callers get 400 when the response size exceeds the ARM limit. In such cases, API call should be made with smaller date ranges.
- billingAccountID - BillingAccount ID
- options - ReservationTransactionsClientListOptions contains the optional parameters for the ReservationTransactionsClient.NewListPager method.
Example ¶
Generated from example definition: 2024-08-01/ReservationTransactionsListByEnrollmentNumber.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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"),
PreviewMarkupPercentage: to.Ptr[float64](15.5),
UseMarkupIfPartner: to.Ptr(true)})
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 = armconsumption.ReservationTransactionsClientListResponse{
// 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"),
// 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:04Z"); 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"),
// },
// Tags: []*string{
// },
// },
// {
// Name: to.Ptr("201909091919"),
// Type: to.Ptr("Microsoft.Consumption/reservationTransactions"),
// ID: to.Ptr("/billingAccounts/123456/providers/Microsoft.Consumption/reservationtransactions/201909091919"),
// 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:04Z"); 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"),
// },
// Tags: []*string{
// },
// },
// },
// },
// }
}
}
Output:
type ReservationTransactionsClientListByBillingProfileOptions ¶
type ReservationTransactionsClientListByBillingProfileOptions struct {
// Filter reservation transactions by date range. The properties/EventDate for start date and end date. The filter supports
// 'le' and 'ge'. Note: API returns data for the entire start date's and end date's billing month. For example, filter properties/eventDate+ge+2020-01-01+AND+properties/eventDate+le+2020-12-29
// will include data for entire December 2020 month (i.e. will contain records for dates December 30 and 31)
Filter *string
}
ReservationTransactionsClientListByBillingProfileOptions contains the optional parameters for the ReservationTransactionsClient.NewListByBillingProfilePager method.
type ReservationTransactionsClientListByBillingProfileResponse ¶
type ReservationTransactionsClientListByBillingProfileResponse struct {
// Result of listing reservation recommendations.
ModernReservationTransactionsListResult
}
ReservationTransactionsClientListByBillingProfileResponse contains the response from method ReservationTransactionsClient.NewListByBillingProfilePager.
type ReservationTransactionsClientListOptions ¶
type ReservationTransactionsClientListOptions struct {
// Filter reservation transactions by date range. The properties/EventDate for start date and end date. The filter supports
// 'le' and 'ge'. Note: API returns data for the entire start date's and end date's billing month. For example, filter properties/eventDate+ge+2020-01-01+AND+properties/eventDate+le+2020-12-29
// will include data for the entire December 2020 month (i.e. will contain records for dates December 30 and 31)
Filter *string
// Preview markup percentage to be applied.
PreviewMarkupPercentage *float64
// Applies mark up to the transactions if the caller is a partner.
UseMarkupIfPartner *bool
}
ReservationTransactionsClientListOptions contains the optional parameters for the ReservationTransactionsClient.NewListPager method.
type ReservationTransactionsClientListResponse ¶
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 ¶
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.
Generated from API version 2024-08-01
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 - Contains optional client configuration. Pass nil to accept the default values.
func (*ReservationsDetailsClient) NewListByReservationOrderAndReservationPager ¶
func (client *ReservationsDetailsClient) NewListByReservationOrderAndReservationPager(reservationOrderID string, reservationID string, filter string, options *ReservationsDetailsClientListByReservationOrderAndReservationOptions) *runtime.Pager[ReservationsDetailsClientListByReservationOrderAndReservationResponse]
NewListByReservationOrderAndReservationPager - Lists the reservations details for provided date range. Note: ARM has a payload size limit of 12MB, so currently callers get 400 when the response size exceeds the ARM limit. If the data size is too large, customers may also get 504 as the API timed out preparing the data. In such cases, API call should be made with smaller date ranges or a call to Generate Reservation Details Report API should be made as it is asynchronous and will not run into response size time outs.
- 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: 2024-08-01/ReservationDetailsWithReservationId.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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 = armconsumption.ReservationsDetailsClientListByReservationOrderAndReservationResponse{
// 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"),
// 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:00Z"); return t}()),
// UsedHours: to.Ptr[float64](24),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
func (*ReservationsDetailsClient) NewListByReservationOrderPager ¶
func (client *ReservationsDetailsClient) NewListByReservationOrderPager(reservationOrderID string, filter string, options *ReservationsDetailsClientListByReservationOrderOptions) *runtime.Pager[ReservationsDetailsClientListByReservationOrderResponse]
NewListByReservationOrderPager - Lists the reservations details for provided date range. Note: ARM has a payload size limit of 12MB, so currently callers get 400 when the response size exceeds the ARM limit. If the data size is too large, customers may also get 504 as the API timed out preparing the data. In such cases, API call should be made with smaller date ranges or a call to Generate Reservation Details Report API should be made as it is asynchronous and will not run into response size time outs.
- 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: 2024-08-01/ReservationDetails.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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 = armconsumption.ReservationsDetailsClientListByReservationOrderResponse{
// 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"),
// 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:00Z"); return t}()),
// UsedHours: to.Ptr[float64](24),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
func (*ReservationsDetailsClient) NewListPager ¶
func (client *ReservationsDetailsClient) NewListPager(resourceScope string, options *ReservationsDetailsClientListOptions) *runtime.Pager[ReservationsDetailsClientListResponse]
NewListPager - Lists the reservations details for provided date range. Note: ARM has a payload size limit of 12MB, so currently callers get 400 when the response size exceeds the ARM limit. If the data size is too large, customers may also get 504 as the API timed out preparing the data. In such cases, API call should be made with smaller date ranges or a call to Generate Reservation Details Report API should be made as it is asynchronous and will not run into response size time outs.
- resourceScope - The fully qualified Azure Resource manager identifier of the resource.
- options - ReservationsDetailsClientListOptions contains the optional parameters for the ReservationsDetailsClient.NewListPager method.
Example (ReservationDetailsByBillingAccountId) ¶
Generated from example definition: 2024-08-01/ReservationDetailsByBillingAccountId.json
package main
import (
"context"
"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/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewReservationsDetailsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345", &armconsumption.ReservationsDetailsClientListOptions{
Filter: to.Ptr("properties/usageDate ge 2017-10-01 AND properties/usageDate le 2017-12-05")})
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 = armconsumption.ReservationsDetailsClientListResponse{
// 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-30T00:00:00-08:00"); return t}()),
// UsedHours: to.Ptr[float64](0.6),
// },
// },
// },
// },
// }
}
}
Output:
Example (ReservationDetailsByBillingProfileId) ¶
Generated from example definition: 2024-08-01/ReservationDetailsByBillingProfileId.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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{
EndDate: to.Ptr("2019-10-31"),
StartDate: to.Ptr("2019-09-01")})
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 = armconsumption.ReservationsDetailsClientListResponse{
// 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-30T00:00:00-08:00"); return t}()),
// UsedHours: to.Ptr[float64](0.6),
// },
// },
// },
// },
// }
}
}
Output:
Example (ReservationDetailsByBillingProfileIdReservationId) ¶
Generated from example definition: 2024-08-01/ReservationDetailsByBillingProfileIdReservationId.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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{
EndDate: to.Ptr("2019-10-31"),
ReservationID: to.Ptr("1c6b6358-709f-484c-85f1-72e862a0cf3b"),
ReservationOrderID: to.Ptr("9f39ba10-794f-4dcb-8f4b-8d0cb47c27dc"),
StartDate: to.Ptr("2019-09-01")})
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 = armconsumption.ReservationsDetailsClientListResponse{
// 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-30T00:00:00-08:00"); return t}()),
// UsedHours: to.Ptr[float64](0.6),
// },
// },
// },
// },
// }
}
}
Output:
type ReservationsDetailsClientListByReservationOrderAndReservationOptions ¶
type ReservationsDetailsClientListByReservationOrderAndReservationOptions struct {
}
ReservationsDetailsClientListByReservationOrderAndReservationOptions contains the optional parameters for the ReservationsDetailsClient.NewListByReservationOrderAndReservationPager method.
type ReservationsDetailsClientListByReservationOrderAndReservationResponse ¶
type ReservationsDetailsClientListByReservationOrderAndReservationResponse struct {
// Result of listing reservation details.
ReservationDetailsListResult
}
ReservationsDetailsClientListByReservationOrderAndReservationResponse contains the response from method ReservationsDetailsClient.NewListByReservationOrderAndReservationPager.
type ReservationsDetailsClientListByReservationOrderOptions ¶
type ReservationsDetailsClientListByReservationOrderOptions struct {
}
ReservationsDetailsClientListByReservationOrderOptions contains the optional parameters for the ReservationsDetailsClient.NewListByReservationOrderPager method.
type ReservationsDetailsClientListByReservationOrderResponse ¶
type ReservationsDetailsClientListByReservationOrderResponse struct {
// Result of listing reservation details.
ReservationDetailsListResult
}
ReservationsDetailsClientListByReservationOrderResponse contains the response from method ReservationsDetailsClient.NewListByReservationOrderPager.
type ReservationsDetailsClientListOptions ¶
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 ¶
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.
Generated from API version 2024-08-01
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 - Contains optional client configuration. Pass nil to accept the default values.
func (*ReservationsSummariesClient) NewListByReservationOrderAndReservationPager ¶
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. Note: ARM has a payload size limit of 12MB, so currently callers get 400 when the response size exceeds the ARM limit. In such cases, API call should be made with smaller date ranges.
- 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: 2024-08-01/ReservationSummariesDailyWithReservationId.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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 = armconsumption.ReservationsSummariesClientListByReservationOrderAndReservationResponse{
// 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"),
// 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:00Z"); return t}()),
// UsedHours: to.Ptr[float64](0),
// UsedQuantity: to.Ptr[float64](0),
// UtilizedPercentage: to.Ptr[float64](0),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (ReservationSummariesMonthlyWithReservationId) ¶
Generated from example definition: 2024-08-01/ReservationSummariesMonthlyWithReservationId.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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, 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 = armconsumption.ReservationsSummariesClientListByReservationOrderAndReservationResponse{
// 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"),
// 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:00Z"); return t}()),
// UsedHours: to.Ptr[float64](0),
// UsedQuantity: to.Ptr[float64](0),
// UtilizedPercentage: to.Ptr[float64](0),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
func (*ReservationsSummariesClient) NewListByReservationOrderPager ¶
func (client *ReservationsSummariesClient) NewListByReservationOrderPager(reservationOrderID string, grain Datagrain, options *ReservationsSummariesClientListByReservationOrderOptions) *runtime.Pager[ReservationsSummariesClientListByReservationOrderResponse]
NewListByReservationOrderPager - Lists the reservations summaries for daily or monthly grain. Note: ARM has a payload size limit of 12MB, so currently callers get 400 when the response size exceeds the ARM limit. In such cases, API call should be made with smaller date ranges.
- 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: 2024-08-01/ReservationSummariesDaily.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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 = armconsumption.ReservationsSummariesClientListByReservationOrderResponse{
// 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"),
// 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:00Z"); return t}()),
// UsedHours: to.Ptr[float64](0),
// UsedQuantity: to.Ptr[float64](0),
// UtilizedPercentage: to.Ptr[float64](0),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (ReservationSummariesMonthly) ¶
Generated from example definition: 2024-08-01/ReservationSummariesMonthly.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewReservationsSummariesClient().NewListByReservationOrderPager("00000000-0000-0000-0000-000000000000", armconsumption.DatagrainMonthlyGrain, 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 = armconsumption.ReservationsSummariesClientListByReservationOrderResponse{
// 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"),
// 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:00Z"); return t}()),
// UsedHours: to.Ptr[float64](0),
// UsedQuantity: to.Ptr[float64](0),
// UtilizedPercentage: to.Ptr[float64](0),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
func (*ReservationsSummariesClient) NewListPager ¶
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. Note: ARM has a payload size limit of 12MB, so currently callers get 400 when the response size exceeds the ARM limit. In such cases, API call should be made with smaller date ranges.
- resourceScope - The fully qualified Azure Resource manager identifier of the resource.
- grain - Can be daily or monthly
- options - ReservationsSummariesClientListOptions contains the optional parameters for the ReservationsSummariesClient.NewListPager method.
Example (ReservationSummariesDailyWithBillingAccountId) ¶
Generated from example definition: 2024-08-01/ReservationSummariesDailyWithBillingAccountId.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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{
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 = armconsumption.ReservationsSummariesClientListResponse{
// 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-01T00:00:00-07:00"); return t}()),
// UsedHours: to.Ptr[float64](0),
// },
// },
// },
// },
// }
}
}
Output:
Example (ReservationSummariesDailyWithBillingProfileId) ¶
Generated from example definition: 2024-08-01/ReservationSummariesDailyWithBillingProfileId.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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{
EndDate: to.Ptr("2017-11-20"),
StartDate: to.Ptr("2017-10-01")})
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 = armconsumption.ReservationsSummariesClientListResponse{
// 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-01T00:00:00-07:00"); return t}()),
// UsedHours: to.Ptr[float64](0),
// },
// },
// },
// },
// }
}
}
Output:
Example (ReservationSummariesMonthlyWithBillingAccountId) ¶
Generated from example definition: 2024-08-01/ReservationSummariesMonthlyWithBillingAccountId.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewReservationsSummariesClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345", armconsumption.DatagrainMonthlyGrain, 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 = armconsumption.ReservationsSummariesClientListResponse{
// 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-01T00:00:00-07:00"); return t}()),
// UsedHours: to.Ptr[float64](0),
// },
// },
// },
// },
// }
}
}
Output:
Example (ReservationSummariesMonthlyWithBillingProfileId) ¶
Generated from example definition: 2024-08-01/ReservationSummariesMonthlyWithBillingProfileId.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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, 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 = armconsumption.ReservationsSummariesClientListResponse{
// 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-01T00:00:00-07:00"); return t}()),
// UsedHours: to.Ptr[float64](0),
// },
// },
// },
// },
// }
}
}
Output:
Example (ReservationSummariesMonthlyWithBillingProfileIdReservationId) ¶
Generated from example definition: 2024-08-01/ReservationSummariesMonthlyWithBillingProfileIdReservationId.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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{
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 = armconsumption.ReservationsSummariesClientListResponse{
// 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-01T00:00:00-07:00"); return t}()),
// UsedHours: to.Ptr[float64](0),
// },
// },
// },
// },
// }
}
}
Output:
type ReservationsSummariesClientListByReservationOrderAndReservationOptions ¶
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 ¶
type ReservationsSummariesClientListByReservationOrderAndReservationResponse struct {
// Result of listing reservation summaries.
ReservationSummariesListResult
}
ReservationsSummariesClientListByReservationOrderAndReservationResponse contains the response from method ReservationsSummariesClient.NewListByReservationOrderAndReservationPager.
type ReservationsSummariesClientListByReservationOrderOptions ¶
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 ¶
type ReservationsSummariesClientListByReservationOrderResponse struct {
// Result of listing reservation summaries.
ReservationSummariesListResult
}
ReservationsSummariesClientListByReservationOrderResponse contains the response from method ReservationsSummariesClient.NewListByReservationOrderPager.
type ReservationsSummariesClientListOptions ¶
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 ¶
type ReservationsSummariesClientListResponse struct {
// Result of listing reservation summaries.
ReservationSummariesListResult
}
ReservationsSummariesClientListResponse contains the response from method ReservationsSummariesClient.NewListPager.
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 ¶
func (s SKUProperty) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type SKUProperty.
func (*SKUProperty) UnmarshalJSON ¶
func (s *SKUProperty) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type SKUProperty.
type SavingsPlan ¶
type SavingsPlan struct {
// READ-ONLY; SavingsPlan Effective Price
EffectivePrice *float64
// READ-ONLY; SavingsPlan Market Price
MarketPrice *float64
// READ-ONLY; SavingsPlan term
Term *string
}
SavingsPlan - The properties of the SavingsPlan.
func (SavingsPlan) MarshalJSON ¶
func (s SavingsPlan) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type SavingsPlan.
func (*SavingsPlan) UnmarshalJSON ¶
func (s *SavingsPlan) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type SavingsPlan.
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 SystemData ¶
type SystemData struct {
// The timestamp of resource creation (UTC).
CreatedAt *time.Time
// The identity that created the resource.
CreatedBy *string
// The type of identity that created the resource.
CreatedByType *CreatedByType
// The timestamp of resource last modification (UTC)
LastModifiedAt *time.Time
// The identity that last modified the resource.
LastModifiedBy *string
// The type of identity that last modified the resource.
LastModifiedByType *CreatedByType
}
SystemData - Metadata pertaining to creation and last modification of the resource.
func (SystemData) MarshalJSON ¶
func (s SystemData) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type SystemData.
func (*SystemData) UnmarshalJSON ¶
func (s *SystemData) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type SystemData.
type Tag ¶
Tag - The tag resource.
func (Tag) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface for type Tag.
func (*Tag) UnmarshalJSON ¶
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 ¶
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.
Generated from API version 2024-08-01
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 - Contains optional client configuration. 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.
- scope - The fully qualified Azure Resource manager identifier of the resource.
- options - TagsClientGetOptions contains the optional parameters for the TagsClient.Get method.
Example ¶
Generated from example definition: 2024-08-01/Tags.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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 = armconsumption.TagsClientGetResponse{
// 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{
// NextLink: to.Ptr("https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingaccount-id}/providers/Microsoft.Consumption/tags/?$expand=properties/tags/value&api-version=2024-08-01&startDate=2020-12-01&endDate=2020-12-31&$top=1000&$skiptoken=AwAAAA%3D%3D"),
// PreviousLink: to.Ptr("https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingaccount-id}/providers/Microsoft.Consumption/tags/?$expand=properties/tags/value&api-version=2024-08-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 ¶
type TagsClientGetOptions struct {
}
TagsClientGetOptions contains the optional parameters for the TagsClient.Get method.
type TagsClientGetResponse ¶
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; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type *string
}
TagsResult - A resource listing all tags.
func (TagsResult) MarshalJSON ¶
func (t TagsResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type TagsResult.
func (*TagsResult) UnmarshalJSON ¶
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 - Actual costs budget alerts notify when the actual accrued cost exceeds the allocated budget . ThresholdTypeActual ThresholdType = "Actual" // ThresholdTypeForecasted - Forecasted costs budget alerts provide advanced notification that your spending trends are likely // to exceed your allocated budget, as it relies on forecasted cost predictions. 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; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; The name of the resource
Name *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; Resource tags.
Tags map[string]*string
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
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 ¶
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.
Generated from API version 2024-08-01
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 - Contains optional client configuration. Pass nil to accept the default values.
func (*UsageDetailsClient) NewListPager ¶
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. **Note:Microsoft will be retiring the Consumption Usage Details API at some point in the future. We do not recommend that you take a new dependency on this API. Please use the Cost Details API instead. We will notify customers once a date for retirement has been determined.For Learn more,see [Generate Cost Details Report - Create Operation](https://learn.microsoft.com/en-us/rest/api/cost-management/generate-cost-details-report/create-operation?tabs=HTTP)**
- scope - The fully qualified Azure Resource manager identifier of the resource.
- options - UsageDetailsClientListOptions contains the optional parameters for the UsageDetailsClient.NewListPager method.
Example (BillingAccountUsageDetailsListForBillingPeriodLegacy) ¶
Generated from example definition: 2024-08-01/UsageDetailsListForBillingPeriodByBillingAccount.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/BillingAccounts/1234", 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 = armconsumption.UsageDetailsClientListResponse{
// 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"),
// 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.0000000Z"); return t}()),
// BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); 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.0000000Z"); 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),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (BillingAccountUsageDetailsListLegacy) ¶
Generated from example definition: 2024-08-01/UsageDetailsListByBillingAccount.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/BillingAccounts/1234", 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 = armconsumption.UsageDetailsClientListResponse{
// 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"),
// 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.0000000Z"); return t}()),
// BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); 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.0000000Z"); 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),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (BillingAccountUsageDetailsListModern) ¶
Generated from example definition: 2024-08-01/UsageDetailsListByMCABillingAccount.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/BillingAccounts/1234:56789", 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 = armconsumption.UsageDetailsClientListResponse{
// 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"),
// 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.0000000Z"); return t}()),
// BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-01T00:00:00.0000000Z"); 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.0000000Z"); return t}()),
// ExchangeRate: to.Ptr("1"),
// ExchangeRateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-30T00:00:00Z"); 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:00Z"); return t}()),
// ServicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-01T00:00:00Z"); 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),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (BillingProfileUsageDetailsListModern) ¶
Generated from example definition: 2024-08-01/UsageDetailsListByMCABillingProfile.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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", 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 = armconsumption.UsageDetailsClientListResponse{
// 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"),
// 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.0000000Z"); return t}()),
// BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-01T00:00:00.0000000Z"); 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.0000000Z"); return t}()),
// ExchangeRate: to.Ptr("1"),
// ExchangeRateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-30T00:00:00Z"); 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:00Z"); return t}()),
// ServicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-01T00:00:00Z"); 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),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (CustomerUsageDetailsListModern) ¶
Generated from example definition: 2024-08-01/UsageDetailsListByMCACustomer.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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", 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 = armconsumption.UsageDetailsClientListResponse{
// 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"),
// 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.0000000Z"); return t}()),
// BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-01T00:00:00.0000000Z"); 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.0000000Z"); return t}()),
// ExchangeRate: to.Ptr("1"),
// ExchangeRateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-30T00:00:00Z"); 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:00Z"); return t}()),
// ServicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-01T00:00:00Z"); 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),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (DepartmentUsageDetailsListForBillingPeriodLegacy) ¶
Generated from example definition: 2024-08-01/UsageDetailsListForBillingPeriodByDepartment.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/Departments/1234", 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 = armconsumption.UsageDetailsClientListResponse{
// 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"),
// 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.0000000Z"); return t}()),
// BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); 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.0000000Z"); 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),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (DepartmentUsageDetailsListLegacy) ¶
Generated from example definition: 2024-08-01/UsageDetailsListByDepartment.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/Departments/1234", 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 = armconsumption.UsageDetailsClientListResponse{
// 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"),
// 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.0000000Z"); return t}()),
// BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); 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.0000000Z"); 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),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (EnrollmentAccountUsageDetailsListForBillingPeriodLegacy) ¶
Generated from example definition: 2024-08-01/UsageDetailsListForBillingPeriodByEnrollmentAccount.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/EnrollmentAccounts/1234", 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 = armconsumption.UsageDetailsClientListResponse{
// 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"),
// 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.0000000Z"); return t}()),
// BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); 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.0000000Z"); 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),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (EnrollmentAccountUsageDetailsListLegacy) ¶
Generated from example definition: 2024-08-01/UsageDetailsListByEnrollmentAccount.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/EnrollmentAccounts/1234", 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 = armconsumption.UsageDetailsClientListResponse{
// 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"),
// 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.0000000Z"); return t}()),
// BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); 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.0000000Z"); 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),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (InvoiceSectionUsageDetailsListModern) ¶
Generated from example definition: 2024-08-01/UsageDetailsListByMCAInvoiceSection.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", 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", 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 = armconsumption.UsageDetailsClientListResponse{
// 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"),
// 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.0000000Z"); return t}()),
// BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-01T00:00:00.0000000Z"); 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.0000000Z"); return t}()),
// ExchangeRate: to.Ptr("1"),
// ExchangeRateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-30T00:00:00Z"); 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:00Z"); return t}()),
// ServicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-01T00:00:00Z"); 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),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (ManagementGroupUsageDetailsListForBillingPeriodLegacy) ¶
Generated from example definition: 2024-08-01/UsageDetailsListForBillingPeriodByManagementGroup.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewUsageDetailsClient().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 = armconsumption.UsageDetailsClientListResponse{
// 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"),
// 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.0000000Z"); return t}()),
// BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); 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.0000000Z"); 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),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// &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"),
// 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.0000000Z"); return t}()),
// BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); 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.0000000Z"); 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),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (ManagementGroupUsageDetailsListLegacy) ¶
Generated from example definition: 2024-08-01/UsageDetailsListByManagementGroup.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewUsageDetailsClient().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 = armconsumption.UsageDetailsClientListResponse{
// 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"),
// 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.0000000Z"); return t}()),
// BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); 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.0000000Z"); 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),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// &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"),
// 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.0000000Z"); return t}()),
// BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); 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.0000000Z"); 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),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (UsageDetailsExpandLegacy) ¶
Generated from example definition: 2024-08-01/UsageDetailsExpand.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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'"),
Top: to.Ptr[int32](1)})
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 = armconsumption.UsageDetailsClientListResponse{
// 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"),
// 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.0000000Z"); return t}()),
// BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); 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.0000000Z"); 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),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (UsageDetailsListByMetricActualCostLegacy) ¶
Generated from example definition: 2024-08-01/UsageDetailsListByMetricActualCost.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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{
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 = armconsumption.UsageDetailsClientListResponse{
// 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"),
// 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.0000000Z"); return t}()),
// BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-01T00:00:00.0000000Z"); 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.0000000Z"); 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),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (UsageDetailsListByMetricAmortizedCostLegacy) ¶
Generated from example definition: 2024-08-01/UsageDetailsListByMetricAmortizedCost.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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{
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 = armconsumption.UsageDetailsClientListResponse{
// 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"),
// 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.0000000Z"); return t}()),
// BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-01T00:00:00.0000000Z"); 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.0000000Z"); 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),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (UsageDetailsListByMetricUsageLegacy) ¶
Generated from example definition: 2024-08-01/UsageDetailsListByMetricUsage.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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{
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 = armconsumption.UsageDetailsClientListResponse{
// 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"),
// 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.0000000Z"); return t}()),
// BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-01T00:00:00.0000000Z"); 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.0000000Z"); 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),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (UsageDetailsListFilterByTagLegacy) ¶
Generated from example definition: 2024-08-01/UsageDetailsListFilterByTag.json
package main
import (
"context"
"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/v2"
"log"
)
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("", 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{
Filter: to.Ptr("tags eq 'dev:tools'")})
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 = armconsumption.UsageDetailsClientListResponse{
// 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"),
// 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.0000000Z"); return t}()),
// BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); 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.0000000Z"); 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),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// },
// },
// },
// },
// }
}
}
Output:
Example (UsageDetailsListForBillingPeriodLegacy) ¶
Generated from example definition: 2024-08-01/UsageDetailsListForBillingPeriod.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewUsageDetailsClient().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 = armconsumption.UsageDetailsClientListResponse{
// 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"),
// 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.0000000Z"); return t}()),
// BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); 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.0000000Z"); 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),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
Example (UsageDetailsListLegacy) ¶
Generated from example definition: 2024-08-01/UsageDetailsList.json
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
"log"
)
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("", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewUsageDetailsClient().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 = armconsumption.UsageDetailsClientListResponse{
// 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"),
// 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.0000000Z"); return t}()),
// BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-01T00:00:00.0000000Z"); 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.0000000Z"); 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),
// },
// Tags: map[string]*string{
// "dev": to.Ptr("tools"),
// "env": to.Ptr("newcrp"),
// },
// },
// },
// },
// }
}
}
Output:
type UsageDetailsClientListOptions ¶
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 ¶
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
- 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
- responses.go
- tags_client.go
- usagedetails_client.go
- version.go