diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/CHANGELOG.md b/sdk/resourcemanager/costmanagement/armcostmanagement/CHANGELOG.md index e0655d2e8919..a8c3eeb84e41 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/CHANGELOG.md +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/CHANGELOG.md @@ -1,5 +1,174 @@ # Release History +## 2.0.0 (2023-04-26) +### Breaking Changes + +- Type of `ExportExecutionListResult.Value` has been changed from `[]*ExportExecution` to `[]*ExportRun` +- Type of `ForecastDataset.Aggregation` has been changed from `map[string]*QueryAggregation` to `map[string]*ForecastAggregation` +- Type of `ForecastDataset.Configuration` has been changed from `*QueryDatasetConfiguration` to `*ForecastDatasetConfiguration` +- Type of `ForecastDataset.Filter` has been changed from `*QueryFilter` to `*ForecastFilter` +- Type of `ForecastDefinition.TimePeriod` has been changed from `*QueryTimePeriod` to `*ForecastTimePeriod` +- Type of `ForecastDefinition.Timeframe` has been changed from `*ForecastTimeframeType` to `*ForecastTimeframe` +- Type of `OperationListResult.Value` has been changed from `[]*Operation` to `[]*OperationForCostManagement` +- Type of `ReportConfigGrouping.Type` has been changed from `*ReportConfigColumnType` to `*QueryColumnType` +- `QueryColumnTypeTag` from enum `QueryColumnType` has been removed +- Enum `ForecastTimeframeType` has been removed +- Enum `ReportConfigColumnType` has been removed +- Operation `*GenerateDetailedCostReportOperationResultsClient.Get` has been changed to LRO, use `*GenerateDetailedCostReportOperationResultsClient.BeginGet` instead. +- Struct `ExportExecution` has been removed +- Struct `ExportExecutionProperties` has been removed +- Field `QueryResult` of struct `ForecastClientExternalCloudProviderUsageResponse` has been removed +- Field `QueryResult` of struct `ForecastClientUsageResponse` has been removed +- Field `ID` of struct `Operation` has been removed +- Field `ETag` of struct `ProxyResource` has been removed +- Field `ETag`, `Location`, `SKU`, `Tags` of struct `Resource` has been removed + +### Features Added + +- New value `OperationStatusTypeComplete` added to enum type `OperationStatusType` +- New value `QueryColumnTypeTagKey` added to enum type `QueryColumnType` +- New enum type `ActionType` with values `ActionTypeInternal` +- New enum type `BenefitKind` with values `BenefitKindIncludedQuantity`, `BenefitKindReservation`, `BenefitKindSavingsPlan` +- New enum type `BenefitUtilizationSummaryReportSchema` with values `BenefitUtilizationSummaryReportSchemaAvgUtilizationPercentage`, `BenefitUtilizationSummaryReportSchemaBenefitID`, `BenefitUtilizationSummaryReportSchemaBenefitOrderID`, `BenefitUtilizationSummaryReportSchemaBenefitType`, `BenefitUtilizationSummaryReportSchemaKind`, `BenefitUtilizationSummaryReportSchemaMaxUtilizationPercentage`, `BenefitUtilizationSummaryReportSchemaMinUtilizationPercentage`, `BenefitUtilizationSummaryReportSchemaUsageDate`, `BenefitUtilizationSummaryReportSchemaUtilizedPercentage` +- New enum type `CheckNameAvailabilityReason` with values `CheckNameAvailabilityReasonAlreadyExists`, `CheckNameAvailabilityReasonInvalid` +- New enum type `CostDetailsDataFormat` with values `CostDetailsDataFormatCSVCostDetailsDataFormat` +- New enum type `CostDetailsMetricType` with values `CostDetailsMetricTypeActualCostCostDetailsMetricType`, `CostDetailsMetricTypeAmortizedCostCostDetailsMetricType` +- New enum type `CostDetailsStatusType` with values `CostDetailsStatusTypeCompletedCostDetailsStatusType`, `CostDetailsStatusTypeFailedCostDetailsStatusType`, `CostDetailsStatusTypeNoDataFoundCostDetailsStatusType` +- New enum type `CreatedByType` with values `CreatedByTypeApplication`, `CreatedByTypeKey`, `CreatedByTypeManagedIdentity`, `CreatedByTypeUser` +- New enum type `DaysOfWeek` with values `DaysOfWeekFriday`, `DaysOfWeekMonday`, `DaysOfWeekSaturday`, `DaysOfWeekSunday`, `DaysOfWeekThursday`, `DaysOfWeekTuesday`, `DaysOfWeekWednesday` +- New enum type `FileFormat` with values `FileFormatCSV` +- New enum type `ForecastOperatorType` with values `ForecastOperatorTypeIn` +- New enum type `ForecastTimeframe` with values `ForecastTimeframeCustom` +- New enum type `FunctionName` with values `FunctionNameCost`, `FunctionNameCostUSD`, `FunctionNamePreTaxCost`, `FunctionNamePreTaxCostUSD` +- New enum type `Grain` with values `GrainDaily`, `GrainHourly`, `GrainMonthly` +- New enum type `GrainParameter` with values `GrainParameterDaily`, `GrainParameterHourly`, `GrainParameterMonthly` +- New enum type `LookBackPeriod` with values `LookBackPeriodLast30Days`, `LookBackPeriodLast60Days`, `LookBackPeriodLast7Days` +- New enum type `Origin` with values `OriginSystem`, `OriginUser`, `OriginUserSystem` +- New enum type `ScheduleFrequency` with values `ScheduleFrequencyDaily`, `ScheduleFrequencyMonthly`, `ScheduleFrequencyWeekly` +- New enum type `ScheduledActionKind` with values `ScheduledActionKindEmail`, `ScheduledActionKindInsightAlert` +- New enum type `ScheduledActionStatus` with values `ScheduledActionStatusDisabled`, `ScheduledActionStatusEnabled`, `ScheduledActionStatusExpired` +- New enum type `Scope` with values `ScopeShared`, `ScopeSingle` +- New enum type `Term` with values `TermP1Y`, `TermP3Y` +- New enum type `WeeksOfMonth` with values `WeeksOfMonthFirst`, `WeeksOfMonthFourth`, `WeeksOfMonthLast`, `WeeksOfMonthSecond`, `WeeksOfMonthThird` +- New function `*BenefitRecommendationProperties.GetBenefitRecommendationProperties() *BenefitRecommendationProperties` +- New function `NewBenefitRecommendationsClient(azcore.TokenCredential, *arm.ClientOptions) (*BenefitRecommendationsClient, error)` +- New function `*BenefitRecommendationsClient.NewListPager(string, *BenefitRecommendationsClientListOptions) *runtime.Pager[BenefitRecommendationsClientListResponse]` +- New function `NewBenefitUtilizationSummariesAsyncClient(azcore.TokenCredential, *arm.ClientOptions) (*BenefitUtilizationSummariesAsyncClient, error)` +- New function `*BenefitUtilizationSummariesAsyncClient.GetOperationStatusBillingAccountScope(context.Context, string, string, *BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingAccountScopeOptions) (BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingAccountScopeResponse, error)` +- New function `*BenefitUtilizationSummariesAsyncClient.GetOperationStatusBillingProfileScope(context.Context, string, string, string, *BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingProfileScopeOptions) (BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingProfileScopeResponse, error)` +- New function `*BenefitUtilizationSummariesAsyncClient.GetOperationStatusReservationOrderScope(context.Context, string, string, *BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationOrderScopeOptions) (BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationOrderScopeResponse, error)` +- New function `*BenefitUtilizationSummariesAsyncClient.GetOperationStatusReservationScope(context.Context, string, string, string, *BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationScopeOptions) (BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationScopeResponse, error)` +- New function `*BenefitUtilizationSummariesAsyncClient.GetOperationStatusSavingsPlanOrderScope(context.Context, string, string, *BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanOrderScopeOptions) (BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanOrderScopeResponse, error)` +- New function `*BenefitUtilizationSummariesAsyncClient.GetOperationStatusSavingsPlanScope(context.Context, string, string, string, *BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanScopeOptions) (BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanScopeResponse, error)` +- New function `NewBenefitUtilizationSummariesClient(azcore.TokenCredential, *arm.ClientOptions) (*BenefitUtilizationSummariesClient, error)` +- New function `*BenefitUtilizationSummariesClient.NewListByBillingAccountIDPager(string, *BenefitUtilizationSummariesClientListByBillingAccountIDOptions) *runtime.Pager[BenefitUtilizationSummariesClientListByBillingAccountIDResponse]` +- New function `*BenefitUtilizationSummariesClient.NewListByBillingProfileIDPager(string, string, *BenefitUtilizationSummariesClientListByBillingProfileIDOptions) *runtime.Pager[BenefitUtilizationSummariesClientListByBillingProfileIDResponse]` +- New function `*BenefitUtilizationSummariesClient.NewListBySavingsPlanIDPager(string, string, *BenefitUtilizationSummariesClientListBySavingsPlanIDOptions) *runtime.Pager[BenefitUtilizationSummariesClientListBySavingsPlanIDResponse]` +- New function `*BenefitUtilizationSummariesClient.NewListBySavingsPlanOrderPager(string, *BenefitUtilizationSummariesClientListBySavingsPlanOrderOptions) *runtime.Pager[BenefitUtilizationSummariesClientListBySavingsPlanOrderResponse]` +- New function `*BenefitUtilizationSummary.GetBenefitUtilizationSummary() *BenefitUtilizationSummary` +- New function `NewBillingAccountScopeClient(azcore.TokenCredential, *arm.ClientOptions) (*BillingAccountScopeClient, error)` +- New function `*BillingAccountScopeClient.BeginGenerateBenefitUtilizationSummariesReport(context.Context, string, BenefitUtilizationSummariesRequest, *BillingAccountScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions) (*runtime.Poller[BillingAccountScopeClientGenerateBenefitUtilizationSummariesReportResponse], error)` +- New function `NewBillingProfileScopeClient(azcore.TokenCredential, *arm.ClientOptions) (*BillingProfileScopeClient, error)` +- New function `*BillingProfileScopeClient.BeginGenerateBenefitUtilizationSummariesReport(context.Context, string, string, BenefitUtilizationSummariesRequest, *BillingProfileScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions) (*runtime.Poller[BillingProfileScopeClientGenerateBenefitUtilizationSummariesReportResponse], error)` +- New function `*ClientFactory.NewBenefitRecommendationsClient() *BenefitRecommendationsClient` +- New function `*ClientFactory.NewBenefitUtilizationSummariesAsyncClient() *BenefitUtilizationSummariesAsyncClient` +- New function `*ClientFactory.NewBenefitUtilizationSummariesClient() *BenefitUtilizationSummariesClient` +- New function `*ClientFactory.NewBillingAccountScopeClient() *BillingAccountScopeClient` +- New function `*ClientFactory.NewBillingProfileScopeClient() *BillingProfileScopeClient` +- New function `*ClientFactory.NewGenerateCostDetailsReportClient() *GenerateCostDetailsReportClient` +- New function `*ClientFactory.NewPriceSheetClient() *PriceSheetClient` +- New function `*ClientFactory.NewReservationOrderScopeClient() *ReservationOrderScopeClient` +- New function `*ClientFactory.NewReservationScopeClient() *ReservationScopeClient` +- New function `*ClientFactory.NewSavingsPlanOrderScopeClient() *SavingsPlanOrderScopeClient` +- New function `*ClientFactory.NewSavingsPlanScopeClient() *SavingsPlanScopeClient` +- New function `*ClientFactory.NewScheduledActionsClient() *ScheduledActionsClient` +- New function `NewGenerateCostDetailsReportClient(azcore.TokenCredential, *arm.ClientOptions) (*GenerateCostDetailsReportClient, error)` +- New function `*GenerateCostDetailsReportClient.BeginCreateOperation(context.Context, string, GenerateCostDetailsReportRequestDefinition, *GenerateCostDetailsReportClientBeginCreateOperationOptions) (*runtime.Poller[GenerateCostDetailsReportClientCreateOperationResponse], error)` +- New function `*GenerateCostDetailsReportClient.BeginGetOperationResults(context.Context, string, string, *GenerateCostDetailsReportClientBeginGetOperationResultsOptions) (*runtime.Poller[GenerateCostDetailsReportClientGetOperationResultsResponse], error)` +- New function `*IncludedQuantityUtilizationSummary.GetBenefitUtilizationSummary() *BenefitUtilizationSummary` +- New function `NewPriceSheetClient(azcore.TokenCredential, *arm.ClientOptions) (*PriceSheetClient, error)` +- New function `*PriceSheetClient.BeginDownload(context.Context, string, string, string, *PriceSheetClientBeginDownloadOptions) (*runtime.Poller[PriceSheetClientDownloadResponse], error)` +- New function `*PriceSheetClient.BeginDownloadByBillingProfile(context.Context, string, string, *PriceSheetClientBeginDownloadByBillingProfileOptions) (*runtime.Poller[PriceSheetClientDownloadByBillingProfileResponse], error)` +- New function `NewReservationOrderScopeClient(azcore.TokenCredential, *arm.ClientOptions) (*ReservationOrderScopeClient, error)` +- New function `*ReservationOrderScopeClient.BeginGenerateBenefitUtilizationSummariesReport(context.Context, string, BenefitUtilizationSummariesRequest, *ReservationOrderScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions) (*runtime.Poller[ReservationOrderScopeClientGenerateBenefitUtilizationSummariesReportResponse], error)` +- New function `NewReservationScopeClient(azcore.TokenCredential, *arm.ClientOptions) (*ReservationScopeClient, error)` +- New function `*ReservationScopeClient.BeginGenerateBenefitUtilizationSummariesReport(context.Context, string, string, BenefitUtilizationSummariesRequest, *ReservationScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions) (*runtime.Poller[ReservationScopeClientGenerateBenefitUtilizationSummariesReportResponse], error)` +- New function `NewSavingsPlanOrderScopeClient(azcore.TokenCredential, *arm.ClientOptions) (*SavingsPlanOrderScopeClient, error)` +- New function `*SavingsPlanOrderScopeClient.BeginGenerateBenefitUtilizationSummariesReport(context.Context, string, BenefitUtilizationSummariesRequest, *SavingsPlanOrderScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions) (*runtime.Poller[SavingsPlanOrderScopeClientGenerateBenefitUtilizationSummariesReportResponse], error)` +- New function `NewSavingsPlanScopeClient(azcore.TokenCredential, *arm.ClientOptions) (*SavingsPlanScopeClient, error)` +- New function `*SavingsPlanScopeClient.BeginGenerateBenefitUtilizationSummariesReportAsync(context.Context, string, string, BenefitUtilizationSummariesRequest, *SavingsPlanScopeClientBeginGenerateBenefitUtilizationSummariesReportAsyncOptions) (*runtime.Poller[SavingsPlanScopeClientGenerateBenefitUtilizationSummariesReportAsyncResponse], error)` +- New function `*SavingsPlanUtilizationSummary.GetBenefitUtilizationSummary() *BenefitUtilizationSummary` +- New function `NewScheduledActionsClient(azcore.TokenCredential, *arm.ClientOptions) (*ScheduledActionsClient, error)` +- New function `*ScheduledActionsClient.CheckNameAvailability(context.Context, CheckNameAvailabilityRequest, *ScheduledActionsClientCheckNameAvailabilityOptions) (ScheduledActionsClientCheckNameAvailabilityResponse, error)` +- New function `*ScheduledActionsClient.CheckNameAvailabilityByScope(context.Context, string, CheckNameAvailabilityRequest, *ScheduledActionsClientCheckNameAvailabilityByScopeOptions) (ScheduledActionsClientCheckNameAvailabilityByScopeResponse, error)` +- New function `*ScheduledActionsClient.CreateOrUpdate(context.Context, string, ScheduledAction, *ScheduledActionsClientCreateOrUpdateOptions) (ScheduledActionsClientCreateOrUpdateResponse, error)` +- New function `*ScheduledActionsClient.CreateOrUpdateByScope(context.Context, string, string, ScheduledAction, *ScheduledActionsClientCreateOrUpdateByScopeOptions) (ScheduledActionsClientCreateOrUpdateByScopeResponse, error)` +- New function `*ScheduledActionsClient.Delete(context.Context, string, *ScheduledActionsClientDeleteOptions) (ScheduledActionsClientDeleteResponse, error)` +- New function `*ScheduledActionsClient.DeleteByScope(context.Context, string, string, *ScheduledActionsClientDeleteByScopeOptions) (ScheduledActionsClientDeleteByScopeResponse, error)` +- New function `*ScheduledActionsClient.Get(context.Context, string, *ScheduledActionsClientGetOptions) (ScheduledActionsClientGetResponse, error)` +- New function `*ScheduledActionsClient.GetByScope(context.Context, string, string, *ScheduledActionsClientGetByScopeOptions) (ScheduledActionsClientGetByScopeResponse, error)` +- New function `*ScheduledActionsClient.NewListByScopePager(string, *ScheduledActionsClientListByScopeOptions) *runtime.Pager[ScheduledActionsClientListByScopeResponse]` +- New function `*ScheduledActionsClient.NewListPager(*ScheduledActionsClientListOptions) *runtime.Pager[ScheduledActionsClientListResponse]` +- New function `*ScheduledActionsClient.Run(context.Context, string, *ScheduledActionsClientRunOptions) (ScheduledActionsClientRunResponse, error)` +- New function `*ScheduledActionsClient.RunByScope(context.Context, string, string, *ScheduledActionsClientRunByScopeOptions) (ScheduledActionsClientRunByScopeResponse, error)` +- New function `*SharedScopeBenefitRecommendationProperties.GetBenefitRecommendationProperties() *BenefitRecommendationProperties` +- New function `*SingleScopeBenefitRecommendationProperties.GetBenefitRecommendationProperties() *BenefitRecommendationProperties` +- New struct `AllSavingsBenefitDetails` +- New struct `AllSavingsList` +- New struct `AsyncOperationStatusProperties` +- New struct `BenefitRecommendationModel` +- New struct `BenefitRecommendationsListResult` +- New struct `BenefitResource` +- New struct `BenefitUtilizationSummariesListResult` +- New struct `BenefitUtilizationSummariesOperationStatus` +- New struct `BenefitUtilizationSummariesRequest` +- New struct `BenefitUtilizationSummaryProperties` +- New struct `BlobInfo` +- New struct `CheckNameAvailabilityRequest` +- New struct `CheckNameAvailabilityResponse` +- New struct `CostDetailsOperationResults` +- New struct `CostDetailsTimePeriod` +- New struct `ErrorDetailsWithNestedDetails` +- New struct `ErrorResponseWithNestedDetails` +- New struct `ExportRun` +- New struct `ExportRunProperties` +- New struct `FileDestination` +- New struct `ForecastAggregation` +- New struct `ForecastColumn` +- New struct `ForecastComparisonExpression` +- New struct `ForecastDatasetConfiguration` +- New struct `ForecastFilter` +- New struct `ForecastProperties` +- New struct `ForecastResult` +- New struct `ForecastTimePeriod` +- New struct `GenerateCostDetailsReportErrorResponse` +- New struct `GenerateCostDetailsReportRequestDefinition` +- New struct `IncludedQuantityUtilizationSummary` +- New struct `IncludedQuantityUtilizationSummaryProperties` +- New struct `NotificationProperties` +- New struct `OperationForCostManagement` +- New struct `ProxyResourceForCostManagement` +- New struct `RecommendationUsageDetails` +- New struct `ReportManifest` +- New struct `RequestContext` +- New struct `ResourceForCostManagement` +- New struct `SavingsPlanUtilizationSummary` +- New struct `SavingsPlanUtilizationSummaryProperties` +- New struct `ScheduleProperties` +- New struct `ScheduledAction` +- New struct `ScheduledActionListResult` +- New struct `ScheduledActionProperties` +- New struct `ScheduledActionProxyResource` +- New struct `SharedScopeBenefitRecommendationProperties` +- New struct `SingleScopeBenefitRecommendationProperties` +- New struct `SystemData` +- New field `ExpiryTime` in struct `DownloadURL` +- New anonymous field `ForecastResult` in struct `ForecastClientExternalCloudProviderUsageResponse` +- New anonymous field `ForecastResult` in struct `ForecastClientUsageResponse` +- New field `EndTime`, `StartTime` in struct `GenerateDetailedCostReportOperationStatuses` +- New field `ActionType`, `IsDataAction`, `Origin` in struct `Operation` + + ## 1.1.1 (2023-04-14) ### Bug Fixes diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/alerts_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/alerts_client.go index 3ea95f101c3a..ea01e4393472 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/alerts_client.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/alerts_client.go @@ -44,7 +44,7 @@ func NewAlertsClient(credential azcore.TokenCredential, options *arm.ClientOptio // Dismiss - Dismisses the specified alert // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - scope - The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription // scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for // resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and @@ -83,7 +83,7 @@ func (client *AlertsClient) dismissCreateRequest(ctx context.Context, scope stri return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -101,7 +101,7 @@ func (client *AlertsClient) dismissHandleResponse(resp *http.Response) (AlertsCl // Get - Gets the alert for the scope by alert ID. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - scope - The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription // scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for // resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and @@ -139,7 +139,7 @@ func (client *AlertsClient) getCreateRequest(ctx context.Context, scope string, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -157,7 +157,7 @@ func (client *AlertsClient) getHandleResponse(resp *http.Response) (AlertsClient // List - Lists the alerts for scope defined. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - scope - The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription // scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for // resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and @@ -193,7 +193,7 @@ func (client *AlertsClient) listCreateRequest(ctx context.Context, scope string, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -211,7 +211,7 @@ func (client *AlertsClient) listHandleResponse(resp *http.Response) (AlertsClien // ListExternal - Lists the Alerts for external cloud provider type defined. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - externalCloudProviderType - The external cloud provider type associated with dimension/query operations. This includes // 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. // - externalCloudProviderID - This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for @@ -248,7 +248,7 @@ func (client *AlertsClient) listExternalCreateRequest(ctx context.Context, exter return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/alerts_client_example_test.go b/sdk/resourcemanager/costmanagement/armcostmanagement/alerts_client_example_test.go deleted file mode 100644 index afd6ec3c3008..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/alerts_client_example_test.go +++ /dev/null @@ -1,1282 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcostmanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingAccountAlerts.json -func ExampleAlertsClient_List_billingAccountAlerts() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertsClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AlertsResult = armcostmanagement.AlertsResult{ - // Value: []*armcostmanagement.Alert{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.CostManagement/alerts"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/providers/Microsoft.CostManagement/alerts/00000000-0000-0000-0000-000000000000"), - // Properties: &armcostmanagement.AlertProperties{ - // Description: to.Ptr(""), - // CloseTime: to.Ptr("0001-01-01T00:00:00"), - // CostEntityID: to.Ptr("budget1"), - // CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"), - // Definition: &armcostmanagement.AlertPropertiesDefinition{ - // Type: to.Ptr(armcostmanagement.AlertTypeBudget), - // Category: to.Ptr(armcostmanagement.AlertCategoryCost), - // Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded), - // }, - // ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"), - // Source: to.Ptr(armcostmanagement.AlertSourcePreset), - // Status: to.Ptr(armcostmanagement.AlertStatusActive), - // StatusModificationTime: to.Ptr("0001-01-01T00:00:00"), - // Details: &armcostmanagement.AlertPropertiesDetails{ - // Amount: to.Ptr[float64](200000), - // ContactEmails: []*string{ - // to.Ptr("1234@contoso.com")}, - // ContactGroups: []*string{ - // }, - // ContactRoles: []*string{ - // }, - // CurrentSpend: to.Ptr[float64](161000.12), - // MeterFilter: []any{ - // }, - // Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan), - // PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"), - // ResourceFilter: []any{ - // }, - // ResourceGroupFilter: []any{ - // }, - // TagFilter: map[string]any{ - // }, - // Threshold: to.Ptr[float64](0.8), - // TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly), - // TriggeredBy: to.Ptr("00000000-0000-0000-0000-000000000000_1_01"), - // Unit: to.Ptr("USD"), - // }, - // }, - // }, - // { - // Name: to.Ptr("11111111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.CostManagement/alerts"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/providers/Microsoft.CostManagement/alerts/11111111-1111-1111-111111111111"), - // Properties: &armcostmanagement.AlertProperties{ - // Description: to.Ptr(""), - // CloseTime: to.Ptr("0001-01-01T00:00:00"), - // CostEntityID: to.Ptr("budget1"), - // CreationTime: to.Ptr("2019-06-24T05:51:52.8713179Z"), - // Definition: &armcostmanagement.AlertPropertiesDefinition{ - // Type: to.Ptr(armcostmanagement.AlertTypeBudget), - // Category: to.Ptr(armcostmanagement.AlertCategoryCost), - // Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded), - // }, - // ModificationTime: to.Ptr("2019-08-31T17:51:55.1808807Z"), - // Source: to.Ptr(armcostmanagement.AlertSourcePreset), - // Status: to.Ptr(armcostmanagement.AlertStatusActive), - // StatusModificationTime: to.Ptr("0001-01-01T00:00:00"), - // Details: &armcostmanagement.AlertPropertiesDetails{ - // Amount: to.Ptr[float64](200000), - // ContactEmails: []*string{ - // to.Ptr("1234@contoso.com")}, - // ContactGroups: []*string{ - // }, - // ContactRoles: []*string{ - // }, - // CurrentSpend: to.Ptr[float64](171000.32), - // MeterFilter: []any{ - // }, - // Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan), - // PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"), - // ResourceFilter: []any{ - // }, - // ResourceGroupFilter: []any{ - // }, - // TagFilter: map[string]any{ - // }, - // Threshold: to.Ptr[float64](0.8), - // TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly), - // TriggeredBy: to.Ptr("11111111-1111-1111-111111111111_1_01"), - // Unit: to.Ptr("USD"), - // }, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingProfileAlerts.json -func ExampleAlertsClient_List_billingProfileAlerts() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertsClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AlertsResult = armcostmanagement.AlertsResult{ - // Value: []*armcostmanagement.Alert{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.CostManagement/alerts"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/alerts/00000000-0000-0000-0000-000000000000"), - // Properties: &armcostmanagement.AlertProperties{ - // Description: to.Ptr(""), - // CloseTime: to.Ptr("0001-01-01T00:00:00"), - // CostEntityID: to.Ptr("budget1"), - // CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"), - // Definition: &armcostmanagement.AlertPropertiesDefinition{ - // Type: to.Ptr(armcostmanagement.AlertTypeBudget), - // Category: to.Ptr(armcostmanagement.AlertCategoryCost), - // Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded), - // }, - // ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"), - // Source: to.Ptr(armcostmanagement.AlertSourcePreset), - // Status: to.Ptr(armcostmanagement.AlertStatusActive), - // StatusModificationTime: to.Ptr("0001-01-01T00:00:00"), - // Details: &armcostmanagement.AlertPropertiesDetails{ - // Amount: to.Ptr[float64](200000), - // ContactEmails: []*string{ - // to.Ptr("1234@contoso.com")}, - // ContactGroups: []*string{ - // }, - // ContactRoles: []*string{ - // }, - // CurrentSpend: to.Ptr[float64](161000.12), - // MeterFilter: []any{ - // }, - // Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan), - // PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"), - // ResourceFilter: []any{ - // }, - // ResourceGroupFilter: []any{ - // }, - // TagFilter: map[string]any{ - // }, - // Threshold: to.Ptr[float64](0.8), - // TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly), - // TriggeredBy: to.Ptr("00000000-0000-0000-0000-000000000000_1_01"), - // Unit: to.Ptr("USD"), - // }, - // }, - // }, - // { - // Name: to.Ptr("11111111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.CostManagement/alerts"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/alerts/11111111-1111-1111-111111111111"), - // Properties: &armcostmanagement.AlertProperties{ - // Description: to.Ptr(""), - // CloseTime: to.Ptr("0001-01-01T00:00:00"), - // CostEntityID: to.Ptr("budget1"), - // CreationTime: to.Ptr("2019-06-24T05:51:52.8713179Z"), - // Definition: &armcostmanagement.AlertPropertiesDefinition{ - // Type: to.Ptr(armcostmanagement.AlertTypeBudget), - // Category: to.Ptr(armcostmanagement.AlertCategoryCost), - // Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded), - // }, - // ModificationTime: to.Ptr("2019-08-31T17:51:55.1808807Z"), - // Source: to.Ptr(armcostmanagement.AlertSourcePreset), - // Status: to.Ptr(armcostmanagement.AlertStatusActive), - // StatusModificationTime: to.Ptr("0001-01-01T00:00:00"), - // Details: &armcostmanagement.AlertPropertiesDetails{ - // Amount: to.Ptr[float64](200000), - // ContactEmails: []*string{ - // to.Ptr("1234@contoso.com")}, - // ContactGroups: []*string{ - // }, - // ContactRoles: []*string{ - // }, - // CurrentSpend: to.Ptr[float64](171000.32), - // MeterFilter: []any{ - // }, - // Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan), - // PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"), - // ResourceFilter: []any{ - // }, - // ResourceGroupFilter: []any{ - // }, - // TagFilter: map[string]any{ - // }, - // Threshold: to.Ptr[float64](0.8), - // TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly), - // TriggeredBy: to.Ptr("11111111-1111-1111-111111111111_1_01"), - // Unit: to.Ptr("USD"), - // }, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/DepartmentAlerts.json -func ExampleAlertsClient_List_departmentAlerts() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertsClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AlertsResult = armcostmanagement.AlertsResult{ - // Value: []*armcostmanagement.Alert{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.CostManagement/alerts"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123/providers/Microsoft.CostManagement/alerts/00000000-0000-0000-0000-000000000000"), - // Properties: &armcostmanagement.AlertProperties{ - // Description: to.Ptr(""), - // CloseTime: to.Ptr("0001-01-01T00:00:00"), - // CostEntityID: to.Ptr("budget1"), - // CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"), - // Definition: &armcostmanagement.AlertPropertiesDefinition{ - // Type: to.Ptr(armcostmanagement.AlertTypeBudget), - // Category: to.Ptr(armcostmanagement.AlertCategoryCost), - // Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded), - // }, - // ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"), - // Source: to.Ptr(armcostmanagement.AlertSourcePreset), - // Status: to.Ptr(armcostmanagement.AlertStatusActive), - // StatusModificationTime: to.Ptr("0001-01-01T00:00:00"), - // Details: &armcostmanagement.AlertPropertiesDetails{ - // Amount: to.Ptr[float64](200000), - // ContactEmails: []*string{ - // to.Ptr("1234@contoso.com")}, - // ContactGroups: []*string{ - // }, - // ContactRoles: []*string{ - // }, - // CurrentSpend: to.Ptr[float64](161000.12), - // MeterFilter: []any{ - // }, - // Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan), - // PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"), - // ResourceFilter: []any{ - // }, - // ResourceGroupFilter: []any{ - // }, - // TagFilter: map[string]any{ - // }, - // Threshold: to.Ptr[float64](0.8), - // TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly), - // TriggeredBy: to.Ptr("00000000-0000-0000-0000-000000000000_1_01"), - // Unit: to.Ptr("USD"), - // }, - // }, - // }, - // { - // Name: to.Ptr("11111111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.CostManagement/alerts"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123/providers/Microsoft.CostManagement/alerts/11111111-1111-1111-111111111111"), - // Properties: &armcostmanagement.AlertProperties{ - // Description: to.Ptr(""), - // CloseTime: to.Ptr("0001-01-01T00:00:00"), - // CostEntityID: to.Ptr("budget1"), - // CreationTime: to.Ptr("2019-06-24T05:51:52.8713179Z"), - // Definition: &armcostmanagement.AlertPropertiesDefinition{ - // Type: to.Ptr(armcostmanagement.AlertTypeBudget), - // Category: to.Ptr(armcostmanagement.AlertCategoryCost), - // Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded), - // }, - // ModificationTime: to.Ptr("2019-08-31T17:51:55.1808807Z"), - // Source: to.Ptr(armcostmanagement.AlertSourcePreset), - // Status: to.Ptr(armcostmanagement.AlertStatusActive), - // StatusModificationTime: to.Ptr("0001-01-01T00:00:00"), - // Details: &armcostmanagement.AlertPropertiesDetails{ - // Amount: to.Ptr[float64](200000), - // ContactEmails: []*string{ - // to.Ptr("1234@contoso.com")}, - // ContactGroups: []*string{ - // }, - // ContactRoles: []*string{ - // }, - // CurrentSpend: to.Ptr[float64](171000.32), - // MeterFilter: []any{ - // }, - // Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan), - // PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"), - // ResourceFilter: []any{ - // }, - // ResourceGroupFilter: []any{ - // }, - // TagFilter: map[string]any{ - // }, - // Threshold: to.Ptr[float64](0.8), - // TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly), - // TriggeredBy: to.Ptr("11111111-1111-1111-111111111111_1_01"), - // Unit: to.Ptr("USD"), - // }, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/EnrollmentAccountAlerts.json -func ExampleAlertsClient_List_enrollmentAccountAlerts() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertsClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AlertsResult = armcostmanagement.AlertsResult{ - // Value: []*armcostmanagement.Alert{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.CostManagement/alerts"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456/providers/Microsoft.CostManagement/alerts/00000000-0000-0000-0000-000000000000"), - // Properties: &armcostmanagement.AlertProperties{ - // Description: to.Ptr(""), - // CloseTime: to.Ptr("0001-01-01T00:00:00"), - // CostEntityID: to.Ptr("budget1"), - // CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"), - // Definition: &armcostmanagement.AlertPropertiesDefinition{ - // Type: to.Ptr(armcostmanagement.AlertTypeBudget), - // Category: to.Ptr(armcostmanagement.AlertCategoryCost), - // Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded), - // }, - // ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"), - // Source: to.Ptr(armcostmanagement.AlertSourcePreset), - // Status: to.Ptr(armcostmanagement.AlertStatusActive), - // StatusModificationTime: to.Ptr("0001-01-01T00:00:00"), - // Details: &armcostmanagement.AlertPropertiesDetails{ - // Amount: to.Ptr[float64](200000), - // ContactEmails: []*string{ - // to.Ptr("1234@contoso.com")}, - // ContactGroups: []*string{ - // }, - // ContactRoles: []*string{ - // }, - // CurrentSpend: to.Ptr[float64](161000.12), - // MeterFilter: []any{ - // }, - // Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan), - // PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"), - // ResourceFilter: []any{ - // }, - // ResourceGroupFilter: []any{ - // }, - // TagFilter: map[string]any{ - // }, - // Threshold: to.Ptr[float64](0.8), - // TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly), - // TriggeredBy: to.Ptr("00000000-0000-0000-0000-000000000000_1_01"), - // Unit: to.Ptr("USD"), - // }, - // }, - // }, - // { - // Name: to.Ptr("11111111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.CostManagement/alerts"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456/providers/Microsoft.CostManagement/alerts/11111111-1111-1111-111111111111"), - // Properties: &armcostmanagement.AlertProperties{ - // Description: to.Ptr(""), - // CloseTime: to.Ptr("0001-01-01T00:00:00"), - // CostEntityID: to.Ptr("budget1"), - // CreationTime: to.Ptr("2019-06-24T05:51:52.8713179Z"), - // Definition: &armcostmanagement.AlertPropertiesDefinition{ - // Type: to.Ptr(armcostmanagement.AlertTypeBudget), - // Category: to.Ptr(armcostmanagement.AlertCategoryCost), - // Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded), - // }, - // ModificationTime: to.Ptr("2019-08-31T17:51:55.1808807Z"), - // Source: to.Ptr(armcostmanagement.AlertSourcePreset), - // Status: to.Ptr(armcostmanagement.AlertStatusActive), - // StatusModificationTime: to.Ptr("0001-01-01T00:00:00"), - // Details: &armcostmanagement.AlertPropertiesDetails{ - // Amount: to.Ptr[float64](200000), - // ContactEmails: []*string{ - // to.Ptr("1234@contoso.com")}, - // ContactGroups: []*string{ - // }, - // ContactRoles: []*string{ - // }, - // CurrentSpend: to.Ptr[float64](171000.32), - // MeterFilter: []any{ - // }, - // Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan), - // PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"), - // ResourceFilter: []any{ - // }, - // ResourceGroupFilter: []any{ - // }, - // TagFilter: map[string]any{ - // }, - // Threshold: to.Ptr[float64](0.8), - // TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly), - // TriggeredBy: to.Ptr("11111111-1111-1111-111111111111_1_01"), - // Unit: to.Ptr("USD"), - // }, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/InvoiceSectionAlerts.json -func ExampleAlertsClient_List_invoiceSectionAlerts() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertsClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AlertsResult = armcostmanagement.AlertsResult{ - // Value: []*armcostmanagement.Alert{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.CostManagement/alerts"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/Microsoft.CostManagement/alerts/00000000-0000-0000-0000-000000000000"), - // Properties: &armcostmanagement.AlertProperties{ - // Description: to.Ptr(""), - // CloseTime: to.Ptr("0001-01-01T00:00:00"), - // CostEntityID: to.Ptr("budget1"), - // CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"), - // Definition: &armcostmanagement.AlertPropertiesDefinition{ - // Type: to.Ptr(armcostmanagement.AlertTypeBudget), - // Category: to.Ptr(armcostmanagement.AlertCategoryCost), - // Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded), - // }, - // ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"), - // Source: to.Ptr(armcostmanagement.AlertSourcePreset), - // Status: to.Ptr(armcostmanagement.AlertStatusActive), - // StatusModificationTime: to.Ptr("0001-01-01T00:00:00"), - // Details: &armcostmanagement.AlertPropertiesDetails{ - // Amount: to.Ptr[float64](200000), - // ContactEmails: []*string{ - // to.Ptr("1234@contoso.com")}, - // ContactGroups: []*string{ - // }, - // ContactRoles: []*string{ - // }, - // CurrentSpend: to.Ptr[float64](161000.12), - // MeterFilter: []any{ - // }, - // Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan), - // PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"), - // ResourceFilter: []any{ - // }, - // ResourceGroupFilter: []any{ - // }, - // TagFilter: map[string]any{ - // }, - // Threshold: to.Ptr[float64](0.8), - // TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly), - // TriggeredBy: to.Ptr("00000000-0000-0000-0000-000000000000_1_01"), - // Unit: to.Ptr("USD"), - // }, - // }, - // }, - // { - // Name: to.Ptr("11111111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.CostManagement/alerts"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/Microsoft.CostManagement/alerts/11111111-1111-1111-111111111111"), - // Properties: &armcostmanagement.AlertProperties{ - // Description: to.Ptr(""), - // CloseTime: to.Ptr("0001-01-01T00:00:00"), - // CostEntityID: to.Ptr("budget1"), - // CreationTime: to.Ptr("2019-06-24T05:51:52.8713179Z"), - // Definition: &armcostmanagement.AlertPropertiesDefinition{ - // Type: to.Ptr(armcostmanagement.AlertTypeBudget), - // Category: to.Ptr(armcostmanagement.AlertCategoryCost), - // Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded), - // }, - // ModificationTime: to.Ptr("2019-08-31T17:51:55.1808807Z"), - // Source: to.Ptr(armcostmanagement.AlertSourcePreset), - // Status: to.Ptr(armcostmanagement.AlertStatusActive), - // StatusModificationTime: to.Ptr("0001-01-01T00:00:00"), - // Details: &armcostmanagement.AlertPropertiesDetails{ - // Amount: to.Ptr[float64](200000), - // ContactEmails: []*string{ - // to.Ptr("1234@contoso.com")}, - // ContactGroups: []*string{ - // }, - // ContactRoles: []*string{ - // }, - // CurrentSpend: to.Ptr[float64](171000.32), - // MeterFilter: []any{ - // }, - // Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan), - // PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"), - // ResourceFilter: []any{ - // }, - // ResourceGroupFilter: []any{ - // }, - // TagFilter: map[string]any{ - // }, - // Threshold: to.Ptr[float64](0.8), - // TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly), - // TriggeredBy: to.Ptr("11111111-1111-1111-111111111111_1_01"), - // Unit: to.Ptr("USD"), - // }, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ResourceGroupAlerts.json -func ExampleAlertsClient_List_resourceGroupAlerts() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertsClient().List(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AlertsResult = armcostmanagement.AlertsResult{ - // Value: []*armcostmanagement.Alert{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.CostManagement/alerts"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer/providers/Microsoft.CostManagement/alerts/00000000-0000-0000-0000-000000000000"), - // Properties: &armcostmanagement.AlertProperties{ - // Description: to.Ptr(""), - // CloseTime: to.Ptr("0001-01-01T00:00:00"), - // CostEntityID: to.Ptr("budget1"), - // CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"), - // Definition: &armcostmanagement.AlertPropertiesDefinition{ - // Type: to.Ptr(armcostmanagement.AlertTypeBudget), - // Category: to.Ptr(armcostmanagement.AlertCategoryCost), - // Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded), - // }, - // ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"), - // Source: to.Ptr(armcostmanagement.AlertSourcePreset), - // Status: to.Ptr(armcostmanagement.AlertStatusActive), - // StatusModificationTime: to.Ptr("0001-01-01T00:00:00"), - // Details: &armcostmanagement.AlertPropertiesDetails{ - // Amount: to.Ptr[float64](200000), - // ContactEmails: []*string{ - // to.Ptr("1234@contoso.com")}, - // ContactGroups: []*string{ - // }, - // ContactRoles: []*string{ - // }, - // CurrentSpend: to.Ptr[float64](161000.12), - // MeterFilter: []any{ - // }, - // Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan), - // PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"), - // ResourceFilter: []any{ - // }, - // ResourceGroupFilter: []any{ - // }, - // TagFilter: map[string]any{ - // }, - // Threshold: to.Ptr[float64](0.8), - // TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly), - // TriggeredBy: to.Ptr("00000000-0000-0000-0000-000000000000_1_01"), - // Unit: to.Ptr("USD"), - // }, - // }, - // }, - // { - // Name: to.Ptr("11111111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.CostManagement/alerts"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer/providers/Microsoft.CostManagement/alerts/11111111-1111-1111-111111111111"), - // Properties: &armcostmanagement.AlertProperties{ - // Description: to.Ptr(""), - // CloseTime: to.Ptr("0001-01-01T00:00:00"), - // CostEntityID: to.Ptr("budget1"), - // CreationTime: to.Ptr("2019-06-24T05:51:52.8713179Z"), - // Definition: &armcostmanagement.AlertPropertiesDefinition{ - // Type: to.Ptr(armcostmanagement.AlertTypeBudget), - // Category: to.Ptr(armcostmanagement.AlertCategoryCost), - // Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded), - // }, - // ModificationTime: to.Ptr("2019-08-31T17:51:55.1808807Z"), - // Source: to.Ptr(armcostmanagement.AlertSourcePreset), - // Status: to.Ptr(armcostmanagement.AlertStatusActive), - // StatusModificationTime: to.Ptr("0001-01-01T00:00:00"), - // Details: &armcostmanagement.AlertPropertiesDetails{ - // Amount: to.Ptr[float64](200000), - // ContactEmails: []*string{ - // to.Ptr("1234@contoso.com")}, - // ContactGroups: []*string{ - // }, - // ContactRoles: []*string{ - // }, - // CurrentSpend: to.Ptr[float64](171000.32), - // MeterFilter: []any{ - // }, - // Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan), - // PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"), - // ResourceFilter: []any{ - // }, - // ResourceGroupFilter: []any{ - // }, - // TagFilter: map[string]any{ - // }, - // Threshold: to.Ptr[float64](0.8), - // TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly), - // TriggeredBy: to.Ptr("11111111-1111-1111-111111111111_1_01"), - // Unit: to.Ptr("USD"), - // }, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/SubscriptionAlerts.json -func ExampleAlertsClient_List_subscriptionAlerts() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertsClient().List(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AlertsResult = armcostmanagement.AlertsResult{ - // Value: []*armcostmanagement.Alert{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.CostManagement/alerts"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/alerts/00000000-0000-0000-0000-000000000000"), - // Properties: &armcostmanagement.AlertProperties{ - // Description: to.Ptr(""), - // CloseTime: to.Ptr("0001-01-01T00:00:00"), - // CostEntityID: to.Ptr("budget1"), - // CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"), - // Definition: &armcostmanagement.AlertPropertiesDefinition{ - // Type: to.Ptr(armcostmanagement.AlertTypeBudget), - // Category: to.Ptr(armcostmanagement.AlertCategoryCost), - // Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded), - // }, - // ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"), - // Source: to.Ptr(armcostmanagement.AlertSourcePreset), - // Status: to.Ptr(armcostmanagement.AlertStatusActive), - // StatusModificationTime: to.Ptr("0001-01-01T00:00:00"), - // Details: &armcostmanagement.AlertPropertiesDetails{ - // Amount: to.Ptr[float64](200000), - // ContactEmails: []*string{ - // to.Ptr("1234@contoso.com")}, - // ContactGroups: []*string{ - // }, - // ContactRoles: []*string{ - // }, - // CurrentSpend: to.Ptr[float64](161000.12), - // MeterFilter: []any{ - // }, - // Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan), - // PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"), - // ResourceFilter: []any{ - // }, - // ResourceGroupFilter: []any{ - // }, - // TagFilter: map[string]any{ - // }, - // Threshold: to.Ptr[float64](0.8), - // TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly), - // TriggeredBy: to.Ptr("00000000-0000-0000-0000-000000000000_1_01"), - // Unit: to.Ptr("USD"), - // }, - // }, - // }, - // { - // Name: to.Ptr("11111111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.CostManagement/alerts"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/alerts/11111111-1111-1111-111111111111"), - // Properties: &armcostmanagement.AlertProperties{ - // Description: to.Ptr(""), - // CloseTime: to.Ptr("0001-01-01T00:00:00"), - // CostEntityID: to.Ptr("budget1"), - // CreationTime: to.Ptr("2019-06-24T05:51:52.8713179Z"), - // Definition: &armcostmanagement.AlertPropertiesDefinition{ - // Type: to.Ptr(armcostmanagement.AlertTypeBudget), - // Category: to.Ptr(armcostmanagement.AlertCategoryCost), - // Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded), - // }, - // ModificationTime: to.Ptr("2019-08-31T17:51:55.1808807Z"), - // Source: to.Ptr(armcostmanagement.AlertSourcePreset), - // Status: to.Ptr(armcostmanagement.AlertStatusActive), - // StatusModificationTime: to.Ptr("0001-01-01T00:00:00"), - // Details: &armcostmanagement.AlertPropertiesDetails{ - // Amount: to.Ptr[float64](200000), - // ContactEmails: []*string{ - // to.Ptr("1234@contoso.com")}, - // ContactGroups: []*string{ - // }, - // ContactRoles: []*string{ - // }, - // CurrentSpend: to.Ptr[float64](171000.32), - // MeterFilter: []any{ - // }, - // Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan), - // PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"), - // ResourceFilter: []any{ - // }, - // ResourceGroupFilter: []any{ - // }, - // TagFilter: map[string]any{ - // }, - // Threshold: to.Ptr[float64](0.8), - // TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly), - // TriggeredBy: to.Ptr("11111111-1111-1111-111111111111_1_01"), - // Unit: to.Ptr("USD"), - // }, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/SingleResourceGroupAlert.json -func ExampleAlertsClient_Get_singleResourceGroupAlerts() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", "22222222-2222-2222-2222-222222222222", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Alert = armcostmanagement.Alert{ - // Name: to.Ptr("22222222-2222-2222-2222-222222222222"), - // Type: to.Ptr("Microsoft.CostManagement/alerts"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer/providers/Microsoft.CostManagement/alerts/22222222-2222-2222-2222-222222222222"), - // Properties: &armcostmanagement.AlertProperties{ - // Description: to.Ptr(""), - // CloseTime: to.Ptr("0001-01-01T00:00:00"), - // CostEntityID: to.Ptr("budget1"), - // CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"), - // Definition: &armcostmanagement.AlertPropertiesDefinition{ - // Type: to.Ptr(armcostmanagement.AlertTypeBudget), - // Category: to.Ptr(armcostmanagement.AlertCategoryCost), - // Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded), - // }, - // ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"), - // Source: to.Ptr(armcostmanagement.AlertSourcePreset), - // Status: to.Ptr(armcostmanagement.AlertStatusActive), - // StatusModificationTime: to.Ptr("0001-01-01T00:00:00"), - // Details: &armcostmanagement.AlertPropertiesDetails{ - // Amount: to.Ptr[float64](200000), - // ContactEmails: []*string{ - // to.Ptr("1234@contoso.com")}, - // ContactGroups: []*string{ - // }, - // ContactRoles: []*string{ - // }, - // CurrentSpend: to.Ptr[float64](161000.12), - // MeterFilter: []any{ - // }, - // Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan), - // PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"), - // ResourceFilter: []any{ - // }, - // ResourceGroupFilter: []any{ - // }, - // TagFilter: map[string]any{ - // }, - // Threshold: to.Ptr[float64](0.8), - // TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly), - // TriggeredBy: to.Ptr("22222222-2222-2222-2222-222222222222_1_01"), - // Unit: to.Ptr("USD"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/SingleSubscriptionAlert.json -func ExampleAlertsClient_Get_singleSubscriptionAlerts() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "22222222-2222-2222-2222-222222222222", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Alert = armcostmanagement.Alert{ - // Name: to.Ptr("22222222-2222-2222-2222-222222222222"), - // Type: to.Ptr("Microsoft.CostManagement/alerts"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/alerts/22222222-2222-2222-2222-222222222222"), - // Properties: &armcostmanagement.AlertProperties{ - // Description: to.Ptr(""), - // CloseTime: to.Ptr("0001-01-01T00:00:00"), - // CostEntityID: to.Ptr("budget1"), - // CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"), - // Definition: &armcostmanagement.AlertPropertiesDefinition{ - // Type: to.Ptr(armcostmanagement.AlertTypeBudget), - // Category: to.Ptr(armcostmanagement.AlertCategoryCost), - // Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded), - // }, - // ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"), - // Source: to.Ptr(armcostmanagement.AlertSourcePreset), - // Status: to.Ptr(armcostmanagement.AlertStatusActive), - // StatusModificationTime: to.Ptr("0001-01-01T00:00:00"), - // Details: &armcostmanagement.AlertPropertiesDetails{ - // Amount: to.Ptr[float64](200000), - // ContactEmails: []*string{ - // to.Ptr("1234@contoso.com")}, - // ContactGroups: []*string{ - // }, - // ContactRoles: []*string{ - // }, - // CurrentSpend: to.Ptr[float64](161000.12), - // MeterFilter: []any{ - // }, - // Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan), - // PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"), - // ResourceFilter: []any{ - // }, - // ResourceGroupFilter: []any{ - // }, - // TagFilter: map[string]any{ - // }, - // Threshold: to.Ptr[float64](0.8), - // TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly), - // TriggeredBy: to.Ptr("22222222-2222-2222-2222-222222222222_1_01"), - // Unit: to.Ptr("USD"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/DismissResourceGroupAlerts.json -func ExampleAlertsClient_Dismiss_patchResourceGroupAlerts() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertsClient().Dismiss(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", "22222222-2222-2222-2222-222222222222", armcostmanagement.DismissAlertPayload{ - Properties: &armcostmanagement.AlertProperties{ - Status: to.Ptr(armcostmanagement.AlertStatusDismissed), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Alert = armcostmanagement.Alert{ - // Name: to.Ptr("22222222-2222-2222-2222-222222222222"), - // Type: to.Ptr("Microsoft.CostManagement/alerts"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer/providers/Microsoft.CostManagement/alerts/22222222-2222-2222-2222-222222222222"), - // Properties: &armcostmanagement.AlertProperties{ - // Description: to.Ptr(""), - // CloseTime: to.Ptr("0001-01-01T00:00:00"), - // CostEntityID: to.Ptr("budget1"), - // CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"), - // Definition: &armcostmanagement.AlertPropertiesDefinition{ - // Type: to.Ptr(armcostmanagement.AlertTypeBudget), - // Category: to.Ptr(armcostmanagement.AlertCategoryCost), - // Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded), - // }, - // ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"), - // Source: to.Ptr(armcostmanagement.AlertSourcePreset), - // Status: to.Ptr(armcostmanagement.AlertStatusDismissed), - // StatusModificationTime: to.Ptr("0001-01-01T00:00:00"), - // Details: &armcostmanagement.AlertPropertiesDetails{ - // Amount: to.Ptr[float64](200000), - // ContactEmails: []*string{ - // to.Ptr("1234@contoso.com")}, - // ContactGroups: []*string{ - // }, - // ContactRoles: []*string{ - // }, - // CurrentSpend: to.Ptr[float64](161000.12), - // MeterFilter: []any{ - // }, - // Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan), - // PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"), - // ResourceFilter: []any{ - // }, - // ResourceGroupFilter: []any{ - // }, - // TagFilter: map[string]any{ - // }, - // Threshold: to.Ptr[float64](0.8), - // TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly), - // TriggeredBy: to.Ptr("22222222-2222-2222-2222-222222222222_1_01"), - // Unit: to.Ptr("USD"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/DismissSubscriptionAlerts.json -func ExampleAlertsClient_Dismiss_patchSubscriptionAlerts() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertsClient().Dismiss(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "22222222-2222-2222-2222-222222222222", armcostmanagement.DismissAlertPayload{ - Properties: &armcostmanagement.AlertProperties{ - Status: to.Ptr(armcostmanagement.AlertStatusDismissed), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Alert = armcostmanagement.Alert{ - // Name: to.Ptr("22222222-2222-2222-2222-222222222222"), - // Type: to.Ptr("Microsoft.CostManagement/alerts"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/alerts/22222222-2222-2222-2222-222222222222"), - // Properties: &armcostmanagement.AlertProperties{ - // Description: to.Ptr(""), - // CloseTime: to.Ptr("0001-01-01T00:00:00"), - // CostEntityID: to.Ptr("budget1"), - // CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"), - // Definition: &armcostmanagement.AlertPropertiesDefinition{ - // Type: to.Ptr(armcostmanagement.AlertTypeBudget), - // Category: to.Ptr(armcostmanagement.AlertCategoryCost), - // Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded), - // }, - // ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"), - // Source: to.Ptr(armcostmanagement.AlertSourcePreset), - // Status: to.Ptr(armcostmanagement.AlertStatusDismissed), - // StatusModificationTime: to.Ptr("0001-01-01T00:00:00"), - // Details: &armcostmanagement.AlertPropertiesDetails{ - // Amount: to.Ptr[float64](200000), - // ContactEmails: []*string{ - // to.Ptr("1234@contoso.com")}, - // ContactGroups: []*string{ - // }, - // ContactRoles: []*string{ - // }, - // CurrentSpend: to.Ptr[float64](161000.12), - // MeterFilter: []any{ - // }, - // Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan), - // PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"), - // ResourceFilter: []any{ - // }, - // ResourceGroupFilter: []any{ - // }, - // TagFilter: map[string]any{ - // }, - // Threshold: to.Ptr[float64](0.8), - // TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly), - // TriggeredBy: to.Ptr("22222222-2222-2222-2222-222222222222_1_01"), - // Unit: to.Ptr("USD"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalBillingAccountAlerts.json -func ExampleAlertsClient_ListExternal_externalBillingAccountAlerts() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertsClient().ListExternal(ctx, armcostmanagement.ExternalCloudProviderTypeExternalBillingAccounts, "100", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AlertsResult = armcostmanagement.AlertsResult{ - // Value: []*armcostmanagement.Alert{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.CostManagement/alerts"), - // ID: to.Ptr("providers/Microsoft.CostManagement/externalBillingAccounts/100/providers/Microsoft.CostManagement/alerts/00000000-0000-0000-0000-000000000000"), - // Properties: &armcostmanagement.AlertProperties{ - // Description: to.Ptr(""), - // CloseTime: to.Ptr("0001-01-01T00:00:00"), - // CostEntityID: to.Ptr("budget1"), - // CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"), - // Definition: &armcostmanagement.AlertPropertiesDefinition{ - // Type: to.Ptr(armcostmanagement.AlertTypeBudget), - // Category: to.Ptr(armcostmanagement.AlertCategoryCost), - // Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded), - // }, - // ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"), - // Source: to.Ptr(armcostmanagement.AlertSourcePreset), - // Status: to.Ptr(armcostmanagement.AlertStatusActive), - // StatusModificationTime: to.Ptr("0001-01-01T00:00:00"), - // Details: &armcostmanagement.AlertPropertiesDetails{ - // Amount: to.Ptr[float64](200000), - // ContactEmails: []*string{ - // to.Ptr("1234@contoso.com")}, - // ContactGroups: []*string{ - // }, - // ContactRoles: []*string{ - // }, - // CurrentSpend: to.Ptr[float64](161000.12), - // MeterFilter: []any{ - // }, - // Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan), - // PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"), - // ResourceFilter: []any{ - // }, - // ResourceGroupFilter: []any{ - // }, - // TagFilter: map[string]any{ - // }, - // Threshold: to.Ptr[float64](0.8), - // TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly), - // TriggeredBy: to.Ptr("00000000-0000-0000-0000-000000000000_1_01"), - // Unit: to.Ptr("USD"), - // }, - // }, - // }, - // { - // Name: to.Ptr("11111111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.CostManagement/alerts"), - // ID: to.Ptr("providers/Microsoft.CostManagement/externalBillingAccounts/100/providers/Microsoft.CostManagement/alerts/11111111-1111-1111-111111111111"), - // Properties: &armcostmanagement.AlertProperties{ - // Description: to.Ptr(""), - // CloseTime: to.Ptr("0001-01-01T00:00:00"), - // CostEntityID: to.Ptr("budget1"), - // CreationTime: to.Ptr("2019-06-24T05:51:52.8713179Z"), - // Definition: &armcostmanagement.AlertPropertiesDefinition{ - // Type: to.Ptr(armcostmanagement.AlertTypeBudget), - // Category: to.Ptr(armcostmanagement.AlertCategoryCost), - // Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded), - // }, - // ModificationTime: to.Ptr("2019-08-31T17:51:55.1808807Z"), - // Source: to.Ptr(armcostmanagement.AlertSourcePreset), - // Status: to.Ptr(armcostmanagement.AlertStatusActive), - // StatusModificationTime: to.Ptr("0001-01-01T00:00:00"), - // Details: &armcostmanagement.AlertPropertiesDetails{ - // Amount: to.Ptr[float64](200000), - // ContactEmails: []*string{ - // to.Ptr("1234@contoso.com")}, - // ContactGroups: []*string{ - // }, - // ContactRoles: []*string{ - // }, - // CurrentSpend: to.Ptr[float64](171000.32), - // MeterFilter: []any{ - // }, - // Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan), - // PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"), - // ResourceFilter: []any{ - // }, - // ResourceGroupFilter: []any{ - // }, - // TagFilter: map[string]any{ - // }, - // Threshold: to.Ptr[float64](0.8), - // TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly), - // TriggeredBy: to.Ptr("11111111-1111-1111-111111111111_1_01"), - // Unit: to.Ptr("USD"), - // }, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalSubscriptionAlerts.json -func ExampleAlertsClient_ListExternal_externalSubscriptionAlerts() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertsClient().ListExternal(ctx, armcostmanagement.ExternalCloudProviderTypeExternalSubscriptions, "100", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AlertsResult = armcostmanagement.AlertsResult{ - // Value: []*armcostmanagement.Alert{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.CostManagement/alerts"), - // ID: to.Ptr("providers/Microsoft.CostManagement/externalSubscriptions/100/providers/Microsoft.CostManagement/alerts/00000000-0000-0000-0000-000000000000"), - // Properties: &armcostmanagement.AlertProperties{ - // Description: to.Ptr(""), - // CloseTime: to.Ptr("0001-01-01T00:00:00"), - // CostEntityID: to.Ptr("budget1"), - // CreationTime: to.Ptr("2020-04-27T11:07:52.7143901Z"), - // Definition: &armcostmanagement.AlertPropertiesDefinition{ - // Type: to.Ptr(armcostmanagement.AlertTypeBudget), - // Category: to.Ptr(armcostmanagement.AlertCategoryCost), - // Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded), - // }, - // ModificationTime: to.Ptr("2020-04-28T11:06:02.8999373Z"), - // Source: to.Ptr(armcostmanagement.AlertSourcePreset), - // Status: to.Ptr(armcostmanagement.AlertStatusActive), - // StatusModificationTime: to.Ptr("0001-01-01T00:00:00"), - // Details: &armcostmanagement.AlertPropertiesDetails{ - // Amount: to.Ptr[float64](200000), - // ContactEmails: []*string{ - // to.Ptr("1234@contoso.com")}, - // ContactGroups: []*string{ - // }, - // ContactRoles: []*string{ - // }, - // CurrentSpend: to.Ptr[float64](161000.12), - // MeterFilter: []any{ - // }, - // Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan), - // PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"), - // ResourceFilter: []any{ - // }, - // ResourceGroupFilter: []any{ - // }, - // TagFilter: map[string]any{ - // }, - // Threshold: to.Ptr[float64](0.8), - // TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly), - // TriggeredBy: to.Ptr("00000000-0000-0000-0000-000000000000_1_01"), - // Unit: to.Ptr("USD"), - // }, - // }, - // }, - // { - // Name: to.Ptr("11111111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.CostManagement/alerts"), - // ID: to.Ptr("providers/Microsoft.CostManagement/externalSubscriptions/100/providers/Microsoft.CostManagement/alerts/11111111-1111-1111-111111111111"), - // Properties: &armcostmanagement.AlertProperties{ - // Description: to.Ptr(""), - // CloseTime: to.Ptr("0001-01-01T00:00:00"), - // CostEntityID: to.Ptr("budget1"), - // CreationTime: to.Ptr("2019-06-24T05:51:52.8713179Z"), - // Definition: &armcostmanagement.AlertPropertiesDefinition{ - // Type: to.Ptr(armcostmanagement.AlertTypeBudget), - // Category: to.Ptr(armcostmanagement.AlertCategoryCost), - // Criteria: to.Ptr(armcostmanagement.AlertCriteriaCostThresholdExceeded), - // }, - // ModificationTime: to.Ptr("2019-08-31T17:51:55.1808807Z"), - // Source: to.Ptr(armcostmanagement.AlertSourcePreset), - // Status: to.Ptr(armcostmanagement.AlertStatusActive), - // StatusModificationTime: to.Ptr("0001-01-01T00:00:00"), - // Details: &armcostmanagement.AlertPropertiesDetails{ - // Amount: to.Ptr[float64](200000), - // ContactEmails: []*string{ - // to.Ptr("1234@contoso.com")}, - // ContactGroups: []*string{ - // }, - // ContactRoles: []*string{ - // }, - // CurrentSpend: to.Ptr[float64](171000.32), - // MeterFilter: []any{ - // }, - // Operator: to.Ptr(armcostmanagement.AlertOperatorGreaterThan), - // PeriodStartDate: to.Ptr("2020-03-01T00:00:00Z"), - // ResourceFilter: []any{ - // }, - // ResourceGroupFilter: []any{ - // }, - // TagFilter: map[string]any{ - // }, - // Threshold: to.Ptr[float64](0.8), - // TimeGrainType: to.Ptr(armcostmanagement.AlertTimeGrainTypeQuarterly), - // TriggeredBy: to.Ptr("11111111-1111-1111-111111111111_1_01"), - // Unit: to.Ptr("USD"), - // }, - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/autorest.md b/sdk/resourcemanager/costmanagement/armcostmanagement/autorest.md index bf4d6f5b622d..da31a4753629 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/autorest.md +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/cost-management/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/cost-management/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.1 +module-version: 2.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/benefitrecommendations_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/benefitrecommendations_client.go new file mode 100644 index 000000000000..7edde4621f66 --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/benefitrecommendations_client.go @@ -0,0 +1,112 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcostmanagement + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// BenefitRecommendationsClient contains the methods for the BenefitRecommendations group. +// Don't use this type directly, use NewBenefitRecommendationsClient() instead. +type BenefitRecommendationsClient struct { + internal *arm.Client +} + +// NewBenefitRecommendationsClient creates a new instance of BenefitRecommendationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewBenefitRecommendationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*BenefitRecommendationsClient, error) { + cl, err := arm.NewClient(moduleName+".BenefitRecommendationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BenefitRecommendationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - List of recommendations for purchasing savings plan. +// +// Generated from API version 2023-03-01 +// - billingScope - The scope associated with benefit recommendation operations. This includes '/subscriptions/{subscriptionId}/' +// for subscription scope, +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' +// for enterprise agreement scope, and +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billing profile +// scope +// - options - BenefitRecommendationsClientListOptions contains the optional parameters for the BenefitRecommendationsClient.NewListPager +// method. +func (client *BenefitRecommendationsClient) NewListPager(billingScope string, options *BenefitRecommendationsClientListOptions) *runtime.Pager[BenefitRecommendationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[BenefitRecommendationsClientListResponse]{ + More: func(page BenefitRecommendationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *BenefitRecommendationsClientListResponse) (BenefitRecommendationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, billingScope, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return BenefitRecommendationsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BenefitRecommendationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BenefitRecommendationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *BenefitRecommendationsClient) listCreateRequest(ctx context.Context, billingScope string, options *BenefitRecommendationsClientListOptions) (*policy.Request, error) { + urlPath := "/{billingScope}/providers/Microsoft.CostManagement/benefitRecommendations" + urlPath = strings.ReplaceAll(urlPath, "{billingScope}", billingScope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Orderby != nil { + reqQP.Set("$orderby", *options.Orderby) + } + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *BenefitRecommendationsClient) listHandleResponse(resp *http.Response) (BenefitRecommendationsClientListResponse, error) { + result := BenefitRecommendationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BenefitRecommendationsListResult); err != nil { + return BenefitRecommendationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/benefitutilizationsummaries_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/benefitutilizationsummaries_client.go new file mode 100644 index 000000000000..da19a0ebf425 --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/benefitutilizationsummaries_client.go @@ -0,0 +1,322 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcostmanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// BenefitUtilizationSummariesClient contains the methods for the BenefitUtilizationSummaries group. +// Don't use this type directly, use NewBenefitUtilizationSummariesClient() instead. +type BenefitUtilizationSummariesClient struct { + internal *arm.Client +} + +// NewBenefitUtilizationSummariesClient creates a new instance of BenefitUtilizationSummariesClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewBenefitUtilizationSummariesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*BenefitUtilizationSummariesClient, error) { + cl, err := arm.NewClient(moduleName+".BenefitUtilizationSummariesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BenefitUtilizationSummariesClient{ + internal: cl, + } + return client, nil +} + +// NewListByBillingAccountIDPager - Lists savings plan utilization summaries for the enterprise agreement scope. Supported +// at grain values: 'Daily' and 'Monthly'. +// +// Generated from API version 2023-03-01 +// - billingAccountID - Billing account ID +// - options - BenefitUtilizationSummariesClientListByBillingAccountIDOptions contains the optional parameters for the BenefitUtilizationSummariesClient.NewListByBillingAccountIDPager +// method. +func (client *BenefitUtilizationSummariesClient) NewListByBillingAccountIDPager(billingAccountID string, options *BenefitUtilizationSummariesClientListByBillingAccountIDOptions) *runtime.Pager[BenefitUtilizationSummariesClientListByBillingAccountIDResponse] { + return runtime.NewPager(runtime.PagingHandler[BenefitUtilizationSummariesClientListByBillingAccountIDResponse]{ + More: func(page BenefitUtilizationSummariesClientListByBillingAccountIDResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *BenefitUtilizationSummariesClientListByBillingAccountIDResponse) (BenefitUtilizationSummariesClientListByBillingAccountIDResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByBillingAccountIDCreateRequest(ctx, billingAccountID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return BenefitUtilizationSummariesClientListByBillingAccountIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BenefitUtilizationSummariesClientListByBillingAccountIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BenefitUtilizationSummariesClientListByBillingAccountIDResponse{}, runtime.NewResponseError(resp) + } + return client.listByBillingAccountIDHandleResponse(resp) + }, + }) +} + +// listByBillingAccountIDCreateRequest creates the ListByBillingAccountID request. +func (client *BenefitUtilizationSummariesClient) listByBillingAccountIDCreateRequest(ctx context.Context, billingAccountID string, options *BenefitUtilizationSummariesClientListByBillingAccountIDOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries" + if billingAccountID == "" { + return nil, errors.New("parameter billingAccountID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{billingAccountId}", url.PathEscape(billingAccountID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + if options != nil && options.GrainParameter != nil { + reqQP.Set("grainParameter", string(*options.GrainParameter)) + } + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByBillingAccountIDHandleResponse handles the ListByBillingAccountID response. +func (client *BenefitUtilizationSummariesClient) listByBillingAccountIDHandleResponse(resp *http.Response) (BenefitUtilizationSummariesClientListByBillingAccountIDResponse, error) { + result := BenefitUtilizationSummariesClientListByBillingAccountIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BenefitUtilizationSummariesListResult); err != nil { + return BenefitUtilizationSummariesClientListByBillingAccountIDResponse{}, err + } + return result, nil +} + +// NewListByBillingProfileIDPager - Lists savings plan utilization summaries for billing profile. Supported at grain values: +// 'Daily' and 'Monthly'. +// +// Generated from API version 2023-03-01 +// - billingAccountID - Billing account ID +// - billingProfileID - Billing profile ID. +// - options - BenefitUtilizationSummariesClientListByBillingProfileIDOptions contains the optional parameters for the BenefitUtilizationSummariesClient.NewListByBillingProfileIDPager +// method. +func (client *BenefitUtilizationSummariesClient) NewListByBillingProfileIDPager(billingAccountID string, billingProfileID string, options *BenefitUtilizationSummariesClientListByBillingProfileIDOptions) *runtime.Pager[BenefitUtilizationSummariesClientListByBillingProfileIDResponse] { + return runtime.NewPager(runtime.PagingHandler[BenefitUtilizationSummariesClientListByBillingProfileIDResponse]{ + More: func(page BenefitUtilizationSummariesClientListByBillingProfileIDResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *BenefitUtilizationSummariesClientListByBillingProfileIDResponse) (BenefitUtilizationSummariesClientListByBillingProfileIDResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByBillingProfileIDCreateRequest(ctx, billingAccountID, billingProfileID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return BenefitUtilizationSummariesClientListByBillingProfileIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BenefitUtilizationSummariesClientListByBillingProfileIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BenefitUtilizationSummariesClientListByBillingProfileIDResponse{}, runtime.NewResponseError(resp) + } + return client.listByBillingProfileIDHandleResponse(resp) + }, + }) +} + +// listByBillingProfileIDCreateRequest creates the ListByBillingProfileID request. +func (client *BenefitUtilizationSummariesClient) listByBillingProfileIDCreateRequest(ctx context.Context, billingAccountID string, billingProfileID string, options *BenefitUtilizationSummariesClientListByBillingProfileIDOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries" + if billingAccountID == "" { + return nil, errors.New("parameter billingAccountID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{billingAccountId}", url.PathEscape(billingAccountID)) + if billingProfileID == "" { + return nil, errors.New("parameter billingProfileID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{billingProfileId}", url.PathEscape(billingProfileID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + if options != nil && options.GrainParameter != nil { + reqQP.Set("grainParameter", string(*options.GrainParameter)) + } + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByBillingProfileIDHandleResponse handles the ListByBillingProfileID response. +func (client *BenefitUtilizationSummariesClient) listByBillingProfileIDHandleResponse(resp *http.Response) (BenefitUtilizationSummariesClientListByBillingProfileIDResponse, error) { + result := BenefitUtilizationSummariesClientListByBillingProfileIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BenefitUtilizationSummariesListResult); err != nil { + return BenefitUtilizationSummariesClientListByBillingProfileIDResponse{}, err + } + return result, nil +} + +// NewListBySavingsPlanIDPager - Lists the savings plan utilization summaries for daily or monthly grain. +// +// Generated from API version 2023-03-01 +// - savingsPlanOrderID - Savings plan order ID. +// - savingsPlanID - Savings plan ID. +// - options - BenefitUtilizationSummariesClientListBySavingsPlanIDOptions contains the optional parameters for the BenefitUtilizationSummariesClient.NewListBySavingsPlanIDPager +// method. +func (client *BenefitUtilizationSummariesClient) NewListBySavingsPlanIDPager(savingsPlanOrderID string, savingsPlanID string, options *BenefitUtilizationSummariesClientListBySavingsPlanIDOptions) *runtime.Pager[BenefitUtilizationSummariesClientListBySavingsPlanIDResponse] { + return runtime.NewPager(runtime.PagingHandler[BenefitUtilizationSummariesClientListBySavingsPlanIDResponse]{ + More: func(page BenefitUtilizationSummariesClientListBySavingsPlanIDResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *BenefitUtilizationSummariesClientListBySavingsPlanIDResponse) (BenefitUtilizationSummariesClientListBySavingsPlanIDResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySavingsPlanIDCreateRequest(ctx, savingsPlanOrderID, savingsPlanID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return BenefitUtilizationSummariesClientListBySavingsPlanIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BenefitUtilizationSummariesClientListBySavingsPlanIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BenefitUtilizationSummariesClientListBySavingsPlanIDResponse{}, runtime.NewResponseError(resp) + } + return client.listBySavingsPlanIDHandleResponse(resp) + }, + }) +} + +// listBySavingsPlanIDCreateRequest creates the ListBySavingsPlanID request. +func (client *BenefitUtilizationSummariesClient) listBySavingsPlanIDCreateRequest(ctx context.Context, savingsPlanOrderID string, savingsPlanID string, options *BenefitUtilizationSummariesClientListBySavingsPlanIDOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries" + if savingsPlanOrderID == "" { + return nil, errors.New("parameter savingsPlanOrderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{savingsPlanOrderId}", url.PathEscape(savingsPlanOrderID)) + if savingsPlanID == "" { + return nil, errors.New("parameter savingsPlanID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{savingsPlanId}", url.PathEscape(savingsPlanID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.GrainParameter != nil { + reqQP.Set("grainParameter", string(*options.GrainParameter)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySavingsPlanIDHandleResponse handles the ListBySavingsPlanID response. +func (client *BenefitUtilizationSummariesClient) listBySavingsPlanIDHandleResponse(resp *http.Response) (BenefitUtilizationSummariesClientListBySavingsPlanIDResponse, error) { + result := BenefitUtilizationSummariesClientListBySavingsPlanIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BenefitUtilizationSummariesListResult); err != nil { + return BenefitUtilizationSummariesClientListBySavingsPlanIDResponse{}, err + } + return result, nil +} + +// NewListBySavingsPlanOrderPager - Lists the savings plan utilization summaries for daily or monthly grain. +// +// Generated from API version 2023-03-01 +// - savingsPlanOrderID - Savings plan order ID. +// - options - BenefitUtilizationSummariesClientListBySavingsPlanOrderOptions contains the optional parameters for the BenefitUtilizationSummariesClient.NewListBySavingsPlanOrderPager +// method. +func (client *BenefitUtilizationSummariesClient) NewListBySavingsPlanOrderPager(savingsPlanOrderID string, options *BenefitUtilizationSummariesClientListBySavingsPlanOrderOptions) *runtime.Pager[BenefitUtilizationSummariesClientListBySavingsPlanOrderResponse] { + return runtime.NewPager(runtime.PagingHandler[BenefitUtilizationSummariesClientListBySavingsPlanOrderResponse]{ + More: func(page BenefitUtilizationSummariesClientListBySavingsPlanOrderResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *BenefitUtilizationSummariesClientListBySavingsPlanOrderResponse) (BenefitUtilizationSummariesClientListBySavingsPlanOrderResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySavingsPlanOrderCreateRequest(ctx, savingsPlanOrderID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return BenefitUtilizationSummariesClientListBySavingsPlanOrderResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BenefitUtilizationSummariesClientListBySavingsPlanOrderResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BenefitUtilizationSummariesClientListBySavingsPlanOrderResponse{}, runtime.NewResponseError(resp) + } + return client.listBySavingsPlanOrderHandleResponse(resp) + }, + }) +} + +// listBySavingsPlanOrderCreateRequest creates the ListBySavingsPlanOrder request. +func (client *BenefitUtilizationSummariesClient) listBySavingsPlanOrderCreateRequest(ctx context.Context, savingsPlanOrderID string, options *BenefitUtilizationSummariesClientListBySavingsPlanOrderOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries" + if savingsPlanOrderID == "" { + return nil, errors.New("parameter savingsPlanOrderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{savingsPlanOrderId}", url.PathEscape(savingsPlanOrderID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.GrainParameter != nil { + reqQP.Set("grainParameter", string(*options.GrainParameter)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySavingsPlanOrderHandleResponse handles the ListBySavingsPlanOrder response. +func (client *BenefitUtilizationSummariesClient) listBySavingsPlanOrderHandleResponse(resp *http.Response) (BenefitUtilizationSummariesClientListBySavingsPlanOrderResponse, error) { + result := BenefitUtilizationSummariesClientListBySavingsPlanOrderResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BenefitUtilizationSummariesListResult); err != nil { + return BenefitUtilizationSummariesClientListBySavingsPlanOrderResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/benefitutilizationsummariesasync_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/benefitutilizationsummariesasync_client.go new file mode 100644 index 000000000000..9e4fee54e0d6 --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/benefitutilizationsummariesasync_client.go @@ -0,0 +1,381 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcostmanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// BenefitUtilizationSummariesAsyncClient contains the methods for the BenefitUtilizationSummariesAsync group. +// Don't use this type directly, use NewBenefitUtilizationSummariesAsyncClient() instead. +type BenefitUtilizationSummariesAsyncClient struct { + internal *arm.Client +} + +// NewBenefitUtilizationSummariesAsyncClient creates a new instance of BenefitUtilizationSummariesAsyncClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewBenefitUtilizationSummariesAsyncClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*BenefitUtilizationSummariesAsyncClient, error) { + cl, err := arm.NewClient(moduleName+".BenefitUtilizationSummariesAsyncClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BenefitUtilizationSummariesAsyncClient{ + internal: cl, + } + return client, nil +} + +// GetOperationStatusBillingAccountScope - Gets status of benefit utilization summaries report. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - billingAccountID - Billing account ID +// - operationID - Operation id of the report being generated +// - options - BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingAccountScopeOptions contains the optional parameters +// for the BenefitUtilizationSummariesAsyncClient.GetOperationStatusBillingAccountScope method. +func (client *BenefitUtilizationSummariesAsyncClient) GetOperationStatusBillingAccountScope(ctx context.Context, billingAccountID string, operationID string, options *BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingAccountScopeOptions) (BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingAccountScopeResponse, error) { + req, err := client.getOperationStatusBillingAccountScopeCreateRequest(ctx, billingAccountID, operationID, options) + if err != nil { + return BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingAccountScopeResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingAccountScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingAccountScopeResponse{}, runtime.NewResponseError(resp) + } + return client.getOperationStatusBillingAccountScopeHandleResponse(resp) +} + +// getOperationStatusBillingAccountScopeCreateRequest creates the GetOperationStatusBillingAccountScope request. +func (client *BenefitUtilizationSummariesAsyncClient) getOperationStatusBillingAccountScopeCreateRequest(ctx context.Context, billingAccountID string, operationID string, options *BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingAccountScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummariesOperationResults/{operationId}" + if billingAccountID == "" { + return nil, errors.New("parameter billingAccountID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{billingAccountId}", url.PathEscape(billingAccountID)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getOperationStatusBillingAccountScopeHandleResponse handles the GetOperationStatusBillingAccountScope response. +func (client *BenefitUtilizationSummariesAsyncClient) getOperationStatusBillingAccountScopeHandleResponse(resp *http.Response) (BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingAccountScopeResponse, error) { + result := BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingAccountScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BenefitUtilizationSummariesOperationStatus); err != nil { + return BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingAccountScopeResponse{}, err + } + return result, nil +} + +// GetOperationStatusBillingProfileScope - Gets status of benefit utilization summaries report. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - billingAccountID - Billing account ID +// - billingProfileID - Billing profile ID. +// - operationID - Operation id of the report being generated +// - options - BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingProfileScopeOptions contains the optional parameters +// for the BenefitUtilizationSummariesAsyncClient.GetOperationStatusBillingProfileScope method. +func (client *BenefitUtilizationSummariesAsyncClient) GetOperationStatusBillingProfileScope(ctx context.Context, billingAccountID string, billingProfileID string, operationID string, options *BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingProfileScopeOptions) (BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingProfileScopeResponse, error) { + req, err := client.getOperationStatusBillingProfileScopeCreateRequest(ctx, billingAccountID, billingProfileID, operationID, options) + if err != nil { + return BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingProfileScopeResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingProfileScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingProfileScopeResponse{}, runtime.NewResponseError(resp) + } + return client.getOperationStatusBillingProfileScopeHandleResponse(resp) +} + +// getOperationStatusBillingProfileScopeCreateRequest creates the GetOperationStatusBillingProfileScope request. +func (client *BenefitUtilizationSummariesAsyncClient) getOperationStatusBillingProfileScopeCreateRequest(ctx context.Context, billingAccountID string, billingProfileID string, operationID string, options *BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingProfileScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/benefitUtilizationSummariesOperationResults/{operationId}" + if billingAccountID == "" { + return nil, errors.New("parameter billingAccountID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{billingAccountId}", url.PathEscape(billingAccountID)) + if billingProfileID == "" { + return nil, errors.New("parameter billingProfileID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{billingProfileId}", url.PathEscape(billingProfileID)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getOperationStatusBillingProfileScopeHandleResponse handles the GetOperationStatusBillingProfileScope response. +func (client *BenefitUtilizationSummariesAsyncClient) getOperationStatusBillingProfileScopeHandleResponse(resp *http.Response) (BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingProfileScopeResponse, error) { + result := BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingProfileScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BenefitUtilizationSummariesOperationStatus); err != nil { + return BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingProfileScopeResponse{}, err + } + return result, nil +} + +// GetOperationStatusReservationOrderScope - Gets status of benefit utilization summaries report. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - reservationOrderID - Reservation Order ID +// - operationID - Operation id of the report being generated +// - options - BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationOrderScopeOptions contains the optional parameters +// for the BenefitUtilizationSummariesAsyncClient.GetOperationStatusReservationOrderScope method. +func (client *BenefitUtilizationSummariesAsyncClient) GetOperationStatusReservationOrderScope(ctx context.Context, reservationOrderID string, operationID string, options *BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationOrderScopeOptions) (BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationOrderScopeResponse, error) { + req, err := client.getOperationStatusReservationOrderScopeCreateRequest(ctx, reservationOrderID, operationID, options) + if err != nil { + return BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationOrderScopeResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationOrderScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationOrderScopeResponse{}, runtime.NewResponseError(resp) + } + return client.getOperationStatusReservationOrderScopeHandleResponse(resp) +} + +// getOperationStatusReservationOrderScopeCreateRequest creates the GetOperationStatusReservationOrderScope request. +func (client *BenefitUtilizationSummariesAsyncClient) getOperationStatusReservationOrderScopeCreateRequest(ctx context.Context, reservationOrderID string, operationID string, options *BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationOrderScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummariesOperationResults/{operationId}" + if reservationOrderID == "" { + return nil, errors.New("parameter reservationOrderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{reservationOrderId}", url.PathEscape(reservationOrderID)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getOperationStatusReservationOrderScopeHandleResponse handles the GetOperationStatusReservationOrderScope response. +func (client *BenefitUtilizationSummariesAsyncClient) getOperationStatusReservationOrderScopeHandleResponse(resp *http.Response) (BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationOrderScopeResponse, error) { + result := BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationOrderScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BenefitUtilizationSummariesOperationStatus); err != nil { + return BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationOrderScopeResponse{}, err + } + return result, nil +} + +// GetOperationStatusReservationScope - Gets status of benefit utilization summaries report. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - reservationOrderID - Reservation Order ID +// - reservationID - Reservation ID +// - operationID - Operation id of the report being generated +// - options - BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationScopeOptions contains the optional parameters +// for the BenefitUtilizationSummariesAsyncClient.GetOperationStatusReservationScope method. +func (client *BenefitUtilizationSummariesAsyncClient) GetOperationStatusReservationScope(ctx context.Context, reservationOrderID string, reservationID string, operationID string, options *BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationScopeOptions) (BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationScopeResponse, error) { + req, err := client.getOperationStatusReservationScopeCreateRequest(ctx, reservationOrderID, reservationID, operationID, options) + if err != nil { + return BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationScopeResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationScopeResponse{}, runtime.NewResponseError(resp) + } + return client.getOperationStatusReservationScopeHandleResponse(resp) +} + +// getOperationStatusReservationScopeCreateRequest creates the GetOperationStatusReservationScope request. +func (client *BenefitUtilizationSummariesAsyncClient) getOperationStatusReservationScopeCreateRequest(ctx context.Context, reservationOrderID string, reservationID string, operationID string, options *BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.CostManagement/benefitUtilizationSummariesOperationResults/{operationId}" + if reservationOrderID == "" { + return nil, errors.New("parameter reservationOrderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{reservationOrderId}", url.PathEscape(reservationOrderID)) + if reservationID == "" { + return nil, errors.New("parameter reservationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{reservationId}", url.PathEscape(reservationID)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getOperationStatusReservationScopeHandleResponse handles the GetOperationStatusReservationScope response. +func (client *BenefitUtilizationSummariesAsyncClient) getOperationStatusReservationScopeHandleResponse(resp *http.Response) (BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationScopeResponse, error) { + result := BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BenefitUtilizationSummariesOperationStatus); err != nil { + return BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationScopeResponse{}, err + } + return result, nil +} + +// GetOperationStatusSavingsPlanOrderScope - Gets status of benefit utilization summaries report. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - savingsPlanOrderID - Savings plan order ID. +// - operationID - Operation id of the report being generated +// - options - BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanOrderScopeOptions contains the optional parameters +// for the BenefitUtilizationSummariesAsyncClient.GetOperationStatusSavingsPlanOrderScope method. +func (client *BenefitUtilizationSummariesAsyncClient) GetOperationStatusSavingsPlanOrderScope(ctx context.Context, savingsPlanOrderID string, operationID string, options *BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanOrderScopeOptions) (BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanOrderScopeResponse, error) { + req, err := client.getOperationStatusSavingsPlanOrderScopeCreateRequest(ctx, savingsPlanOrderID, operationID, options) + if err != nil { + return BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanOrderScopeResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanOrderScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanOrderScopeResponse{}, runtime.NewResponseError(resp) + } + return client.getOperationStatusSavingsPlanOrderScopeHandleResponse(resp) +} + +// getOperationStatusSavingsPlanOrderScopeCreateRequest creates the GetOperationStatusSavingsPlanOrderScope request. +func (client *BenefitUtilizationSummariesAsyncClient) getOperationStatusSavingsPlanOrderScopeCreateRequest(ctx context.Context, savingsPlanOrderID string, operationID string, options *BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanOrderScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummariesOperationResults/{operationId}" + if savingsPlanOrderID == "" { + return nil, errors.New("parameter savingsPlanOrderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{savingsPlanOrderId}", url.PathEscape(savingsPlanOrderID)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getOperationStatusSavingsPlanOrderScopeHandleResponse handles the GetOperationStatusSavingsPlanOrderScope response. +func (client *BenefitUtilizationSummariesAsyncClient) getOperationStatusSavingsPlanOrderScopeHandleResponse(resp *http.Response) (BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanOrderScopeResponse, error) { + result := BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanOrderScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BenefitUtilizationSummariesOperationStatus); err != nil { + return BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanOrderScopeResponse{}, err + } + return result, nil +} + +// GetOperationStatusSavingsPlanScope - Gets status of benefit utilization summaries report. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - savingsPlanOrderID - Savings plan order ID. +// - savingsPlanID - Savings plan ID. +// - operationID - Operation id of the report being generated +// - options - BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanScopeOptions contains the optional parameters +// for the BenefitUtilizationSummariesAsyncClient.GetOperationStatusSavingsPlanScope method. +func (client *BenefitUtilizationSummariesAsyncClient) GetOperationStatusSavingsPlanScope(ctx context.Context, savingsPlanOrderID string, savingsPlanID string, operationID string, options *BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanScopeOptions) (BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanScopeResponse, error) { + req, err := client.getOperationStatusSavingsPlanScopeCreateRequest(ctx, savingsPlanOrderID, savingsPlanID, operationID, options) + if err != nil { + return BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanScopeResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanScopeResponse{}, runtime.NewResponseError(resp) + } + return client.getOperationStatusSavingsPlanScopeHandleResponse(resp) +} + +// getOperationStatusSavingsPlanScopeCreateRequest creates the GetOperationStatusSavingsPlanScope request. +func (client *BenefitUtilizationSummariesAsyncClient) getOperationStatusSavingsPlanScopeCreateRequest(ctx context.Context, savingsPlanOrderID string, savingsPlanID string, operationID string, options *BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/benefitUtilizationSummariesOperationResults/{operationId}" + if savingsPlanOrderID == "" { + return nil, errors.New("parameter savingsPlanOrderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{savingsPlanOrderId}", url.PathEscape(savingsPlanOrderID)) + if savingsPlanID == "" { + return nil, errors.New("parameter savingsPlanID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{savingsPlanId}", url.PathEscape(savingsPlanID)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getOperationStatusSavingsPlanScopeHandleResponse handles the GetOperationStatusSavingsPlanScope response. +func (client *BenefitUtilizationSummariesAsyncClient) getOperationStatusSavingsPlanScopeHandleResponse(resp *http.Response) (BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanScopeResponse, error) { + result := BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BenefitUtilizationSummariesOperationStatus); err != nil { + return BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanScopeResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/billingaccountscope_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/billingaccountscope_client.go new file mode 100644 index 000000000000..08f8b621fa8d --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/billingaccountscope_client.go @@ -0,0 +1,103 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcostmanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// BillingAccountScopeClient contains the methods for the BillingAccountScope group. +// Don't use this type directly, use NewBillingAccountScopeClient() instead. +type BillingAccountScopeClient struct { + internal *arm.Client +} + +// NewBillingAccountScopeClient creates a new instance of BillingAccountScopeClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewBillingAccountScopeClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*BillingAccountScopeClient, error) { + cl, err := arm.NewClient(moduleName+".BillingAccountScopeClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BillingAccountScopeClient{ + internal: cl, + } + return client, nil +} + +// BeginGenerateBenefitUtilizationSummariesReport - Triggers generation of a benefit utilization summaries report for the +// provided billing account. This API supports only enrollment accounts. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - billingAccountID - Billing account ID +// - benefitUtilizationSummariesRequest - Async Benefit Utilization Summary report to be created. +// - options - BillingAccountScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions contains the optional parameters +// for the BillingAccountScopeClient.BeginGenerateBenefitUtilizationSummariesReport method. +func (client *BillingAccountScopeClient) BeginGenerateBenefitUtilizationSummariesReport(ctx context.Context, billingAccountID string, benefitUtilizationSummariesRequest BenefitUtilizationSummariesRequest, options *BillingAccountScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions) (*runtime.Poller[BillingAccountScopeClientGenerateBenefitUtilizationSummariesReportResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.generateBenefitUtilizationSummariesReport(ctx, billingAccountID, benefitUtilizationSummariesRequest, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BillingAccountScopeClientGenerateBenefitUtilizationSummariesReportResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[BillingAccountScopeClientGenerateBenefitUtilizationSummariesReportResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// GenerateBenefitUtilizationSummariesReport - Triggers generation of a benefit utilization summaries report for the provided +// billing account. This API supports only enrollment accounts. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +func (client *BillingAccountScopeClient) generateBenefitUtilizationSummariesReport(ctx context.Context, billingAccountID string, benefitUtilizationSummariesRequest BenefitUtilizationSummariesRequest, options *BillingAccountScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions) (*http.Response, error) { + req, err := client.generateBenefitUtilizationSummariesReportCreateRequest(ctx, billingAccountID, benefitUtilizationSummariesRequest, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// generateBenefitUtilizationSummariesReportCreateRequest creates the GenerateBenefitUtilizationSummariesReport request. +func (client *BillingAccountScopeClient) generateBenefitUtilizationSummariesReportCreateRequest(ctx context.Context, billingAccountID string, benefitUtilizationSummariesRequest BenefitUtilizationSummariesRequest, options *BillingAccountScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + if billingAccountID == "" { + return nil, errors.New("parameter billingAccountID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{billingAccountId}", url.PathEscape(billingAccountID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, benefitUtilizationSummariesRequest) +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/billingprofilescope_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/billingprofilescope_client.go new file mode 100644 index 000000000000..a07bdf23eae1 --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/billingprofilescope_client.go @@ -0,0 +1,108 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcostmanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// BillingProfileScopeClient contains the methods for the BillingProfileScope group. +// Don't use this type directly, use NewBillingProfileScopeClient() instead. +type BillingProfileScopeClient struct { + internal *arm.Client +} + +// NewBillingProfileScopeClient creates a new instance of BillingProfileScopeClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewBillingProfileScopeClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*BillingProfileScopeClient, error) { + cl, err := arm.NewClient(moduleName+".BillingProfileScopeClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BillingProfileScopeClient{ + internal: cl, + } + return client, nil +} + +// BeginGenerateBenefitUtilizationSummariesReport - Triggers generation of a benefit utilization summaries report for the +// provided billing account and billing profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - billingAccountID - Billing account ID +// - billingProfileID - Billing profile ID. +// - benefitUtilizationSummariesRequest - Async Benefit Utilization Summary report to be created. +// - options - BillingProfileScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions contains the optional parameters +// for the BillingProfileScopeClient.BeginGenerateBenefitUtilizationSummariesReport method. +func (client *BillingProfileScopeClient) BeginGenerateBenefitUtilizationSummariesReport(ctx context.Context, billingAccountID string, billingProfileID string, benefitUtilizationSummariesRequest BenefitUtilizationSummariesRequest, options *BillingProfileScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions) (*runtime.Poller[BillingProfileScopeClientGenerateBenefitUtilizationSummariesReportResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.generateBenefitUtilizationSummariesReport(ctx, billingAccountID, billingProfileID, benefitUtilizationSummariesRequest, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BillingProfileScopeClientGenerateBenefitUtilizationSummariesReportResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[BillingProfileScopeClientGenerateBenefitUtilizationSummariesReportResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// GenerateBenefitUtilizationSummariesReport - Triggers generation of a benefit utilization summaries report for the provided +// billing account and billing profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +func (client *BillingProfileScopeClient) generateBenefitUtilizationSummariesReport(ctx context.Context, billingAccountID string, billingProfileID string, benefitUtilizationSummariesRequest BenefitUtilizationSummariesRequest, options *BillingProfileScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions) (*http.Response, error) { + req, err := client.generateBenefitUtilizationSummariesReportCreateRequest(ctx, billingAccountID, billingProfileID, benefitUtilizationSummariesRequest, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// generateBenefitUtilizationSummariesReportCreateRequest creates the GenerateBenefitUtilizationSummariesReport request. +func (client *BillingProfileScopeClient) generateBenefitUtilizationSummariesReportCreateRequest(ctx context.Context, billingAccountID string, billingProfileID string, benefitUtilizationSummariesRequest BenefitUtilizationSummariesRequest, options *BillingProfileScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + if billingAccountID == "" { + return nil, errors.New("parameter billingAccountID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{billingAccountId}", url.PathEscape(billingAccountID)) + if billingProfileID == "" { + return nil, errors.New("parameter billingProfileID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{billingProfileId}", url.PathEscape(billingProfileID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, benefitUtilizationSummariesRequest) +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/client_factory.go b/sdk/resourcemanager/costmanagement/armcostmanagement/client_factory.go index 9d54e01fd059..cb960a8e6a10 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/client_factory.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/client_factory.go @@ -36,11 +36,66 @@ func NewClientFactory(credential azcore.TokenCredential, options *arm.ClientOpti }, nil } +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewBenefitRecommendationsClient() *BenefitRecommendationsClient { + subClient, _ := NewBenefitRecommendationsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewBenefitUtilizationSummariesClient() *BenefitUtilizationSummariesClient { + subClient, _ := NewBenefitUtilizationSummariesClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewBillingAccountScopeClient() *BillingAccountScopeClient { + subClient, _ := NewBillingAccountScopeClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewBillingProfileScopeClient() *BillingProfileScopeClient { + subClient, _ := NewBillingProfileScopeClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReservationOrderScopeClient() *ReservationOrderScopeClient { + subClient, _ := NewReservationOrderScopeClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReservationScopeClient() *ReservationScopeClient { + subClient, _ := NewReservationScopeClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSavingsPlanOrderScopeClient() *SavingsPlanOrderScopeClient { + subClient, _ := NewSavingsPlanOrderScopeClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSavingsPlanScopeClient() *SavingsPlanScopeClient { + subClient, _ := NewSavingsPlanScopeClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewBenefitUtilizationSummariesAsyncClient() *BenefitUtilizationSummariesAsyncClient { + subClient, _ := NewBenefitUtilizationSummariesAsyncClient(c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewExportsClient() *ExportsClient { subClient, _ := NewExportsClient(c.credential, c.options) return subClient } +func (c *ClientFactory) NewGenerateCostDetailsReportClient() *GenerateCostDetailsReportClient { + subClient, _ := NewGenerateCostDetailsReportClient(c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewGenerateDetailedCostReportClient() *GenerateDetailedCostReportClient { subClient, _ := NewGenerateDetailedCostReportClient(c.credential, c.options) return subClient @@ -86,7 +141,12 @@ func (c *ClientFactory) NewGenerateReservationDetailsReportClient() *GenerateRes return subClient } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) +func (c *ClientFactory) NewPriceSheetClient() *PriceSheetClient { + subClient, _ := NewPriceSheetClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewScheduledActionsClient() *ScheduledActionsClient { + subClient, _ := NewScheduledActionsClient(c.credential, c.options) return subClient } diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/constants.go b/sdk/resourcemanager/costmanagement/armcostmanagement/constants.go index c9f22e6e1fa2..c0fee93cba48 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/constants.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/constants.go @@ -11,7 +11,7 @@ package armcostmanagement const ( moduleName = "armcostmanagement" - moduleVersion = "v1.1.1" + moduleVersion = "v2.0.0" ) // AccumulatedType - Show costs accumulated over time. @@ -30,6 +30,20 @@ func PossibleAccumulatedTypeValues() []AccumulatedType { } } +// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + // AlertCategory - Alert category type AlertCategory string @@ -204,6 +218,59 @@ func PossibleAlertTypeValues() []AlertType { } } +// BenefitKind - Kind/type of the benefit. +type BenefitKind string + +const ( + // BenefitKindIncludedQuantity - Benefit is IncludedQuantity. + BenefitKindIncludedQuantity BenefitKind = "IncludedQuantity" + // BenefitKindReservation - Benefit is Reservation. + BenefitKindReservation BenefitKind = "Reservation" + // BenefitKindSavingsPlan - Benefit is SavingsPlan. + BenefitKindSavingsPlan BenefitKind = "SavingsPlan" +) + +// PossibleBenefitKindValues returns the possible values for the BenefitKind const type. +func PossibleBenefitKindValues() []BenefitKind { + return []BenefitKind{ + BenefitKindIncludedQuantity, + BenefitKindReservation, + BenefitKindSavingsPlan, + } +} + +// BenefitUtilizationSummaryReportSchema - The CSV file from the reportUrl and secondaryReportUrl blob link will consist of +// the following columns of benefit utilization data. UtilizedPercentage will be 0 for savings plans reports and non data +// bricks reservations. Utilization percentages will be 0 for data bricks reservations. +type BenefitUtilizationSummaryReportSchema string + +const ( + BenefitUtilizationSummaryReportSchemaAvgUtilizationPercentage BenefitUtilizationSummaryReportSchema = "AvgUtilizationPercentage" + BenefitUtilizationSummaryReportSchemaBenefitID BenefitUtilizationSummaryReportSchema = "BenefitId" + BenefitUtilizationSummaryReportSchemaBenefitOrderID BenefitUtilizationSummaryReportSchema = "BenefitOrderId" + BenefitUtilizationSummaryReportSchemaBenefitType BenefitUtilizationSummaryReportSchema = "BenefitType" + BenefitUtilizationSummaryReportSchemaKind BenefitUtilizationSummaryReportSchema = "Kind" + BenefitUtilizationSummaryReportSchemaMaxUtilizationPercentage BenefitUtilizationSummaryReportSchema = "MaxUtilizationPercentage" + BenefitUtilizationSummaryReportSchemaMinUtilizationPercentage BenefitUtilizationSummaryReportSchema = "MinUtilizationPercentage" + BenefitUtilizationSummaryReportSchemaUsageDate BenefitUtilizationSummaryReportSchema = "UsageDate" + BenefitUtilizationSummaryReportSchemaUtilizedPercentage BenefitUtilizationSummaryReportSchema = "UtilizedPercentage" +) + +// PossibleBenefitUtilizationSummaryReportSchemaValues returns the possible values for the BenefitUtilizationSummaryReportSchema const type. +func PossibleBenefitUtilizationSummaryReportSchemaValues() []BenefitUtilizationSummaryReportSchema { + return []BenefitUtilizationSummaryReportSchema{ + BenefitUtilizationSummaryReportSchemaAvgUtilizationPercentage, + BenefitUtilizationSummaryReportSchemaBenefitID, + BenefitUtilizationSummaryReportSchemaBenefitOrderID, + BenefitUtilizationSummaryReportSchemaBenefitType, + BenefitUtilizationSummaryReportSchemaKind, + BenefitUtilizationSummaryReportSchemaMaxUtilizationPercentage, + BenefitUtilizationSummaryReportSchemaMinUtilizationPercentage, + BenefitUtilizationSummaryReportSchemaUsageDate, + BenefitUtilizationSummaryReportSchemaUtilizedPercentage, + } +} + // ChartType - Chart type of the main view in Cost Analysis. Required. type ChartType string @@ -226,7 +293,123 @@ func PossibleChartTypeValues() []ChartType { } } -// ExecutionStatus - The last known status of the export execution. +// CheckNameAvailabilityReason - The reason why the given name is not available. +type CheckNameAvailabilityReason string + +const ( + CheckNameAvailabilityReasonAlreadyExists CheckNameAvailabilityReason = "AlreadyExists" + CheckNameAvailabilityReasonInvalid CheckNameAvailabilityReason = "Invalid" +) + +// PossibleCheckNameAvailabilityReasonValues returns the possible values for the CheckNameAvailabilityReason const type. +func PossibleCheckNameAvailabilityReasonValues() []CheckNameAvailabilityReason { + return []CheckNameAvailabilityReason{ + CheckNameAvailabilityReasonAlreadyExists, + CheckNameAvailabilityReasonInvalid, + } +} + +// CostDetailsDataFormat - The data format of the report +type CostDetailsDataFormat string + +const ( + // CostDetailsDataFormatCSVCostDetailsDataFormat - Csv data format. + CostDetailsDataFormatCSVCostDetailsDataFormat CostDetailsDataFormat = "Csv" +) + +// PossibleCostDetailsDataFormatValues returns the possible values for the CostDetailsDataFormat const type. +func PossibleCostDetailsDataFormatValues() []CostDetailsDataFormat { + return []CostDetailsDataFormat{ + CostDetailsDataFormatCSVCostDetailsDataFormat, + } +} + +// CostDetailsMetricType - The type of the detailed report. By default ActualCost is provided +type CostDetailsMetricType string + +const ( + // CostDetailsMetricTypeActualCostCostDetailsMetricType - Actual cost data. + CostDetailsMetricTypeActualCostCostDetailsMetricType CostDetailsMetricType = "ActualCost" + // CostDetailsMetricTypeAmortizedCostCostDetailsMetricType - Amortized cost data. + CostDetailsMetricTypeAmortizedCostCostDetailsMetricType CostDetailsMetricType = "AmortizedCost" +) + +// PossibleCostDetailsMetricTypeValues returns the possible values for the CostDetailsMetricType const type. +func PossibleCostDetailsMetricTypeValues() []CostDetailsMetricType { + return []CostDetailsMetricType{ + CostDetailsMetricTypeActualCostCostDetailsMetricType, + CostDetailsMetricTypeAmortizedCostCostDetailsMetricType, + } +} + +// CostDetailsStatusType - The status of the cost details operation +type CostDetailsStatusType string + +const ( + // CostDetailsStatusTypeCompletedCostDetailsStatusType - Operation is Completed. + CostDetailsStatusTypeCompletedCostDetailsStatusType CostDetailsStatusType = "Completed" + // CostDetailsStatusTypeFailedCostDetailsStatusType - Operation Failed. + CostDetailsStatusTypeFailedCostDetailsStatusType CostDetailsStatusType = "Failed" + // CostDetailsStatusTypeNoDataFoundCostDetailsStatusType - Operation is Completed and no cost data found. + CostDetailsStatusTypeNoDataFoundCostDetailsStatusType CostDetailsStatusType = "NoDataFound" +) + +// PossibleCostDetailsStatusTypeValues returns the possible values for the CostDetailsStatusType const type. +func PossibleCostDetailsStatusTypeValues() []CostDetailsStatusType { + return []CostDetailsStatusType{ + CostDetailsStatusTypeCompletedCostDetailsStatusType, + CostDetailsStatusTypeFailedCostDetailsStatusType, + CostDetailsStatusTypeNoDataFoundCostDetailsStatusType, + } +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// DaysOfWeek - Days of Week. +type DaysOfWeek string + +const ( + DaysOfWeekFriday DaysOfWeek = "Friday" + DaysOfWeekMonday DaysOfWeek = "Monday" + DaysOfWeekSaturday DaysOfWeek = "Saturday" + DaysOfWeekSunday DaysOfWeek = "Sunday" + DaysOfWeekThursday DaysOfWeek = "Thursday" + DaysOfWeekTuesday DaysOfWeek = "Tuesday" + DaysOfWeekWednesday DaysOfWeek = "Wednesday" +) + +// PossibleDaysOfWeekValues returns the possible values for the DaysOfWeek const type. +func PossibleDaysOfWeekValues() []DaysOfWeek { + return []DaysOfWeek{ + DaysOfWeekFriday, + DaysOfWeekMonday, + DaysOfWeekSaturday, + DaysOfWeekSunday, + DaysOfWeekThursday, + DaysOfWeekTuesday, + DaysOfWeekWednesday, + } +} + +// ExecutionStatus - The last known status of the export run. type ExecutionStatus string const ( @@ -252,7 +435,7 @@ func PossibleExecutionStatusValues() []ExecutionStatus { } } -// ExecutionType - The type of the export execution. +// ExecutionType - The type of the export run. type ExecutionType string const ( @@ -302,28 +485,45 @@ func PossibleExternalCloudProviderTypeValues() []ExternalCloudProviderType { } } -// ForecastTimeframeType - The time frame for pulling data for the forecast. If custom, then a specific time period must be -// provided. -type ForecastTimeframeType string +// FileFormat - Destination of the view data. Currently only CSV format is supported. +type FileFormat string + +const ( + FileFormatCSV FileFormat = "Csv" +) + +// PossibleFileFormatValues returns the possible values for the FileFormat const type. +func PossibleFileFormatValues() []FileFormat { + return []FileFormat{ + FileFormatCSV, + } +} + +// ForecastOperatorType - The operator to use for comparison. +type ForecastOperatorType string + +const ( + ForecastOperatorTypeIn ForecastOperatorType = "In" +) + +// PossibleForecastOperatorTypeValues returns the possible values for the ForecastOperatorType const type. +func PossibleForecastOperatorTypeValues() []ForecastOperatorType { + return []ForecastOperatorType{ + ForecastOperatorTypeIn, + } +} + +// ForecastTimeframe - The time frame for pulling data for the forecast. +type ForecastTimeframe string const ( - ForecastTimeframeTypeBillingMonthToDate ForecastTimeframeType = "BillingMonthToDate" - ForecastTimeframeTypeCustom ForecastTimeframeType = "Custom" - ForecastTimeframeTypeMonthToDate ForecastTimeframeType = "MonthToDate" - ForecastTimeframeTypeTheLastBillingMonth ForecastTimeframeType = "TheLastBillingMonth" - ForecastTimeframeTypeTheLastMonth ForecastTimeframeType = "TheLastMonth" - ForecastTimeframeTypeWeekToDate ForecastTimeframeType = "WeekToDate" + ForecastTimeframeCustom ForecastTimeframe = "Custom" ) -// PossibleForecastTimeframeTypeValues returns the possible values for the ForecastTimeframeType const type. -func PossibleForecastTimeframeTypeValues() []ForecastTimeframeType { - return []ForecastTimeframeType{ - ForecastTimeframeTypeBillingMonthToDate, - ForecastTimeframeTypeCustom, - ForecastTimeframeTypeMonthToDate, - ForecastTimeframeTypeTheLastBillingMonth, - ForecastTimeframeTypeTheLastMonth, - ForecastTimeframeTypeWeekToDate, +// PossibleForecastTimeframeValues returns the possible values for the ForecastTimeframe const type. +func PossibleForecastTimeframeValues() []ForecastTimeframe { + return []ForecastTimeframe{ + ForecastTimeframeCustom, } } @@ -359,6 +559,26 @@ func PossibleFormatTypeValues() []FormatType { } } +// FunctionName - The name of the column to aggregate. +type FunctionName string + +const ( + FunctionNameCost FunctionName = "Cost" + FunctionNameCostUSD FunctionName = "CostUSD" + FunctionNamePreTaxCost FunctionName = "PreTaxCost" + FunctionNamePreTaxCostUSD FunctionName = "PreTaxCostUSD" +) + +// PossibleFunctionNameValues returns the possible values for the FunctionName const type. +func PossibleFunctionNameValues() []FunctionName { + return []FunctionName{ + FunctionNameCost, + FunctionNameCostUSD, + FunctionNamePreTaxCost, + FunctionNamePreTaxCostUSD, + } +} + // FunctionType - The name of the aggregation function to use. type FunctionType string @@ -389,6 +609,47 @@ func PossibleGenerateDetailedCostReportMetricTypeValues() []GenerateDetailedCost } } +// Grain - Grain which corresponds to value. +type Grain string + +const ( + // GrainDaily - Hourly grain corresponds to value per day. + GrainDaily Grain = "Daily" + // GrainHourly - Hourly grain corresponds to value per hour. + GrainHourly Grain = "Hourly" + // GrainMonthly - Hourly grain corresponds to value per month. + GrainMonthly Grain = "Monthly" +) + +// PossibleGrainValues returns the possible values for the Grain const type. +func PossibleGrainValues() []Grain { + return []Grain{ + GrainDaily, + GrainHourly, + GrainMonthly, + } +} + +type GrainParameter string + +const ( + // GrainParameterDaily - Hourly grain corresponds to value per day. + GrainParameterDaily GrainParameter = "Daily" + // GrainParameterHourly - Hourly grain corresponds to value per hour. + GrainParameterHourly GrainParameter = "Hourly" + // GrainParameterMonthly - Hourly grain corresponds to value per month. + GrainParameterMonthly GrainParameter = "Monthly" +) + +// PossibleGrainParameterValues returns the possible values for the GrainParameter const type. +func PossibleGrainParameterValues() []GrainParameter { + return []GrainParameter{ + GrainParameterDaily, + GrainParameterHourly, + GrainParameterMonthly, + } +} + // GranularityType - The granularity of rows in the export. Currently only 'Daily' is supported. type GranularityType string @@ -419,6 +680,27 @@ func PossibleKpiTypeValues() []KpiType { } } +// LookBackPeriod - The number of days used to look back. +type LookBackPeriod string + +const ( + // LookBackPeriodLast30Days - 30 days used to look back. + LookBackPeriodLast30Days LookBackPeriod = "Last30Days" + // LookBackPeriodLast60Days - 60 days used to look back. + LookBackPeriodLast60Days LookBackPeriod = "Last60Days" + // LookBackPeriodLast7Days - 7 days used to look back. + LookBackPeriodLast7Days LookBackPeriod = "Last7Days" +) + +// PossibleLookBackPeriodValues returns the possible values for the LookBackPeriod const type. +func PossibleLookBackPeriodValues() []LookBackPeriod { + return []LookBackPeriod{ + LookBackPeriodLast30Days, + LookBackPeriodLast60Days, + LookBackPeriodLast7Days, + } +} + // MetricType - Metric to use when displaying costs. type MetricType string @@ -437,10 +719,11 @@ func PossibleMetricTypeValues() []MetricType { } } -// OperationStatusType - The status of the long running operation. +// OperationStatusType - Enum representing the status of an async operation. type OperationStatusType string const ( + OperationStatusTypeComplete OperationStatusType = "Complete" OperationStatusTypeCompleted OperationStatusType = "Completed" OperationStatusTypeFailed OperationStatusType = "Failed" OperationStatusTypeRunning OperationStatusType = "Running" @@ -449,6 +732,7 @@ const ( // PossibleOperationStatusTypeValues returns the possible values for the OperationStatusType const type. func PossibleOperationStatusTypeValues() []OperationStatusType { return []OperationStatusType{ + OperationStatusTypeComplete, OperationStatusTypeCompleted, OperationStatusTypeFailed, OperationStatusTypeRunning, @@ -471,6 +755,25 @@ func PossibleOperatorTypeValues() []OperatorType { } } +// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type Origin string + +const ( + OriginSystem Origin = "system" + OriginUser Origin = "user" + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + // PivotType - Data type to show in view. type PivotType string @@ -487,19 +790,21 @@ func PossiblePivotTypeValues() []PivotType { } } -// QueryColumnType - The type of the column in the export. +// QueryColumnType - The type of the column in the report. type QueryColumnType string const ( + // QueryColumnTypeDimension - The dimension of cost data. QueryColumnTypeDimension QueryColumnType = "Dimension" - QueryColumnTypeTag QueryColumnType = "Tag" + // QueryColumnTypeTagKey - The tag associated with the cost data. + QueryColumnTypeTagKey QueryColumnType = "TagKey" ) // PossibleQueryColumnTypeValues returns the possible values for the QueryColumnType const type. func PossibleQueryColumnTypeValues() []QueryColumnType { return []QueryColumnType{ QueryColumnTypeDimension, - QueryColumnTypeTag, + QueryColumnTypeTagKey, } } @@ -537,22 +842,6 @@ func PossibleRecurrenceTypeValues() []RecurrenceType { } } -// ReportConfigColumnType - The type of the column in the report. -type ReportConfigColumnType string - -const ( - ReportConfigColumnTypeDimension ReportConfigColumnType = "Dimension" - ReportConfigColumnTypeTag ReportConfigColumnType = "Tag" -) - -// PossibleReportConfigColumnTypeValues returns the possible values for the ReportConfigColumnType const type. -func PossibleReportConfigColumnTypeValues() []ReportConfigColumnType { - return []ReportConfigColumnType{ - ReportConfigColumnTypeDimension, - ReportConfigColumnTypeTag, - } -} - // ReportConfigSortingType - Direction of sort. type ReportConfigSortingType string @@ -682,6 +971,85 @@ func PossibleReservationReportSchemaValues() []ReservationReportSchema { } } +// ScheduleFrequency - Frequency of the schedule. +type ScheduleFrequency string + +const ( + // ScheduleFrequencyDaily - Cost analysis data will be emailed every day. + ScheduleFrequencyDaily ScheduleFrequency = "Daily" + // ScheduleFrequencyMonthly - Cost analysis data will be emailed every month. + ScheduleFrequencyMonthly ScheduleFrequency = "Monthly" + // ScheduleFrequencyWeekly - Cost analysis data will be emailed every week. + ScheduleFrequencyWeekly ScheduleFrequency = "Weekly" +) + +// PossibleScheduleFrequencyValues returns the possible values for the ScheduleFrequency const type. +func PossibleScheduleFrequencyValues() []ScheduleFrequency { + return []ScheduleFrequency{ + ScheduleFrequencyDaily, + ScheduleFrequencyMonthly, + ScheduleFrequencyWeekly, + } +} + +// ScheduledActionKind - Kind of the scheduled action. +type ScheduledActionKind string + +const ( + // ScheduledActionKindEmail - Cost analysis data will be emailed. + ScheduledActionKindEmail ScheduledActionKind = "Email" + // ScheduledActionKindInsightAlert - Cost anomaly information will be emailed. Available only on subscription scope at daily + // frequency. If no anomaly is detected on the resource, an email won't be sent. + ScheduledActionKindInsightAlert ScheduledActionKind = "InsightAlert" +) + +// PossibleScheduledActionKindValues returns the possible values for the ScheduledActionKind const type. +func PossibleScheduledActionKindValues() []ScheduledActionKind { + return []ScheduledActionKind{ + ScheduledActionKindEmail, + ScheduledActionKindInsightAlert, + } +} + +// ScheduledActionStatus - Status of the scheduled action. +type ScheduledActionStatus string + +const ( + // ScheduledActionStatusDisabled - Scheduled action is saved but will not be run. + ScheduledActionStatusDisabled ScheduledActionStatus = "Disabled" + // ScheduledActionStatusEnabled - Scheduled action is saved and will be run. + ScheduledActionStatusEnabled ScheduledActionStatus = "Enabled" + // ScheduledActionStatusExpired - Scheduled action is expired. + ScheduledActionStatusExpired ScheduledActionStatus = "Expired" +) + +// PossibleScheduledActionStatusValues returns the possible values for the ScheduledActionStatus const type. +func PossibleScheduledActionStatusValues() []ScheduledActionStatus { + return []ScheduledActionStatus{ + ScheduledActionStatusDisabled, + ScheduledActionStatusEnabled, + ScheduledActionStatusExpired, + } +} + +// Scope - Kind of the recommendation scope. +type Scope string + +const ( + // ScopeShared - Shared scope recommendation. + ScopeShared Scope = "Shared" + // ScopeSingle - Single scope recommendation. + ScopeSingle Scope = "Single" +) + +// PossibleScopeValues returns the possible values for the Scope const type. +func PossibleScopeValues() []Scope { + return []Scope{ + ScopeShared, + ScopeSingle, + } +} + // StatusType - The status of the export's schedule. If 'Inactive', the export's schedule is paused. type StatusType string @@ -698,6 +1066,24 @@ func PossibleStatusTypeValues() []StatusType { } } +// Term - Grain which corresponds to value. +type Term string + +const ( + // TermP1Y - Benefit term is 1 year. + TermP1Y Term = "P1Y" + // TermP3Y - Benefit term is 3 years. + TermP3Y Term = "P3Y" +) + +// PossibleTermValues returns the possible values for the Term const type. +func PossibleTermValues() []Term { + return []Term{ + TermP1Y, + TermP3Y, + } +} + // TimeframeType - The time frame for pulling data for the export. If custom, then a specific time period must be provided. type TimeframeType string @@ -721,3 +1107,25 @@ func PossibleTimeframeTypeValues() []TimeframeType { TimeframeTypeWeekToDate, } } + +// WeeksOfMonth - Weeks of month. +type WeeksOfMonth string + +const ( + WeeksOfMonthFirst WeeksOfMonth = "First" + WeeksOfMonthFourth WeeksOfMonth = "Fourth" + WeeksOfMonthLast WeeksOfMonth = "Last" + WeeksOfMonthSecond WeeksOfMonth = "Second" + WeeksOfMonthThird WeeksOfMonth = "Third" +) + +// PossibleWeeksOfMonthValues returns the possible values for the WeeksOfMonth const type. +func PossibleWeeksOfMonthValues() []WeeksOfMonth { + return []WeeksOfMonth{ + WeeksOfMonthFirst, + WeeksOfMonthFourth, + WeeksOfMonthLast, + WeeksOfMonthSecond, + WeeksOfMonthThird, + } +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/dimensions_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/dimensions_client.go index 8103d0b8fa70..0a1ab7941591 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/dimensions_client.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/dimensions_client.go @@ -44,7 +44,7 @@ func NewDimensionsClient(credential azcore.TokenCredential, options *arm.ClientO // NewByExternalCloudProviderTypePager - Lists the dimensions by the external cloud provider type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - externalCloudProviderType - The external cloud provider type associated with dimension/query operations. This includes // 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. // - externalCloudProviderID - This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for @@ -89,7 +89,7 @@ func (client *DimensionsClient) byExternalCloudProviderTypeCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -118,7 +118,7 @@ func (client *DimensionsClient) byExternalCloudProviderTypeHandleResponse(resp * // NewListPager - Lists the dimensions by the defined scope. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - scope - The scope associated with dimension operations. This includes '/subscriptions/{subscriptionId}/' for subscription // scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for // resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, @@ -161,7 +161,7 @@ func (client *DimensionsClient) listCreateRequest(ctx context.Context, scope str return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/dimensions_client_example_test.go b/sdk/resourcemanager/costmanagement/armcostmanagement/dimensions_client_example_test.go deleted file mode 100644 index c447d3d7240e..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/dimensions_client_example_test.go +++ /dev/null @@ -1,1790 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcostmanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingAccountDimensionsList.json -func ExampleDimensionsClient_NewListPager_billingAccountDimensionsListLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/100", &armcostmanagement.DimensionsClientListOptions{Filter: nil, - Expand: nil, - Skiptoken: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceGroup_2018-05-01_2018-05-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/providers/microsoft.CostManagement/dimensions_ResourceGroup_2018-05-01_2018-05-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource group"), - // Category: to.Ptr("ResourceGroup"), - // Data: []*string{ - // }, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](377), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("dimensions_ResourceType_2018-05-01_2018-05-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/providers/microsoft.CostManagement/dimensions_ResourceType_2018-05-01_2018-05-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource type"), - // Category: to.Ptr("ResourceType"), - // Data: []*string{ - // }, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](37), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCABillingAccountDimensionsList.json -func ExampleDimensionsClient_NewListPager_billingAccountDimensionsListModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:6789", &armcostmanagement.DimensionsClientListOptions{Filter: nil, - Expand: nil, - Skiptoken: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceGroup_2019-10-01_2019-10-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/providers/microsoft.CostManagement/dimensions_ResourceGroup_2019-10-01_2019-10-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource group"), - // Category: to.Ptr("ResourceGroup"), - // Data: []*string{ - // }, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](377), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("dimensions_ResourceType_2019-10-01_2019-10-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/providers/microsoft.CostManagement/dimensions_ResourceType_2019-10-01_2019-10-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource type"), - // Category: to.Ptr("ResourceType"), - // Data: []*string{ - // }, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](37), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingAccountDimensionsListExpandAndTop.json -func ExampleDimensionsClient_NewListPager_billingAccountDimensionsListExpandAndTopLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/100", &armcostmanagement.DimensionsClientListOptions{Filter: nil, - Expand: to.Ptr("properties/data"), - Skiptoken: nil, - Top: to.Ptr[int32](5), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceGroup_2018-05-01_2018-05-31_5"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/providers/microsoft.CostManagement/dimensions_ResourceGroup_2018-05-01_2018-05-31_5"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource group"), - // Category: to.Ptr("ResourceGroup"), - // Data: []*string{ - // to.Ptr("thoroetrg01"), - // to.Ptr("default-notificationhubs-westus"), - // to.Ptr("jedikeyvaultrg"), - // to.Ptr("contosocodeflow8d4a"), - // to.Ptr("noobaa")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](377), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("dimensions_ResourceType_2018-05-01_2018-05-31_5"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/providers/microsoft.CostManagement/dimensions_ResourceType_2018-05-01_2018-05-31_5"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource type"), - // Category: to.Ptr("ResourceType"), - // Data: []*string{ - // to.Ptr("microsoft.automation/automationaccounts"), - // to.Ptr("microsoft.databricks/workspaces"), - // to.Ptr("microsoft.dbformysql/servers"), - // to.Ptr("microsoft.containerregistry/registries"), - // to.Ptr("microsoft.search/searchservices")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](37), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCABillingAccountDimensionsListExpandAndTop.json -func ExampleDimensionsClient_NewListPager_billingAccountDimensionsListExpandAndTopModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:6789", &armcostmanagement.DimensionsClientListOptions{Filter: nil, - Expand: to.Ptr("properties/data"), - Skiptoken: nil, - Top: to.Ptr[int32](5), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceGroup_2019-10-01_2019-10-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/providers/microsoft.CostManagement/dimensions_ResourceGroup_2019-10-01_2019-10-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource group"), - // Category: to.Ptr("ResourceGroup"), - // Data: []*string{ - // to.Ptr("thoroetrg01"), - // to.Ptr("default-notificationhubs-westus"), - // to.Ptr("jedikeyvaultrg"), - // to.Ptr("contosocodeflow8d4a"), - // to.Ptr("noobaa")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](377), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("dimensions_ResourceType_2019-10-01_2019-10-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/providers/microsoft.CostManagement/dimensions_ResourceType_2019-10-01_2019-10-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource type"), - // Category: to.Ptr("ResourceType"), - // Data: []*string{ - // to.Ptr("microsoft.automation/automationaccounts"), - // to.Ptr("microsoft.databricks/workspaces"), - // to.Ptr("microsoft.dbformysql/servers"), - // to.Ptr("microsoft.containerregistry/registries"), - // to.Ptr("microsoft.search/searchservices")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](37), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingAccountDimensionsListWithFilter.json -func ExampleDimensionsClient_NewListPager_billingAccountDimensionsListWithFilterLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/100", &armcostmanagement.DimensionsClientListOptions{Filter: to.Ptr("properties/category eq 'resourceId'"), - Expand: to.Ptr("properties/data"), - Skiptoken: nil, - Top: to.Ptr[int32](5), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceId_2018-05-01_2018-05-31_5"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/providers/microsoft.CostManagement/dimensions_ResourceId_2018-05-01_2018-05-31_5"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource Id"), - // Category: to.Ptr("ResourceId"), - // Data: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/urphealthaccount"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/srphytenaccount"), - // to.Ptr("/subscriptions/67e24f6b-1ec2-4c90-993a-dc2d25b00b6c/resourcegroups/defaultresourcegroup-eus/providers/microsoft.operationalinsights/workspaces/defaultworkspace-67e24f6b-1ec2-4c90-993a-dc2d25b00b6c-eus"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg-sql-ha/providers/microsoft.compute/virtualmachines/sql-4qqp1"), - // to.Ptr("/subscriptions/a98d6dc5-eb8f-46cf-8938-f1fb08f03706/resourcegroups/databricks-rg-testwsp-xijmsdubneexm/providers/microsoft.compute/disks/488cdb42bf74474a98075415be3f806c-containerrootvolume")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](1409), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCABillingAccountDimensionsListWithFilter.json -func ExampleDimensionsClient_NewListPager_billingAccountDimensionsListWithFilterModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:6789", &armcostmanagement.DimensionsClientListOptions{Filter: to.Ptr("properties/category eq 'resourceId'"), - Expand: to.Ptr("properties/data"), - Skiptoken: nil, - Top: to.Ptr[int32](5), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceId_2019-10-01_2019-10-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/providers/microsoft.CostManagement/dimensions_ResourceId_2019-10-01_2019-10-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource Id"), - // Category: to.Ptr("ResourceId"), - // Data: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/urphealthaccount"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/srphytenaccount"), - // to.Ptr("/subscriptions/67e24f6b-1ec2-4c90-993a-dc2d25b00b6c/resourcegroups/defaultresourcegroup-eus/providers/microsoft.operationalinsights/workspaces/defaultworkspace-67e24f6b-1ec2-4c90-993a-dc2d25b00b6c-eus"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg-sql-ha/providers/microsoft.compute/virtualmachines/sql-4qqp1"), - // to.Ptr("/subscriptions/a98d6dc5-eb8f-46cf-8938-f1fb08f03706/resourcegroups/databricks-rg-testwsp-xijmsdubneexm/providers/microsoft.compute/disks/488cdb42bf74474a98075415be3f806c-containerrootvolume")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](1409), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCABillingProfileDimensionsList.json -func ExampleDimensionsClient_NewListPager_billingProfileDimensionsListModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", &armcostmanagement.DimensionsClientListOptions{Filter: nil, - Expand: nil, - Skiptoken: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceGroup_2019-10-01_2019-10-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/microsoft.CostManagement/dimensions_ResourceGroup_2019-10-01_2019-10-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource group"), - // Category: to.Ptr("ResourceGroup"), - // Data: []*string{ - // }, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](377), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("dimensions_ResourceType_2019-10-01_2019-10-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/microsoft.CostManagement/dimensions_ResourceType_2019-10-01_2019-10-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource type"), - // Category: to.Ptr("ResourceType"), - // Data: []*string{ - // }, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](37), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCABillingProfileDimensionsListExpandAndTop.json -func ExampleDimensionsClient_NewListPager_billingProfileDimensionsListExpandAndTopModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", &armcostmanagement.DimensionsClientListOptions{Filter: nil, - Expand: to.Ptr("properties/data"), - Skiptoken: nil, - Top: to.Ptr[int32](5), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceGroup_2019-10-01_2019-10-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/microsoft.CostManagement/dimensions_ResourceGroup_2019-10-01_2019-10-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource group"), - // Category: to.Ptr("ResourceGroup"), - // Data: []*string{ - // to.Ptr("thoroetrg01"), - // to.Ptr("default-notificationhubs-westus"), - // to.Ptr("jedikeyvaultrg"), - // to.Ptr("contosocodeflow8d4a"), - // to.Ptr("noobaa")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](377), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("dimensions_ResourceType_2019-10-01_2019-10-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/microsoft.CostManagement/dimensions_ResourceType_2019-10-01_2019-10-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource type"), - // Category: to.Ptr("ResourceType"), - // Data: []*string{ - // to.Ptr("microsoft.automation/automationaccounts"), - // to.Ptr("microsoft.databricks/workspaces"), - // to.Ptr("microsoft.dbformysql/servers"), - // to.Ptr("microsoft.containerregistry/registries"), - // to.Ptr("microsoft.search/searchservices")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](37), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCABillingProfileDimensionsListWithFilter.json -func ExampleDimensionsClient_NewListPager_billingProfileDimensionsListWithFilterModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", &armcostmanagement.DimensionsClientListOptions{Filter: to.Ptr("properties/category eq 'resourceId'"), - Expand: to.Ptr("properties/data"), - Skiptoken: nil, - Top: to.Ptr[int32](5), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceId_2019-10-01_2019-10-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/microsoft.CostManagement/dimensions_ResourceId_2019-10-01_2019-10-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource Id"), - // Category: to.Ptr("ResourceId"), - // Data: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/urphealthaccount"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/srphytenaccount"), - // to.Ptr("/subscriptions/67e24f6b-1ec2-4c90-993a-dc2d25b00b6c/resourcegroups/defaultresourcegroup-eus/providers/microsoft.operationalinsights/workspaces/defaultworkspace-67e24f6b-1ec2-4c90-993a-dc2d25b00b6c-eus"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg-sql-ha/providers/microsoft.compute/virtualmachines/sql-4qqp1"), - // to.Ptr("/subscriptions/a98d6dc5-eb8f-46cf-8938-f1fb08f03706/resourcegroups/databricks-rg-testwsp-xijmsdubneexm/providers/microsoft.compute/disks/488cdb42bf74474a98075415be3f806c-containerrootvolume")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](1409), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCACustomerDimensionsList.json -func ExampleDimensionsClient_NewListPager_customerDimensionsListModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", &armcostmanagement.DimensionsClientListOptions{Filter: nil, - Expand: nil, - Skiptoken: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceGroup_2019-10-01_2019-10-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678/providers/microsoft.CostManagement/dimensions_ResourceGroup_2019-10-01_2019-10-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource group"), - // Category: to.Ptr("ResourceGroup"), - // Data: []*string{ - // }, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](377), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("dimensions_ResourceType_2019-10-01_2019-10-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678/providers/microsoft.CostManagement/dimensions_ResourceType_2019-10-01_2019-10-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource type"), - // Category: to.Ptr("ResourceType"), - // Data: []*string{ - // }, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](37), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCACustomerDimensionsListExpandAndTop.json -func ExampleDimensionsClient_NewListPager_customerDimensionsListExpandAndTopModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", &armcostmanagement.DimensionsClientListOptions{Filter: nil, - Expand: to.Ptr("properties/data"), - Skiptoken: nil, - Top: to.Ptr[int32](5), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceGroup_2019-10-01_2019-10-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678/providers/microsoft.CostManagement/dimensions_ResourceGroup_2019-10-01_2019-10-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource group"), - // Category: to.Ptr("ResourceGroup"), - // Data: []*string{ - // to.Ptr("thoroetrg01"), - // to.Ptr("default-notificationhubs-westus"), - // to.Ptr("jedikeyvaultrg"), - // to.Ptr("contosocodeflow8d4a"), - // to.Ptr("noobaa")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](377), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("dimensions_ResourceType_2019-10-01_2019-10-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678/providers/microsoft.CostManagement/dimensions_ResourceType_2019-10-01_2019-10-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource type"), - // Category: to.Ptr("ResourceType"), - // Data: []*string{ - // to.Ptr("microsoft.automation/automationaccounts"), - // to.Ptr("microsoft.databricks/workspaces"), - // to.Ptr("microsoft.dbformysql/servers"), - // to.Ptr("microsoft.containerregistry/registries"), - // to.Ptr("microsoft.search/searchservices")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](37), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCACustomerDimensionsListWithFilter.json -func ExampleDimensionsClient_NewListPager_customerDimensionsListWithFilterModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", &armcostmanagement.DimensionsClientListOptions{Filter: to.Ptr("properties/category eq 'resourceId'"), - Expand: to.Ptr("properties/data"), - Skiptoken: nil, - Top: to.Ptr[int32](5), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceId_2019-10-01_2019-10-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678/providers/microsoft.CostManagement/dimensions_ResourceId_2019-10-01_2019-10-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource Id"), - // Category: to.Ptr("ResourceId"), - // Data: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/urphealthaccount"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/srphytenaccount"), - // to.Ptr("/subscriptions/67e24f6b-1ec2-4c90-993a-dc2d25b00b6c/resourcegroups/defaultresourcegroup-eus/providers/microsoft.operationalinsights/workspaces/defaultworkspace-67e24f6b-1ec2-4c90-993a-dc2d25b00b6c-eus"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg-sql-ha/providers/microsoft.compute/virtualmachines/sql-4qqp1"), - // to.Ptr("/subscriptions/a98d6dc5-eb8f-46cf-8938-f1fb08f03706/resourcegroups/databricks-rg-testwsp-xijmsdubneexm/providers/microsoft.compute/disks/488cdb42bf74474a98075415be3f806c-containerrootvolume")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](1409), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/DepartmentDimensionsList.json -func ExampleDimensionsClient_NewListPager_departmentDimensionsListLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/100/departments/123", &armcostmanagement.DimensionsClientListOptions{Filter: nil, - Expand: nil, - Skiptoken: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceGroup_2018-05-01_2018-05-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/departments/123/providers/microsoft.CostManagement/dimensions_ResourceGroup_2018-05-01_2018-05-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource group"), - // Category: to.Ptr("ResourceGroup"), - // Data: []*string{ - // }, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](377), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("dimensions_ResourceType_2018-05-01_2018-05-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/departments/123/providers/microsoft.CostManagement/dimensions_ResourceType_2018-05-01_2018-05-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource type"), - // Category: to.Ptr("ResourceType"), - // Data: []*string{ - // }, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](37), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/DepartmentDimensionsListExpandAndTop.json -func ExampleDimensionsClient_NewListPager_departmentDimensionsListExpandAndTopLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/100/departments/123", &armcostmanagement.DimensionsClientListOptions{Filter: nil, - Expand: to.Ptr("properties/data"), - Skiptoken: nil, - Top: to.Ptr[int32](5), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceGroup_2018-05-01_2018-05-31_5"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/departments/123/providers/microsoft.CostManagement/dimensions_ResourceGroup_2018-05-01_2018-05-31_5"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource group"), - // Category: to.Ptr("ResourceGroup"), - // Data: []*string{ - // to.Ptr("thoroetrg01"), - // to.Ptr("default-notificationhubs-westus"), - // to.Ptr("jedikeyvaultrg"), - // to.Ptr("contosocodeflow8d4a"), - // to.Ptr("noobaa")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](377), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("dimensions_ResourceType_2018-05-01_2018-05-31_5"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/departments/123/providers/microsoft.CostManagement/dimensions_ResourceType_2018-05-01_2018-05-31_5"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource type"), - // Category: to.Ptr("ResourceType"), - // Data: []*string{ - // to.Ptr("microsoft.automation/automationaccounts"), - // to.Ptr("microsoft.databricks/workspaces"), - // to.Ptr("microsoft.dbformysql/servers"), - // to.Ptr("microsoft.containerregistry/registries"), - // to.Ptr("microsoft.search/searchservices")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](37), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/DepartmentDimensionsListWithFilter.json -func ExampleDimensionsClient_NewListPager_departmentDimensionsListWithFilterLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/100/departments/123", &armcostmanagement.DimensionsClientListOptions{Filter: to.Ptr("properties/category eq 'resourceId'"), - Expand: to.Ptr("properties/data"), - Skiptoken: nil, - Top: to.Ptr[int32](5), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceId_2018-05-01_2018-05-31_5"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/departments/123/providers/microsoft.CostManagement/dimensions_ResourceId_2018-05-01_2018-05-31_5"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource Id"), - // Category: to.Ptr("ResourceId"), - // Data: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/urphealthaccount"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/srphytenaccount"), - // to.Ptr("/subscriptions/67e24f6b-1ec2-4c90-993a-dc2d25b00b6c/resourcegroups/defaultresourcegroup-eus/providers/microsoft.operationalinsights/workspaces/defaultworkspace-67e24f6b-1ec2-4c90-993a-dc2d25b00b6c-eus"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg-sql-ha/providers/microsoft.compute/virtualmachines/sql-4qqp1"), - // to.Ptr("/subscriptions/a98d6dc5-eb8f-46cf-8938-f1fb08f03706/resourcegroups/databricks-rg-testwsp-xijmsdubneexm/providers/microsoft.compute/disks/488cdb42bf74474a98075415be3f806c-containerrootvolume")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](1409), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/EnrollmentAccountDimensionsList.json -func ExampleDimensionsClient_NewListPager_enrollmentAccountDimensionsListLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", &armcostmanagement.DimensionsClientListOptions{Filter: nil, - Expand: nil, - Skiptoken: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceGroup_2018-05-01_2018-05-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/microsoft.CostManagement/dimensions_ResourceGroup_2018-05-01_2018-05-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource group"), - // Category: to.Ptr("ResourceGroup"), - // Data: []*string{ - // }, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](377), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("dimensions_ResourceType_2018-05-01_2018-05-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/microsoft.CostManagement/dimensions_ResourceType_2018-05-01_2018-05-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource type"), - // Category: to.Ptr("ResourceType"), - // Data: []*string{ - // }, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](37), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/EnrollmentAccountDimensionsListExpandAndTop.json -func ExampleDimensionsClient_NewListPager_enrollmentAccountDimensionsListExpandAndTopLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", &armcostmanagement.DimensionsClientListOptions{Filter: nil, - Expand: to.Ptr("properties/data"), - Skiptoken: nil, - Top: to.Ptr[int32](5), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceGroup_2018-05-01_2018-05-31_5"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/microsoft.CostManagement/dimensions_ResourceGroup_2018-05-01_2018-05-31_5"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource group"), - // Category: to.Ptr("ResourceGroup"), - // Data: []*string{ - // to.Ptr("thoroetrg01"), - // to.Ptr("default-notificationhubs-westus"), - // to.Ptr("jedikeyvaultrg"), - // to.Ptr("contosocodeflow8d4a"), - // to.Ptr("noobaa")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](377), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("dimensions_ResourceType_2018-05-01_2018-05-31_5"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/microsoft.CostManagement/dimensions_ResourceType_2018-05-01_2018-05-31_5"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource type"), - // Category: to.Ptr("ResourceType"), - // Data: []*string{ - // to.Ptr("microsoft.automation/automationaccounts"), - // to.Ptr("microsoft.databricks/workspaces"), - // to.Ptr("microsoft.dbformysql/servers"), - // to.Ptr("microsoft.containerregistry/registries"), - // to.Ptr("microsoft.search/searchservices")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](37), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/EnrollmentAccountDimensionsListWithFilter.json -func ExampleDimensionsClient_NewListPager_enrollmentAccountDimensionsListWithFilterLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", &armcostmanagement.DimensionsClientListOptions{Filter: to.Ptr("properties/category eq 'resourceId'"), - Expand: to.Ptr("properties/data"), - Skiptoken: nil, - Top: to.Ptr[int32](5), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceId_2018-05-01_2018-05-31_5"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/microsoft.CostManagement/dimensions_ResourceId_2018-05-01_2018-05-31_5"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource Id"), - // Category: to.Ptr("ResourceId"), - // Data: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/urphealthaccount"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/srphytenaccount"), - // to.Ptr("/subscriptions/67e24f6b-1ec2-4c90-993a-dc2d25b00b6c/resourcegroups/defaultresourcegroup-eus/providers/microsoft.operationalinsights/workspaces/defaultworkspace-67e24f6b-1ec2-4c90-993a-dc2d25b00b6c-eus"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg-sql-ha/providers/microsoft.compute/virtualmachines/sql-4qqp1"), - // to.Ptr("/subscriptions/a98d6dc5-eb8f-46cf-8938-f1fb08f03706/resourcegroups/databricks-rg-testwsp-xijmsdubneexm/providers/microsoft.compute/disks/488cdb42bf74474a98075415be3f806c-containerrootvolume")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](1409), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCAInvoiceSectionDimensionsList.json -func ExampleDimensionsClient_NewListPager_invoiceSectionDimensionsListModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", &armcostmanagement.DimensionsClientListOptions{Filter: nil, - Expand: nil, - Skiptoken: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceGroup_2019-10-01_2019-10-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/microsoft.CostManagement/dimensions_ResourceGroup_2019-10-01_2019-10-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource group"), - // Category: to.Ptr("ResourceGroup"), - // Data: []*string{ - // }, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](377), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("dimensions_ResourceType_2019-10-01_2019-10-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/microsoft.CostManagement/dimensions_ResourceType_2019-10-01_2019-10-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource type"), - // Category: to.Ptr("ResourceType"), - // Data: []*string{ - // }, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](37), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCAInvoiceSectionDimensionsListExpandAndTop.json -func ExampleDimensionsClient_NewListPager_invoiceSectionDimensionsListExpandAndTopModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", &armcostmanagement.DimensionsClientListOptions{Filter: nil, - Expand: to.Ptr("properties/data"), - Skiptoken: nil, - Top: to.Ptr[int32](5), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceGroup_2019-10-01_2019-10-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/microsoft.CostManagement/dimensions_ResourceGroup_2019-10-01_2019-10-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource group"), - // Category: to.Ptr("ResourceGroup"), - // Data: []*string{ - // to.Ptr("thoroetrg01"), - // to.Ptr("default-notificationhubs-westus"), - // to.Ptr("jedikeyvaultrg"), - // to.Ptr("contosocodeflow8d4a"), - // to.Ptr("noobaa")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](377), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("dimensions_ResourceType_2019-10-01_2019-10-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/microsoft.CostManagement/dimensions_ResourceType_2019-10-01_2019-10-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource type"), - // Category: to.Ptr("ResourceType"), - // Data: []*string{ - // to.Ptr("microsoft.automation/automationaccounts"), - // to.Ptr("microsoft.databricks/workspaces"), - // to.Ptr("microsoft.dbformysql/servers"), - // to.Ptr("microsoft.containerregistry/registries"), - // to.Ptr("microsoft.search/searchservices")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](37), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCAInvoiceSectionDimensionsListWithFilter.json -func ExampleDimensionsClient_NewListPager_invoiceSectionDimensionsListWithFilterModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", &armcostmanagement.DimensionsClientListOptions{Filter: to.Ptr("properties/category eq 'resourceId'"), - Expand: to.Ptr("properties/data"), - Skiptoken: nil, - Top: to.Ptr[int32](5), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceId_2019-10-01_2019-10-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/microsoft.CostManagement/dimensions_ResourceId_2019-10-01_2019-10-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource Id"), - // Category: to.Ptr("ResourceId"), - // Data: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/urphealthaccount"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/srphytenaccount"), - // to.Ptr("/subscriptions/67e24f6b-1ec2-4c90-993a-dc2d25b00b6c/resourcegroups/defaultresourcegroup-eus/providers/microsoft.operationalinsights/workspaces/defaultworkspace-67e24f6b-1ec2-4c90-993a-dc2d25b00b6c-eus"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg-sql-ha/providers/microsoft.compute/virtualmachines/sql-4qqp1"), - // to.Ptr("/subscriptions/a98d6dc5-eb8f-46cf-8938-f1fb08f03706/resourcegroups/databricks-rg-testwsp-xijmsdubneexm/providers/microsoft.compute/disks/488cdb42bf74474a98075415be3f806c-containerrootvolume")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](1409), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ManagementGroupDimensionsList.json -func ExampleDimensionsClient_NewListPager_managementGroupDimensionsListLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Management/managementGroups/MyMgId", &armcostmanagement.DimensionsClientListOptions{Filter: nil, - Expand: nil, - Skiptoken: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceGroup_2018-05-01_2018-05-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Management/managementGroups/MyMgId/providers/microsoft.CostManagement/dimensions_ResourceGroup_2018-05-01_2018-05-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource group"), - // Category: to.Ptr("ResourceGroup"), - // Data: []*string{ - // }, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](377), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("dimensions_ResourceType_2018-05-01_2018-05-31"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Management/managementGroups/MyMgId/providers/microsoft.CostManagement/dimensions_ResourceType_2018-05-01_2018-05-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource type"), - // Category: to.Ptr("ResourceType"), - // Data: []*string{ - // }, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](37), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ManagementGroupDimensionsListExpandAndTop.json -func ExampleDimensionsClient_NewListPager_managementGroupDimensionsListExpandAndTopLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Management/managementGroups/MyMgId", &armcostmanagement.DimensionsClientListOptions{Filter: nil, - Expand: to.Ptr("properties/data"), - Skiptoken: nil, - Top: to.Ptr[int32](5), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceGroup_2018-05-01_2018-05-31_5"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Management/managementGroups/MyMgId/providers/microsoft.CostManagement/dimensions_ResourceGroup_2018-05-01_2018-05-31_5"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource group"), - // Category: to.Ptr("ResourceGroup"), - // Data: []*string{ - // to.Ptr("thoroetrg01"), - // to.Ptr("default-notificationhubs-westus"), - // to.Ptr("jedikeyvaultrg"), - // to.Ptr("contosocodeflow8d4a"), - // to.Ptr("noobaa")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](377), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("dimensions_ResourceType_2018-05-01_2018-05-31_5"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Management/managementGroups/MyMgId/providers/microsoft.CostManagement/dimensions_ResourceType_2018-05-01_2018-05-31_5"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource type"), - // Category: to.Ptr("ResourceType"), - // Data: []*string{ - // to.Ptr("microsoft.automation/automationaccounts"), - // to.Ptr("microsoft.databricks/workspaces"), - // to.Ptr("microsoft.dbformysql/servers"), - // to.Ptr("microsoft.containerregistry/registries"), - // to.Ptr("microsoft.search/searchservices")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](37), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ManagementGroupDimensionsListWithFilter.json -func ExampleDimensionsClient_NewListPager_managementGroupDimensionsListWithFilterLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("providers/Microsoft.Management/managementGroups/MyMgId", &armcostmanagement.DimensionsClientListOptions{Filter: to.Ptr("properties/category eq 'resourceId'"), - Expand: to.Ptr("properties/data"), - Skiptoken: nil, - Top: to.Ptr[int32](5), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceId_2018-05-01_2018-05-31_5"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("providers/Microsoft.Management/managementGroups/MyMgId/providers/microsoft.CostManagement/dimensions_ResourceId_2018-05-01_2018-05-31_5"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource Id"), - // Category: to.Ptr("ResourceId"), - // Data: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/urphealthaccount"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/srphytenaccount"), - // to.Ptr("/subscriptions/67e24f6b-1ec2-4c90-993a-dc2d25b00b6c/resourcegroups/defaultresourcegroup-eus/providers/microsoft.operationalinsights/workspaces/defaultworkspace-67e24f6b-1ec2-4c90-993a-dc2d25b00b6c-eus"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg-sql-ha/providers/microsoft.compute/virtualmachines/sql-4qqp1"), - // to.Ptr("/subscriptions/a98d6dc5-eb8f-46cf-8938-f1fb08f03706/resourcegroups/databricks-rg-testwsp-xijmsdubneexm/providers/microsoft.compute/disks/488cdb42bf74474a98075415be3f806c-containerrootvolume")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](1409), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ResourceGroupDimensionsList.json -func ExampleDimensionsClient_NewListPager_resourceGroupDimensionsListLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/system.orlando", &armcostmanagement.DimensionsClientListOptions{Filter: nil, - Expand: to.Ptr("properties/data"), - Skiptoken: nil, - Top: to.Ptr[int32](5), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceType_2018-05-01_2018-05-31_5"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/system.orlando/providers/microsoft.CostManagement/dimensions_ResourceType_2018-05-01_2018-05-31_5"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource type"), - // Category: to.Ptr("ResourceType"), - // Data: []*string{ - // to.Ptr("microsoft.storage/storageaccounts")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](1), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("dimensions_ResourceId_2018-05-01_2018-05-31_5"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/system.orlando/providers/microsoft.CostManagement/dimensions_ResourceId_2018-05-01_2018-05-31_5"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource Id"), - // Category: to.Ptr("ResourceId"), - // Data: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/authprod"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/systemevents"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/armadminprod"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/srphytenaccount"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/system.orlando/providers/microsoft.storage/storageaccounts/publicsystemportal")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](27), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/SubscriptionDimensionsList.json -func ExampleDimensionsClient_NewListPager_subscriptionDimensionsListLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armcostmanagement.DimensionsClientListOptions{Filter: nil, - Expand: to.Ptr("properties/data"), - Skiptoken: nil, - Top: to.Ptr[int32](5), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceGroup_2018-05-01_2018-05-31_5"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/dimensions_ResourceGroup_2018-05-01_2018-05-31_5"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource group"), - // Category: to.Ptr("ResourceGroup"), - // Data: []*string{ - // to.Ptr("dcrg"), - // to.Ptr("rg"), - // to.Ptr("offlinegalleryrg"), - // to.Ptr("system.orlando.adminkeyvault"), - // to.Ptr("system.orlando.keyvault")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](68), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("dimensions_ResourceType_2018-05-01_2018-05-31_5"), - // Type: to.Ptr("microsoft.CostManagement/dimensions"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/dimensions_ResourceType_2018-05-01_2018-05-31_5"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource type"), - // Category: to.Ptr("ResourceType"), - // Data: []*string{ - // to.Ptr("microsoft.storage/storageaccounts"), - // to.Ptr("microsoft.web.admin/role"), - // to.Ptr("microsoft.sql/servers"), - // to.Ptr("microsoft.compute/virtualmachines")}, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](4), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-31T00:00:00-07:00"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T00:00:00-07:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalBillingAccountsDimensions.json -func ExampleDimensionsClient_NewByExternalCloudProviderTypePager_externalBillingAccountDimensionList() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewByExternalCloudProviderTypePager(armcostmanagement.ExternalCloudProviderTypeExternalBillingAccounts, "100", &armcostmanagement.DimensionsClientByExternalCloudProviderTypeOptions{Filter: nil, - Expand: nil, - Skiptoken: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceType_2019-12-01_2019-12-31"), - // Type: to.Ptr("microsoft.consumption/dimensions"), - // ID: to.Ptr("providers/Microsoft.CostManagement/externalBillingAccounts/100/dimensions_ResourceType_2019-12-01_2019-12-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource type"), - // Category: to.Ptr("ResourceType"), - // Data: []*string{ - // }, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](0), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-31T00:00:00Z"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T00:00:00Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("dimensions_ResourceId_2019-12-01_2019-12-31"), - // Type: to.Ptr("microsoft.consumption/dimensions"), - // ID: to.Ptr("providers/Microsoft.CostManagement/externalBillingAccounts/100/dimensions_ResourceId_2019-12-01_2019-12-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource ID"), - // Category: to.Ptr("ResourceId"), - // Data: []*string{ - // }, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](0), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-31T00:00:00Z"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T00:00:00Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalSubscriptionsDimensions.json -func ExampleDimensionsClient_NewByExternalCloudProviderTypePager_externalSubscriptionDimensionList() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDimensionsClient().NewByExternalCloudProviderTypePager(armcostmanagement.ExternalCloudProviderTypeExternalSubscriptions, "100", &armcostmanagement.DimensionsClientByExternalCloudProviderTypeOptions{Filter: nil, - Expand: nil, - Skiptoken: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DimensionsListResult = armcostmanagement.DimensionsListResult{ - // Value: []*armcostmanagement.Dimension{ - // { - // Name: to.Ptr("dimensions_ResourceType_2019-12-01_2019-12-31"), - // Type: to.Ptr("microsoft.consumption/dimensions"), - // ID: to.Ptr("providers/Microsoft.CostManagement/externalSubscriptions/123/dimensions_ResourceType_2019-12-01_2019-12-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource type"), - // Category: to.Ptr("ResourceType"), - // Data: []*string{ - // }, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](0), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-31T00:00:00Z"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T00:00:00Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("dimensions_ResourceId_2019-12-01_2019-12-31"), - // Type: to.Ptr("microsoft.consumption/dimensions"), - // ID: to.Ptr("providers/Microsoft.CostManagement/externalSubscriptions/123/dimensions_ResourceId_2019-12-01_2019-12-31"), - // Properties: &armcostmanagement.DimensionProperties{ - // Description: to.Ptr("Resource ID"), - // Category: to.Ptr("ResourceId"), - // Data: []*string{ - // }, - // FilterEnabled: to.Ptr(true), - // GroupingEnabled: to.Ptr(true), - // Total: to.Ptr[int32](0), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-31T00:00:00Z"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T00:00:00Z"); return t}()), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/exports_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/exports_client.go index 9a673b8f9161..55e579f821ba 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/exports_client.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/exports_client.go @@ -46,7 +46,7 @@ func NewExportsClient(credential azcore.TokenCredential, options *arm.ClientOpti // require eTag. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription // scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for // resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and @@ -88,7 +88,7 @@ func (client *ExportsClient) createOrUpdateCreateRequest(ctx context.Context, sc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -106,7 +106,7 @@ func (client *ExportsClient) createOrUpdateHandleResponse(resp *http.Response) ( // Delete - The operation to delete a export. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription // scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for // resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and @@ -147,16 +147,16 @@ func (client *ExportsClient) deleteCreateRequest(ctx context.Context, scope stri return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// Execute - The operation to execute an export. +// Execute - The operation to run an export. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription // scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for // resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and @@ -197,7 +197,7 @@ func (client *ExportsClient) executeCreateRequest(ctx context.Context, scope str return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -206,7 +206,7 @@ func (client *ExportsClient) executeCreateRequest(ctx context.Context, scope str // Get - The operation to get the export for the defined scope by export name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription // scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for // resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and @@ -247,7 +247,7 @@ func (client *ExportsClient) getCreateRequest(ctx context.Context, scope string, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -265,10 +265,10 @@ func (client *ExportsClient) getHandleResponse(resp *http.Response) (ExportsClie return result, nil } -// GetExecutionHistory - The operation to get the execution history of an export for the defined scope and export name. +// GetExecutionHistory - The operation to get the run history of an export for the defined scope and export name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription // scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for // resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and @@ -310,7 +310,7 @@ func (client *ExportsClient) getExecutionHistoryCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -328,7 +328,7 @@ func (client *ExportsClient) getExecutionHistoryHandleResponse(resp *http.Respon // List - The operation to list all exports at the given scope. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription // scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for // resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and @@ -364,7 +364,7 @@ func (client *ExportsClient) listCreateRequest(ctx context.Context, scope string return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/exports_client_example_test.go b/sdk/resourcemanager/costmanagement/armcostmanagement/exports_client_example_test.go deleted file mode 100644 index 8d758f332b3e..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/exports_client_example_test.go +++ /dev/null @@ -1,2301 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcostmanagement_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportsGetByBillingAccount.json -func ExampleExportsClient_List_exportsGetByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportsClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/123456", &armcostmanagement.ExportsClientListOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExportListResult = armcostmanagement.ExportListResult{ - // Value: []*armcostmanagement.Export{ - // { - // Name: to.Ptr("TestExport1"), - // Type: to.Ptr("Microsoft.CostManagement/exports"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/123456/providers/Microsoft.CostManagement/exports/TestExport1"), - // Properties: &armcostmanagement.ExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // TimePeriod: &armcostmanagement.ExportTimePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ad-hoc"), - // }, - // }, - // }, - // }, - // { - // Name: to.Ptr("TestExport2"), - // Type: to.Ptr("Microsoft.CostManagement/exports"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/123456/providers/Microsoft.CostManagement/exports/TestExport2"), - // Properties: &armcostmanagement.ExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeWeekToDate), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ad-hoc"), - // }, - // }, - // Schedule: &armcostmanagement.ExportSchedule{ - // Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly), - // RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Status: to.Ptr(armcostmanagement.StatusTypeActive), - // }, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportsGetByDepartment.json -func ExampleExportsClient_List_exportsGetByDepartment() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportsClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/12/departments/123", &armcostmanagement.ExportsClientListOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExportListResult = armcostmanagement.ExportListResult{ - // Value: []*armcostmanagement.Export{ - // { - // Name: to.Ptr("TestExport1"), - // Type: to.Ptr("Microsoft.CostManagement/exports"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12/departments/1234/providers/Microsoft.CostManagement/exports/TestExport1"), - // Properties: &armcostmanagement.ExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // TimePeriod: &armcostmanagement.ExportTimePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ad-hoc"), - // }, - // }, - // }, - // }, - // { - // Name: to.Ptr("TestExport2"), - // Type: to.Ptr("Microsoft.CostManagement/exports"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12/departments/1234/providers/Microsoft.CostManagement/exports/TestExport2"), - // Properties: &armcostmanagement.ExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeWeekToDate), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ad-hoc"), - // }, - // }, - // Schedule: &armcostmanagement.ExportSchedule{ - // Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly), - // RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Status: to.Ptr(armcostmanagement.StatusTypeActive), - // }, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportsGetByEnrollmentAccount.json -func ExampleExportsClient_List_exportsGetByEnrollmentAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportsClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", &armcostmanagement.ExportsClientListOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExportListResult = armcostmanagement.ExportListResult{ - // Value: []*armcostmanagement.Export{ - // { - // Name: to.Ptr("TestExport1"), - // Type: to.Ptr("Microsoft.CostManagement/exports"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/Microsoft.CostManagement/exports/TestExport1"), - // Properties: &armcostmanagement.ExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // TimePeriod: &armcostmanagement.ExportTimePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ad-hoc"), - // }, - // }, - // }, - // }, - // { - // Name: to.Ptr("TestExport2"), - // Type: to.Ptr("Microsoft.CostManagement/exports"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/Microsoft.CostManagement/exports/TestExport2"), - // Properties: &armcostmanagement.ExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeWeekToDate), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ad-hoc"), - // }, - // }, - // Schedule: &armcostmanagement.ExportSchedule{ - // Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly), - // RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Status: to.Ptr(armcostmanagement.StatusTypeActive), - // }, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportsGetByManagementGroup.json -func ExampleExportsClient_List_exportsGetByManagementGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportsClient().List(ctx, "providers/Microsoft.Management/managementGroups/TestMG", &armcostmanagement.ExportsClientListOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExportListResult = armcostmanagement.ExportListResult{ - // Value: []*armcostmanagement.Export{ - // { - // Name: to.Ptr("TestExport1"), - // Type: to.Ptr("Microsoft.CostManagement/exports"), - // ID: to.Ptr("providers/Microsoft.Management/managementGroups/TestMG/providers/Microsoft.CostManagement/exports/TestExport1"), - // Properties: &armcostmanagement.ExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // TimePeriod: &armcostmanagement.ExportTimePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ad-hoc"), - // }, - // }, - // }, - // }, - // { - // Name: to.Ptr("TestExport2"), - // Type: to.Ptr("Microsoft.CostManagement/exports"), - // ID: to.Ptr("providers/Microsoft.Management/managementGroups/TestMG/providers/Microsoft.CostManagement/exports/TestExport2"), - // Properties: &armcostmanagement.ExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeWeekToDate), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ad-hoc"), - // }, - // }, - // Schedule: &armcostmanagement.ExportSchedule{ - // Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly), - // RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Status: to.Ptr(armcostmanagement.StatusTypeActive), - // }, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportsGetByResourceGroup.json -func ExampleExportsClient_List_exportsGetByResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportsClient().List(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", &armcostmanagement.ExportsClientListOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExportListResult = armcostmanagement.ExportListResult{ - // Value: []*armcostmanagement.Export{ - // { - // Name: to.Ptr("TestExport1"), - // Type: to.Ptr("Microsoft.CostManagement/exports"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/exports/TestExport1"), - // Properties: &armcostmanagement.ExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // TimePeriod: &armcostmanagement.ExportTimePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ad-hoc"), - // }, - // }, - // }, - // }, - // { - // Name: to.Ptr("TestExport2"), - // Type: to.Ptr("Microsoft.CostManagement/exports"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/exports/TestExport2"), - // Properties: &armcostmanagement.ExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeWeekToDate), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ad-hoc"), - // }, - // }, - // Schedule: &armcostmanagement.ExportSchedule{ - // Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly), - // RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Status: to.Ptr(armcostmanagement.StatusTypeActive), - // }, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportsGetBySubscription.json -func ExampleExportsClient_List_exportsGetBySubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportsClient().List(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", &armcostmanagement.ExportsClientListOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExportListResult = armcostmanagement.ExportListResult{ - // Value: []*armcostmanagement.Export{ - // { - // Name: to.Ptr("TestExport1"), - // Type: to.Ptr("Microsoft.CostManagement/exports"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/exports/TestExport1"), - // Properties: &armcostmanagement.ExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // TimePeriod: &armcostmanagement.ExportTimePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ad-hoc"), - // }, - // }, - // }, - // }, - // { - // Name: to.Ptr("TestExport2"), - // Type: to.Ptr("Microsoft.CostManagement/exports"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/exports/TestExport2"), - // Properties: &armcostmanagement.ExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeWeekToDate), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ad-hoc"), - // }, - // }, - // Schedule: &armcostmanagement.ExportSchedule{ - // Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly), - // RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Status: to.Ptr(armcostmanagement.StatusTypeActive), - // }, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportGetByBillingAccount.json -func ExampleExportsClient_Get_exportGetByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportsClient().Get(ctx, "providers/Microsoft.Billing/billingAccounts/123456", "TestExport", &armcostmanagement.ExportsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Export = armcostmanagement.Export{ - // Name: to.Ptr("TestExport"), - // Type: to.Ptr("Microsoft.CostManagement/exports"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/{billingAccount-Id}/providers/Microsoft.CostManagement/exports/TestExport"), - // Properties: &armcostmanagement.ExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // TimePeriod: &armcostmanagement.ExportTimePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-31T00:00:00Z"); return t}()), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ad-hoc"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportGetByDepartment.json -func ExampleExportsClient_Get_exportGetByDepartment() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportsClient().Get(ctx, "providers/Microsoft.Billing/billingAccounts/12/departments/1234", "TestExport", &armcostmanagement.ExportsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Export = armcostmanagement.Export{ - // Name: to.Ptr("TestExport"), - // Type: to.Ptr("Microsoft.CostManagement/exports"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12/departments/1234/providers/Microsoft.CostManagement/exports/TestExport"), - // Properties: &armcostmanagement.ExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // TimePeriod: &armcostmanagement.ExportTimePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-30T00:00:00Z"); return t}()), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ad-hoc"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportGetByEnrollmentAccount.json -func ExampleExportsClient_Get_exportGetByEnrollmentAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportsClient().Get(ctx, "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", "TestExport", &armcostmanagement.ExportsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Export = armcostmanagement.Export{ - // Name: to.Ptr("TestExport"), - // Type: to.Ptr("Microsoft.CostManagement/exports"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/Microsoft.CostManagement/exports/TestExport"), - // Properties: &armcostmanagement.ExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // TimePeriod: &armcostmanagement.ExportTimePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00Z"); return t}()), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ad-hoc"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportGetByManagementGroup.json -func ExampleExportsClient_Get_exportGetByManagementGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportsClient().Get(ctx, "providers/Microsoft.Management/managementGroups/TestMG", "TestExport", &armcostmanagement.ExportsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Export = armcostmanagement.Export{ - // Name: to.Ptr("TestExport"), - // Type: to.Ptr("Microsoft.CostManagement/exports"), - // ID: to.Ptr("providers/Microsoft.Management/managementGroups/TestMG/providers/Microsoft.CostManagement/exports/TestExport"), - // Properties: &armcostmanagement.ExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("UsageDate"), - // to.Ptr("MeterId"), - // to.Ptr("InstanceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("UsageQuantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // TimePeriod: &armcostmanagement.ExportTimePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ad-hoc"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportGetByResourceGroup.json -func ExampleExportsClient_Get_exportGetByResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", "TestExport", &armcostmanagement.ExportsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Export = armcostmanagement.Export{ - // Name: to.Ptr("TestExport"), - // Type: to.Ptr("Microsoft.CostManagement/exports"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/exports/TestExport"), - // Properties: &armcostmanagement.ExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // TimePeriod: &armcostmanagement.ExportTimePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-30T00:00:00Z"); return t}()), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ad-hoc"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportGetBySubscription.json -func ExampleExportsClient_Get_exportGetBySubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "TestExport", &armcostmanagement.ExportsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Export = armcostmanagement.Export{ - // Name: to.Ptr("TestExport"), - // Type: to.Ptr("Microsoft.CostManagement/exports"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/exports/TestExport"), - // Properties: &armcostmanagement.ExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // TimePeriod: &armcostmanagement.ExportTimePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-31T00:00:00Z"); return t}()), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ad-hoc"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportCreateOrUpdateByBillingAccount.json -func ExampleExportsClient_CreateOrUpdate_exportCreateOrUpdateByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportsClient().CreateOrUpdate(ctx, "providers/Microsoft.Billing/billingAccounts/123456", "TestExport", armcostmanagement.Export{ - Properties: &armcostmanagement.ExportProperties{ - Format: to.Ptr(armcostmanagement.FormatTypeCSV), - Definition: &armcostmanagement.ExportDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - DataSet: &armcostmanagement.ExportDataset{ - Configuration: &armcostmanagement.ExportDatasetConfiguration{ - Columns: []*string{ - to.Ptr("Date"), - to.Ptr("MeterId"), - to.Ptr("ResourceId"), - to.Ptr("ResourceLocation"), - to.Ptr("Quantity")}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate), - }, - DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - Destination: &armcostmanagement.ExportDeliveryDestination{ - Container: to.Ptr("exports"), - ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - RootFolderPath: to.Ptr("ad-hoc"), - }, - }, - Schedule: &armcostmanagement.ExportSchedule{ - Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly), - RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{ - From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t }()), - To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t }()), - }, - Status: to.Ptr(armcostmanagement.StatusTypeActive), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Export = armcostmanagement.Export{ - // Name: to.Ptr("TestExport"), - // Type: to.Ptr("Microsoft.CostManagement/exports"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/123456/providers/Microsoft.CostManagement/exports/TestExport"), - // Properties: &armcostmanagement.ExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ad-hoc"), - // }, - // }, - // Schedule: &armcostmanagement.ExportSchedule{ - // Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly), - // RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Status: to.Ptr(armcostmanagement.StatusTypeActive), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportCreateOrUpdateByDepartment.json -func ExampleExportsClient_CreateOrUpdate_exportCreateOrUpdateByDepartment() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportsClient().CreateOrUpdate(ctx, "providers/Microsoft.Billing/billingAccounts/12/departments/1234", "TestExport", armcostmanagement.Export{ - Properties: &armcostmanagement.ExportProperties{ - Format: to.Ptr(armcostmanagement.FormatTypeCSV), - Definition: &armcostmanagement.ExportDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - DataSet: &armcostmanagement.ExportDataset{ - Configuration: &armcostmanagement.ExportDatasetConfiguration{ - Columns: []*string{ - to.Ptr("Date"), - to.Ptr("MeterId"), - to.Ptr("ResourceId"), - to.Ptr("ResourceLocation"), - to.Ptr("Quantity")}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate), - }, - DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - Destination: &armcostmanagement.ExportDeliveryDestination{ - Container: to.Ptr("exports"), - ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - RootFolderPath: to.Ptr("ad-hoc"), - }, - }, - Schedule: &armcostmanagement.ExportSchedule{ - Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly), - RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{ - From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t }()), - To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t }()), - }, - Status: to.Ptr(armcostmanagement.StatusTypeActive), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Export = armcostmanagement.Export{ - // Name: to.Ptr("TestExport"), - // Type: to.Ptr("Microsoft.CostManagement/exports"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12/departments/1234/providers/Microsoft.CostManagement/exports/TestExport"), - // Properties: &armcostmanagement.ExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ad-hoc"), - // }, - // }, - // Schedule: &armcostmanagement.ExportSchedule{ - // Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly), - // RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Status: to.Ptr(armcostmanagement.StatusTypeActive), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportCreateOrUpdateByEnrollmentAccount.json -func ExampleExportsClient_CreateOrUpdate_exportCreateOrUpdateByEnrollmentAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportsClient().CreateOrUpdate(ctx, "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", "TestExport", armcostmanagement.Export{ - Properties: &armcostmanagement.ExportProperties{ - Format: to.Ptr(armcostmanagement.FormatTypeCSV), - Definition: &armcostmanagement.ExportDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - DataSet: &armcostmanagement.ExportDataset{ - Configuration: &armcostmanagement.ExportDatasetConfiguration{ - Columns: []*string{ - to.Ptr("Date"), - to.Ptr("MeterId"), - to.Ptr("ResourceId"), - to.Ptr("ResourceLocation"), - to.Ptr("Quantity")}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate), - }, - DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - Destination: &armcostmanagement.ExportDeliveryDestination{ - Container: to.Ptr("exports"), - ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - RootFolderPath: to.Ptr("ad-hoc"), - }, - }, - Schedule: &armcostmanagement.ExportSchedule{ - Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly), - RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{ - From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t }()), - To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t }()), - }, - Status: to.Ptr(armcostmanagement.StatusTypeActive), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Export = armcostmanagement.Export{ - // Name: to.Ptr("TestExport"), - // Type: to.Ptr("Microsoft.CostManagement/exports"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/Microsoft.CostManagement/exports/TestExport"), - // Properties: &armcostmanagement.ExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ad-hoc"), - // }, - // }, - // Schedule: &armcostmanagement.ExportSchedule{ - // Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly), - // RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Status: to.Ptr(armcostmanagement.StatusTypeActive), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportCreateOrUpdateByManagementGroup.json -func ExampleExportsClient_CreateOrUpdate_exportCreateOrUpdateByManagementGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportsClient().CreateOrUpdate(ctx, "providers/Microsoft.Management/managementGroups/TestMG", "TestExport", armcostmanagement.Export{ - Properties: &armcostmanagement.ExportProperties{ - Format: to.Ptr(armcostmanagement.FormatTypeCSV), - Definition: &armcostmanagement.ExportDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - DataSet: &armcostmanagement.ExportDataset{ - Configuration: &armcostmanagement.ExportDatasetConfiguration{ - Columns: []*string{ - to.Ptr("Date"), - to.Ptr("MeterId"), - to.Ptr("ResourceId"), - to.Ptr("ResourceLocation"), - to.Ptr("Quantity")}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate), - }, - DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - Destination: &armcostmanagement.ExportDeliveryDestination{ - Container: to.Ptr("exports"), - ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - RootFolderPath: to.Ptr("ad-hoc"), - }, - }, - Schedule: &armcostmanagement.ExportSchedule{ - Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly), - RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{ - From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t }()), - To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t }()), - }, - Status: to.Ptr(armcostmanagement.StatusTypeActive), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Export = armcostmanagement.Export{ - // Name: to.Ptr("TestExport"), - // Type: to.Ptr("Microsoft.CostManagement/exports"), - // ID: to.Ptr("providers/Microsoft.Management/managementGroups/TestMG/providers/Microsoft.CostManagement/exports/TestExport"), - // Properties: &armcostmanagement.ExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ad-hoc"), - // }, - // }, - // Schedule: &armcostmanagement.ExportSchedule{ - // Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly), - // RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Status: to.Ptr(armcostmanagement.StatusTypeActive), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportCreateOrUpdateByResourceGroup.json -func ExampleExportsClient_CreateOrUpdate_exportCreateOrUpdateByResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportsClient().CreateOrUpdate(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", "TestExport", armcostmanagement.Export{ - Properties: &armcostmanagement.ExportProperties{ - Format: to.Ptr(armcostmanagement.FormatTypeCSV), - Definition: &armcostmanagement.ExportDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - DataSet: &armcostmanagement.ExportDataset{ - Configuration: &armcostmanagement.ExportDatasetConfiguration{ - Columns: []*string{ - to.Ptr("Date"), - to.Ptr("MeterId"), - to.Ptr("ResourceId"), - to.Ptr("ResourceLocation"), - to.Ptr("Quantity")}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate), - }, - DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - Destination: &armcostmanagement.ExportDeliveryDestination{ - Container: to.Ptr("exports"), - ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - RootFolderPath: to.Ptr("ad-hoc"), - }, - }, - Schedule: &armcostmanagement.ExportSchedule{ - Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly), - RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{ - From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t }()), - To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t }()), - }, - Status: to.Ptr(armcostmanagement.StatusTypeActive), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Export = armcostmanagement.Export{ - // Name: to.Ptr("TestExport"), - // Type: to.Ptr("Microsoft.CostManagement/exports"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/exports/TestExport"), - // Properties: &armcostmanagement.ExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ad-hoc"), - // }, - // }, - // Schedule: &armcostmanagement.ExportSchedule{ - // Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly), - // RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Status: to.Ptr(armcostmanagement.StatusTypeActive), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportCreateOrUpdateBySubscription.json -func ExampleExportsClient_CreateOrUpdate_exportCreateOrUpdateBySubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportsClient().CreateOrUpdate(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "TestExport", armcostmanagement.Export{ - Properties: &armcostmanagement.ExportProperties{ - Format: to.Ptr(armcostmanagement.FormatTypeCSV), - Definition: &armcostmanagement.ExportDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - DataSet: &armcostmanagement.ExportDataset{ - Configuration: &armcostmanagement.ExportDatasetConfiguration{ - Columns: []*string{ - to.Ptr("Date"), - to.Ptr("MeterId"), - to.Ptr("ResourceId"), - to.Ptr("ResourceLocation"), - to.Ptr("Quantity")}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate), - }, - DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - Destination: &armcostmanagement.ExportDeliveryDestination{ - Container: to.Ptr("exports"), - ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - RootFolderPath: to.Ptr("ad-hoc"), - }, - }, - Schedule: &armcostmanagement.ExportSchedule{ - Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly), - RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{ - From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t }()), - To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t }()), - }, - Status: to.Ptr(armcostmanagement.StatusTypeActive), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Export = armcostmanagement.Export{ - // Name: to.Ptr("TestExport"), - // Type: to.Ptr("Microsoft.CostManagement/exports"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/exports/TestExport"), - // Properties: &armcostmanagement.ExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ad-hoc"), - // }, - // }, - // Schedule: &armcostmanagement.ExportSchedule{ - // Recurrence: to.Ptr(armcostmanagement.RecurrenceTypeWeekly), - // RecurrencePeriod: &armcostmanagement.ExportRecurrencePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Status: to.Ptr(armcostmanagement.StatusTypeActive), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportDeleteByBillingAccount.json -func ExampleExportsClient_Delete_exportDeleteByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewExportsClient().Delete(ctx, "providers/Microsoft.Billing/billingAccounts/123456", "TestExport", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportDeleteByDepartment.json -func ExampleExportsClient_Delete_exportDeleteByDepartment() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewExportsClient().Delete(ctx, "providers/Microsoft.Billing/billingAccounts/12/departments/1234", "TestExport", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportDeleteByEnrollmentAccount.json -func ExampleExportsClient_Delete_exportDeleteByEnrollmentAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewExportsClient().Delete(ctx, "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", "TestExport", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportDeleteByManagementGroup.json -func ExampleExportsClient_Delete_exportDeleteByManagementGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewExportsClient().Delete(ctx, "providers/Microsoft.Management/managementGroups/TestMG", "TestExport", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportDeleteByResourceGroup.json -func ExampleExportsClient_Delete_exportDeleteByResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewExportsClient().Delete(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", "TestExport", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportDeleteBySubscription.json -func ExampleExportsClient_Delete_exportDeleteBySubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewExportsClient().Delete(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "TestExport", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunByBillingAccount.json -func ExampleExportsClient_Execute_exportRunByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewExportsClient().Execute(ctx, "providers/Microsoft.Billing/billingAccounts/123456", "TestExport", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunByDepartment.json -func ExampleExportsClient_Execute_exportRunByDepartment() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewExportsClient().Execute(ctx, "providers/Microsoft.Billing/billingAccounts/12/departments/1234", "TestExport", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunByEnrollmentAccount.json -func ExampleExportsClient_Execute_exportRunByEnrollmentAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewExportsClient().Execute(ctx, "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", "TestExport", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunByManagementGroup.json -func ExampleExportsClient_Execute_exportRunByManagementGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewExportsClient().Execute(ctx, "providers/Microsoft.Management/managementGroups/TestMG", "TestExport", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunByResourceGroup.json -func ExampleExportsClient_Execute_exportRunByResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewExportsClient().Execute(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", "TestExport", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunBySubscription.json -func ExampleExportsClient_Execute_exportRunBySubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewExportsClient().Execute(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "TestExport", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunHistoryGetByBillingAccount.json -func ExampleExportsClient_GetExecutionHistory_exportRunHistoryGetByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportsClient().GetExecutionHistory(ctx, "providers/Microsoft.Billing/billingAccounts/123456", "TestExport", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExportExecutionListResult = armcostmanagement.ExportExecutionListResult{ - // Value: []*armcostmanagement.ExportExecution{ - // { - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/{billingAccount-id}/providers/Microsoft.CostManagement/exports/JohnDoeSchedule/Run/1e25d58a-a3b0-4916-9542-6e04a89bc100"), - // Properties: &armcostmanagement.ExportExecutionProperties{ - // ExecutionType: to.Ptr(armcostmanagement.ExecutionTypeOnDemand), - // FileName: to.Ptr("ScheduledTestsForJohnDoe/JohnDoeSchedule/20180729-20180804/JohnDoeSchedule_1e25d58a-a3b0-4916-9542-6e04a89bc100.csv"), - // ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:28.0373318Z"); return t}()), - // ProcessingStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:16.9123797Z"); return t}()), - // RunSettings: &armcostmanagement.CommonExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // TimePeriod: &armcostmanagement.ExportTimePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ScheduledTestsForJohnDoe"), - // }, - // }, - // }, - // Status: to.Ptr(armcostmanagement.ExecutionStatusCompleted), - // SubmittedBy: to.Ptr("john.doe@gmail.com"), - // SubmittedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:15.6016681Z"); return t}()), - // }, - // }, - // { - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/{billingAccount-id}/providers/Microsoft.CostManagement/exports/JohnDoeSchedule/Run/11ac6811-dca3-46ad-b326-4704cf0c58ef"), - // Properties: &armcostmanagement.ExportExecutionProperties{ - // ExecutionType: to.Ptr(armcostmanagement.ExecutionTypeScheduled), - // FileName: to.Ptr("ScheduledTestsForJohnDoe/JohnDoeSchedule/20180729-20180804/JohnDoeSchedule_11ac6811-dca3-46ad-b326-4704cf0c58ef.csv"), - // ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:04:19.7223808Z"); return t}()), - // ProcessingStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:03:58.5710244Z"); return t}()), - // RunSettings: &armcostmanagement.CommonExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // TimePeriod: &armcostmanagement.ExportTimePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ScheduledTestsForJohnDoe"), - // }, - // }, - // }, - // Status: to.Ptr(armcostmanagement.ExecutionStatusCompleted), - // SubmittedBy: to.Ptr("System"), - // SubmittedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:03:58.5710244Z"); return t}()), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunHistoryGetByDepartment.json -func ExampleExportsClient_GetExecutionHistory_exportRunHistoryGetByDepartment() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportsClient().GetExecutionHistory(ctx, "providers/Microsoft.Billing/billingAccounts/12/departments/1234", "TestExport", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExportExecutionListResult = armcostmanagement.ExportExecutionListResult{ - // Value: []*armcostmanagement.ExportExecution{ - // { - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12/departments/1234/providers/Microsoft.CostManagement/exports/JohnDoeSchedule/Run/1e25d58a-a3b0-4916-9542-6e04a89bc100"), - // Properties: &armcostmanagement.ExportExecutionProperties{ - // ExecutionType: to.Ptr(armcostmanagement.ExecutionTypeOnDemand), - // FileName: to.Ptr("ScheduledTestsForJohnDoe/JohnDoeSchedule/20180729-20180804/JohnDoeSchedule_1e25d58a-a3b0-4916-9542-6e04a89bc100.csv"), - // ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:28.0373318Z"); return t}()), - // ProcessingStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:16.9123797Z"); return t}()), - // RunSettings: &armcostmanagement.CommonExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // TimePeriod: &armcostmanagement.ExportTimePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ScheduledTestsForJohnDoe"), - // }, - // }, - // }, - // Status: to.Ptr(armcostmanagement.ExecutionStatusCompleted), - // SubmittedBy: to.Ptr("john.doe@gmail.com"), - // SubmittedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:15.6016681Z"); return t}()), - // }, - // }, - // { - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12/departments/1234/providers/Microsoft.CostManagement/exports/JohnDoeSchedule/Run/11ac6811-dca3-46ad-b326-4704cf0c58ef"), - // Properties: &armcostmanagement.ExportExecutionProperties{ - // ExecutionType: to.Ptr(armcostmanagement.ExecutionTypeScheduled), - // FileName: to.Ptr("ScheduledTestsForJohnDoe/JohnDoeSchedule/20180729-20180804/JohnDoeSchedule_11ac6811-dca3-46ad-b326-4704cf0c58ef.csv"), - // ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:04:19.7223808Z"); return t}()), - // ProcessingStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:03:58.5710244Z"); return t}()), - // RunSettings: &armcostmanagement.CommonExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // TimePeriod: &armcostmanagement.ExportTimePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ScheduledTestsForJohnDoe"), - // }, - // }, - // }, - // Status: to.Ptr(armcostmanagement.ExecutionStatusCompleted), - // SubmittedBy: to.Ptr("System"), - // SubmittedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:03:58.5710244Z"); return t}()), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunHistoryGetByEnrollmentAccount.json -func ExampleExportsClient_GetExecutionHistory_exportRunHistoryGetByEnrollmentAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportsClient().GetExecutionHistory(ctx, "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", "TestExport", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExportExecutionListResult = armcostmanagement.ExportExecutionListResult{ - // Value: []*armcostmanagement.ExportExecution{ - // { - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/Microsoft.CostManagement/exports/JohnDoeSchedule/Run/1e25d58a-a3b0-4916-9542-6e04a89bc100"), - // Properties: &armcostmanagement.ExportExecutionProperties{ - // ExecutionType: to.Ptr(armcostmanagement.ExecutionTypeOnDemand), - // FileName: to.Ptr("ScheduledTestsForJohnDoe/JohnDoeSchedule/20180729-20180804/JohnDoeSchedule_1e25d58a-a3b0-4916-9542-6e04a89bc100.csv"), - // ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:28.0373318Z"); return t}()), - // ProcessingStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:16.9123797Z"); return t}()), - // RunSettings: &armcostmanagement.CommonExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // TimePeriod: &armcostmanagement.ExportTimePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ScheduledTestsForJohnDoe"), - // }, - // }, - // }, - // Status: to.Ptr(armcostmanagement.ExecutionStatusCompleted), - // SubmittedBy: to.Ptr("john.doe@gmail.com"), - // SubmittedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:15.6016681Z"); return t}()), - // }, - // }, - // { - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456/providers/Microsoft.CostManagement/exports/JohnDoeSchedule/Run/11ac6811-dca3-46ad-b326-4704cf0c58ef"), - // Properties: &armcostmanagement.ExportExecutionProperties{ - // ExecutionType: to.Ptr(armcostmanagement.ExecutionTypeScheduled), - // FileName: to.Ptr("ScheduledTestsForJohnDoe/JohnDoeSchedule/20180729-20180804/JohnDoeSchedule_11ac6811-dca3-46ad-b326-4704cf0c58ef.csv"), - // ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:04:19.7223808Z"); return t}()), - // ProcessingStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:03:58.5710244Z"); return t}()), - // RunSettings: &armcostmanagement.CommonExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // TimePeriod: &armcostmanagement.ExportTimePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ScheduledTestsForJohnDoe"), - // }, - // }, - // }, - // Status: to.Ptr(armcostmanagement.ExecutionStatusCompleted), - // SubmittedBy: to.Ptr("System"), - // SubmittedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:03:58.5710244Z"); return t}()), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunHistoryGetByManagementGroup.json -func ExampleExportsClient_GetExecutionHistory_exportRunHistoryGetByManagementGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportsClient().GetExecutionHistory(ctx, "providers/Microsoft.Management/managementGroups/TestMG", "TestExport", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExportExecutionListResult = armcostmanagement.ExportExecutionListResult{ - // Value: []*armcostmanagement.ExportExecution{ - // { - // ID: to.Ptr("providers/Microsoft.Management/managementGroups/TestMG/providers/Microsoft.CostManagement/exports/TestExport/Run/1e25d58a-a3b0-4916-9542-6e04a89bc100"), - // Properties: &armcostmanagement.ExportExecutionProperties{ - // ExecutionType: to.Ptr(armcostmanagement.ExecutionTypeOnDemand), - // FileName: to.Ptr("ScheduledForTestExport/TestExportSchedule/20180729-20180804/TestExportSchedule_1e25d58a-a3b0-4916-9542-6e04a89bc100.csv"), - // ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:28.0373318Z"); return t}()), - // ProcessingStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:16.9123797Z"); return t}()), - // RunSettings: &armcostmanagement.CommonExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // TimePeriod: &armcostmanagement.ExportTimePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ScheduledTestsForJohnDoe"), - // }, - // }, - // }, - // Status: to.Ptr(armcostmanagement.ExecutionStatusCompleted), - // SubmittedBy: to.Ptr("john.doe@gmail.com"), - // SubmittedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:15.6016681Z"); return t}()), - // }, - // }, - // { - // ID: to.Ptr("providers/Microsoft.Management/managementGroups/TestMG/providers/Microsoft.CostManagement/exports/TestExport/Run/11ac6811-dca3-46ad-b326-4704cf0c58ef"), - // Properties: &armcostmanagement.ExportExecutionProperties{ - // ExecutionType: to.Ptr(armcostmanagement.ExecutionTypeScheduled), - // FileName: to.Ptr("ScheduledForTestExport/TestExportSchedule/20180729-20180804/TestExportSchedule_11ac6811-dca3-46ad-b326-4704cf0c58ef.csv"), - // ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:04:19.7223808Z"); return t}()), - // ProcessingStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:03:58.5710244Z"); return t}()), - // RunSettings: &armcostmanagement.CommonExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // TimePeriod: &armcostmanagement.ExportTimePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ScheduledTestsForJohnDoe"), - // }, - // }, - // }, - // Status: to.Ptr(armcostmanagement.ExecutionStatusCompleted), - // SubmittedBy: to.Ptr("System"), - // SubmittedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:03:58.5710244Z"); return t}()), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunHistoryGetByResourceGroup.json -func ExampleExportsClient_GetExecutionHistory_exportRunHistoryGetByResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportsClient().GetExecutionHistory(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", "TestExport", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExportExecutionListResult = armcostmanagement.ExportExecutionListResult{ - // Value: []*armcostmanagement.ExportExecution{ - // { - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/exports/JohnDoeSchedule/Run/1e25d58a-a3b0-4916-9542-6e04a89bc100"), - // Properties: &armcostmanagement.ExportExecutionProperties{ - // ExecutionType: to.Ptr(armcostmanagement.ExecutionTypeOnDemand), - // FileName: to.Ptr("ScheduledTestsForJohnDoe/JohnDoeSchedule/20180729-20180804/JohnDoeSchedule_1e25d58a-a3b0-4916-9542-6e04a89bc100.csv"), - // ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:28.0373318Z"); return t}()), - // ProcessingStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:16.9123797Z"); return t}()), - // RunSettings: &armcostmanagement.CommonExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // TimePeriod: &armcostmanagement.ExportTimePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ScheduledTestsForJohnDoe"), - // }, - // }, - // }, - // Status: to.Ptr(armcostmanagement.ExecutionStatusCompleted), - // SubmittedBy: to.Ptr("john.doe@gmail.com"), - // SubmittedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:15.6016681Z"); return t}()), - // }, - // }, - // { - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/exports/JohnDoeSchedule/Run/11ac6811-dca3-46ad-b326-4704cf0c58ef"), - // Properties: &armcostmanagement.ExportExecutionProperties{ - // ExecutionType: to.Ptr(armcostmanagement.ExecutionTypeScheduled), - // FileName: to.Ptr("ScheduledTestsForJohnDoe/JohnDoeSchedule/20180729-20180804/JohnDoeSchedule_11ac6811-dca3-46ad-b326-4704cf0c58ef.csv"), - // ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:04:19.7223808Z"); return t}()), - // ProcessingStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:03:58.5710244Z"); return t}()), - // RunSettings: &armcostmanagement.CommonExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // TimePeriod: &armcostmanagement.ExportTimePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ScheduledTestsForJohnDoe"), - // }, - // }, - // }, - // Status: to.Ptr(armcostmanagement.ExecutionStatusCompleted), - // SubmittedBy: to.Ptr("System"), - // SubmittedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:03:58.5710244Z"); return t}()), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunHistoryGetBySubscription.json -func ExampleExportsClient_GetExecutionHistory_exportRunHistoryGetBySubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportsClient().GetExecutionHistory(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "TestExport", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExportExecutionListResult = armcostmanagement.ExportExecutionListResult{ - // Value: []*armcostmanagement.ExportExecution{ - // { - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/exports/JohnDoeSchedule/Run/1e25d58a-a3b0-4916-9542-6e04a89bc100"), - // Properties: &armcostmanagement.ExportExecutionProperties{ - // ExecutionType: to.Ptr(armcostmanagement.ExecutionTypeOnDemand), - // FileName: to.Ptr("ScheduledTestsForJohnDoe/JohnDoeSchedule/20180729-20180804/JohnDoeSchedule_1e25d58a-a3b0-4916-9542-6e04a89bc100.csv"), - // ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:28.0373318Z"); return t}()), - // ProcessingStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:16.9123797Z"); return t}()), - // RunSettings: &armcostmanagement.CommonExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // TimePeriod: &armcostmanagement.ExportTimePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ScheduledTestsForJohnDoe"), - // }, - // }, - // }, - // Status: to.Ptr(armcostmanagement.ExecutionStatusCompleted), - // SubmittedBy: to.Ptr("john.doe@gmail.com"), - // SubmittedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T07:52:15.6016681Z"); return t}()), - // }, - // }, - // { - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/exports/JohnDoeSchedule/Run/11ac6811-dca3-46ad-b326-4704cf0c58ef"), - // Properties: &armcostmanagement.ExportExecutionProperties{ - // ExecutionType: to.Ptr(armcostmanagement.ExecutionTypeScheduled), - // FileName: to.Ptr("ScheduledTestsForJohnDoe/JohnDoeSchedule/20180729-20180804/JohnDoeSchedule_11ac6811-dca3-46ad-b326-4704cf0c58ef.csv"), - // ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:04:19.7223808Z"); return t}()), - // ProcessingStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:03:58.5710244Z"); return t}()), - // RunSettings: &armcostmanagement.CommonExportProperties{ - // Format: to.Ptr(armcostmanagement.FormatTypeCSV), - // Definition: &armcostmanagement.ExportDefinition{ - // Type: to.Ptr(armcostmanagement.ExportTypeActualCost), - // DataSet: &armcostmanagement.ExportDataset{ - // Configuration: &armcostmanagement.ExportDatasetConfiguration{ - // Columns: []*string{ - // to.Ptr("Date"), - // to.Ptr("MeterId"), - // to.Ptr("ResourceId"), - // to.Ptr("ResourceLocation"), - // to.Ptr("Quantity")}, - // }, - // Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - // }, - // TimePeriod: &armcostmanagement.ExportTimePeriod{ - // From: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T00:00:00Z"); return t}()), - // To: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-31T00:00:00Z"); return t}()), - // }, - // Timeframe: to.Ptr(armcostmanagement.TimeframeTypeCustom), - // }, - // DeliveryInfo: &armcostmanagement.ExportDeliveryInfo{ - // Destination: &armcostmanagement.ExportDeliveryDestination{ - // Container: to.Ptr("exports"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), - // RootFolderPath: to.Ptr("ScheduledTestsForJohnDoe"), - // }, - // }, - // }, - // Status: to.Ptr(armcostmanagement.ExecutionStatusCompleted), - // SubmittedBy: to.Ptr("System"), - // SubmittedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T09:03:58.5710244Z"); return t}()), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/forecast_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/forecast_client.go index e6717dd13eee..85738fde8692 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/forecast_client.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/forecast_client.go @@ -44,7 +44,7 @@ func NewForecastClient(credential azcore.TokenCredential, options *arm.ClientOpt // ExternalCloudProviderUsage - Lists the forecast charges for external cloud provider type defined. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - externalCloudProviderType - The external cloud provider type associated with dimension/query operations. This includes // 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. // - externalCloudProviderID - This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for @@ -86,7 +86,7 @@ func (client *ForecastClient) externalCloudProviderUsageCreateRequest(ctx contex if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -95,7 +95,7 @@ func (client *ForecastClient) externalCloudProviderUsageCreateRequest(ctx contex // externalCloudProviderUsageHandleResponse handles the ExternalCloudProviderUsage response. func (client *ForecastClient) externalCloudProviderUsageHandleResponse(resp *http.Response) (ForecastClientExternalCloudProviderUsageResponse, error) { result := ForecastClientExternalCloudProviderUsageResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.QueryResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ForecastResult); err != nil { return ForecastClientExternalCloudProviderUsageResponse{}, err } return result, nil @@ -104,7 +104,7 @@ func (client *ForecastClient) externalCloudProviderUsageHandleResponse(resp *htt // Usage - Lists the forecast charges for scope defined. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - scope - The scope associated with forecast operations. This includes '/subscriptions/{subscriptionId}/' for subscription // scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for // resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and @@ -144,7 +144,7 @@ func (client *ForecastClient) usageCreateRequest(ctx context.Context, scope stri if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -153,7 +153,7 @@ func (client *ForecastClient) usageCreateRequest(ctx context.Context, scope stri // usageHandleResponse handles the Usage response. func (client *ForecastClient) usageHandleResponse(resp *http.Response) (ForecastClientUsageResponse, error) { result := ForecastClientUsageResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.QueryResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ForecastResult); err != nil { return ForecastClientUsageResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/forecast_client_example_test.go b/sdk/resourcemanager/costmanagement/armcostmanagement/forecast_client_example_test.go deleted file mode 100644 index c30521fadedf..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/forecast_client_example_test.go +++ /dev/null @@ -1,918 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcostmanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingAccountForecast.json -func ExampleForecastClient_Usage_billingAccountForecast() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewForecastClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789", armcostmanagement.ForecastDefinition{ - Type: to.Ptr(armcostmanagement.ForecastTypeUsage), - Dataset: &armcostmanagement.ForecastDataset{ - Filter: &armcostmanagement.QueryFilter{ - And: []*armcostmanagement.QueryFilter{ - { - Or: []*armcostmanagement.QueryFilter{ - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceLocation"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("East US"), - to.Ptr("West Europe")}, - }, - }, - { - Tags: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("Environment"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("UAT"), - to.Ptr("Prod")}, - }, - }}, - }, - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceGroup"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("API")}, - }, - }}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - IncludeActualCost: to.Ptr(false), - IncludeFreshPartialCost: to.Ptr(false), - Timeframe: to.Ptr(armcostmanagement.ForecastTimeframeTypeMonthToDate), - }, &armcostmanagement.ForecastClientUsageOptions{Filter: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/providers/Microsoft.CostManagement/query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("UsageDate"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("CostStatus"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(2.10333307059661), - // float64(20180331), - // "Forecast", - // "USD"}, - // []any{ - // float64(218.68795741935486), - // float64(20180331), - // "Forecast", - // "USD"}, - // []any{ - // float64(0.14384913581657052), - // float64(20180401), - // "Forecast", - // "USD"}, - // []any{ - // float64(0.009865586851323632), - // float64(20180429), - // "Forecast", - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingProfileForecast.json -func ExampleForecastClient_Usage_billingProfileForecast() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewForecastClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", armcostmanagement.ForecastDefinition{ - Type: to.Ptr(armcostmanagement.ForecastTypeUsage), - Dataset: &armcostmanagement.ForecastDataset{ - Filter: &armcostmanagement.QueryFilter{ - And: []*armcostmanagement.QueryFilter{ - { - Or: []*armcostmanagement.QueryFilter{ - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceLocation"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("East US"), - to.Ptr("West Europe")}, - }, - }, - { - Tags: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("Environment"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("UAT"), - to.Ptr("Prod")}, - }, - }}, - }, - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceGroup"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("API")}, - }, - }}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - IncludeActualCost: to.Ptr(false), - IncludeFreshPartialCost: to.Ptr(false), - Timeframe: to.Ptr(armcostmanagement.ForecastTimeframeTypeMonthToDate), - }, &armcostmanagement.ForecastClientUsageOptions{Filter: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("UsageDate"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("CostStatus"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(2.10333307059661), - // float64(20180331), - // "Forecast", - // "USD"}, - // []any{ - // float64(218.68795741935486), - // float64(20180331), - // "Forecast", - // "USD"}, - // []any{ - // float64(0.14384913581657052), - // float64(20180401), - // "Forecast", - // "USD"}, - // []any{ - // float64(0.009865586851323632), - // float64(20180429), - // "Forecast", - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/DepartmentForecast.json -func ExampleForecastClient_Usage_departmentForecast() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewForecastClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123", armcostmanagement.ForecastDefinition{ - Type: to.Ptr(armcostmanagement.ForecastTypeUsage), - Dataset: &armcostmanagement.ForecastDataset{ - Filter: &armcostmanagement.QueryFilter{ - And: []*armcostmanagement.QueryFilter{ - { - Or: []*armcostmanagement.QueryFilter{ - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceLocation"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("East US"), - to.Ptr("West Europe")}, - }, - }, - { - Tags: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("Environment"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("UAT"), - to.Ptr("Prod")}, - }, - }}, - }, - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceGroup"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("API")}, - }, - }}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - IncludeActualCost: to.Ptr(false), - IncludeFreshPartialCost: to.Ptr(false), - Timeframe: to.Ptr(armcostmanagement.ForecastTimeframeTypeMonthToDate), - }, &armcostmanagement.ForecastClientUsageOptions{Filter: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123/providers/Microsoft.CostManagement/query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("UsageDate"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("CostStatus"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(2.10333307059661), - // float64(20180331), - // "Forecast", - // "USD"}, - // []any{ - // float64(218.68795741935486), - // float64(20180331), - // "Forecast", - // "USD"}, - // []any{ - // float64(0.14384913581657052), - // float64(20180401), - // "Forecast", - // "USD"}, - // []any{ - // float64(0.009865586851323632), - // float64(20180429), - // "Forecast", - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/EnrollmentAccountForecast.json -func ExampleForecastClient_Usage_enrollmentAccountForecast() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewForecastClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456", armcostmanagement.ForecastDefinition{ - Type: to.Ptr(armcostmanagement.ForecastTypeUsage), - Dataset: &armcostmanagement.ForecastDataset{ - Filter: &armcostmanagement.QueryFilter{ - And: []*armcostmanagement.QueryFilter{ - { - Or: []*armcostmanagement.QueryFilter{ - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceLocation"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("East US"), - to.Ptr("West Europe")}, - }, - }, - { - Tags: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("Environment"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("UAT"), - to.Ptr("Prod")}, - }, - }}, - }, - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceGroup"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("API")}, - }, - }}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - IncludeActualCost: to.Ptr(false), - IncludeFreshPartialCost: to.Ptr(false), - Timeframe: to.Ptr(armcostmanagement.ForecastTimeframeTypeMonthToDate), - }, &armcostmanagement.ForecastClientUsageOptions{Filter: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456/providers/Microsoft.CostManagement/query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("UsageDate"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("CostStatus"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(2.10333307059661), - // float64(20180331), - // "Forecast", - // "USD"}, - // []any{ - // float64(218.68795741935486), - // float64(20180331), - // "Forecast", - // "USD"}, - // []any{ - // float64(0.14384913581657052), - // float64(20180401), - // "Forecast", - // "USD"}, - // []any{ - // float64(0.009865586851323632), - // float64(20180429), - // "Forecast", - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/InvoiceSectionForecast.json -func ExampleForecastClient_Usage_invoiceSectionForecast() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewForecastClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", armcostmanagement.ForecastDefinition{ - Type: to.Ptr(armcostmanagement.ForecastTypeUsage), - Dataset: &armcostmanagement.ForecastDataset{ - Filter: &armcostmanagement.QueryFilter{ - And: []*armcostmanagement.QueryFilter{ - { - Or: []*armcostmanagement.QueryFilter{ - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceLocation"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("East US"), - to.Ptr("West Europe")}, - }, - }, - { - Tags: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("Environment"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("UAT"), - to.Ptr("Prod")}, - }, - }}, - }, - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceGroup"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("API")}, - }, - }}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - IncludeActualCost: to.Ptr(false), - IncludeFreshPartialCost: to.Ptr(false), - Timeframe: to.Ptr(armcostmanagement.ForecastTimeframeTypeMonthToDate), - }, &armcostmanagement.ForecastClientUsageOptions{Filter: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/Microsoft.CostManagement/query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("UsageDate"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("CostStatus"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(2.10333307059661), - // float64(20180331), - // "Forecast", - // "USD"}, - // []any{ - // float64(218.68795741935486), - // float64(20180331), - // "Forecast", - // "USD"}, - // []any{ - // float64(0.14384913581657052), - // float64(20180401), - // "Forecast", - // "USD"}, - // []any{ - // float64(0.009865586851323632), - // float64(20180429), - // "Forecast", - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ResourceGroupForecast.json -func ExampleForecastClient_Usage_resourceGroupForecast() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewForecastClient().Usage(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", armcostmanagement.ForecastDefinition{ - Type: to.Ptr(armcostmanagement.ForecastTypeUsage), - Dataset: &armcostmanagement.ForecastDataset{ - Filter: &armcostmanagement.QueryFilter{ - And: []*armcostmanagement.QueryFilter{ - { - Or: []*armcostmanagement.QueryFilter{ - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceLocation"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("East US"), - to.Ptr("West Europe")}, - }, - }, - { - Tags: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("Environment"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("UAT"), - to.Ptr("Prod")}, - }, - }}, - }, - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceGroup"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("API")}, - }, - }}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - IncludeActualCost: to.Ptr(false), - IncludeFreshPartialCost: to.Ptr(false), - Timeframe: to.Ptr(armcostmanagement.ForecastTimeframeTypeMonthToDate), - }, &armcostmanagement.ForecastClientUsageOptions{Filter: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("55312978-ba1b-415c-9304-cfd9c43c0481"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer/providers/Microsoft.CostManagement/query/00000000-0000-0000-0000-000000000000"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("UsageDate"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("CostStatus"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(2.10333307059661), - // float64(20180331), - // "Forecast", - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/SubscriptionForecast.json -func ExampleForecastClient_Usage_subscriptionForecast() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewForecastClient().Usage(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", armcostmanagement.ForecastDefinition{ - Type: to.Ptr(armcostmanagement.ForecastTypeUsage), - Dataset: &armcostmanagement.ForecastDataset{ - Filter: &armcostmanagement.QueryFilter{ - And: []*armcostmanagement.QueryFilter{ - { - Or: []*armcostmanagement.QueryFilter{ - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceLocation"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("East US"), - to.Ptr("West Europe")}, - }, - }, - { - Tags: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("Environment"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("UAT"), - to.Ptr("Prod")}, - }, - }}, - }, - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceGroup"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("API")}, - }, - }}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - IncludeActualCost: to.Ptr(false), - IncludeFreshPartialCost: to.Ptr(false), - Timeframe: to.Ptr(armcostmanagement.ForecastTimeframeTypeMonthToDate), - }, &armcostmanagement.ForecastClientUsageOptions{Filter: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("55312978-ba1b-415c-9304-cfd9c43c0481"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/query/00000000-0000-0000-0000-000000000000"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("UsageDate"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("CostStatus"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(2.10333307059661), - // float64(20180331), - // "Forecast", - // "USD"}, - // []any{ - // float64(218.68795741935486), - // float64(20180331), - // "Forecast", - // "USD"}, - // []any{ - // float64(0.14384913581657052), - // float64(20180401), - // "Forecast", - // "USD"}, - // []any{ - // float64(0.009865586851323632), - // float64(20180429), - // "Forecast", - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalBillingAccountForecast.json -func ExampleForecastClient_ExternalCloudProviderUsage_externalBillingAccountForecast() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewForecastClient().ExternalCloudProviderUsage(ctx, armcostmanagement.ExternalCloudProviderTypeExternalBillingAccounts, "100", armcostmanagement.ForecastDefinition{ - Type: to.Ptr(armcostmanagement.ForecastTypeUsage), - Dataset: &armcostmanagement.ForecastDataset{ - Filter: &armcostmanagement.QueryFilter{ - And: []*armcostmanagement.QueryFilter{ - { - Or: []*armcostmanagement.QueryFilter{ - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceLocation"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("East US"), - to.Ptr("West Europe")}, - }, - }, - { - Tags: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("Environment"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("UAT"), - to.Ptr("Prod")}, - }, - }}, - }, - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceGroup"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("API")}, - }, - }}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - Timeframe: to.Ptr(armcostmanagement.ForecastTimeframeTypeMonthToDate), - }, &armcostmanagement.ForecastClientExternalCloudProviderUsageOptions{Filter: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("6dc7b06a-d90a-4df5-b655-ce6cf1c0814d"), - // Type: to.Ptr("Microsoft.CostManagement/query"), - // ID: to.Ptr("providers/Microsoft.CostManagement/externalBillingAccounts/100/query/6dc7b06a-d90a-4df5-b655-ce6cf1c0814d"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("CostStatus"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(0), - // "Forecast", - // "USD"}, - // []any{ - // float64(30.2572751438), - // "Forecast", - // "USD"}, - // []any{ - // float64(0.07675760200000002), - // "Forecast", - // "USD"}, - // []any{ - // float64(50.43096419040001), - // "Forecast", - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalSubscriptionForecast.json -func ExampleForecastClient_ExternalCloudProviderUsage_externalSubscriptionForecast() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewForecastClient().ExternalCloudProviderUsage(ctx, armcostmanagement.ExternalCloudProviderTypeExternalSubscriptions, "100", armcostmanagement.ForecastDefinition{ - Type: to.Ptr(armcostmanagement.ForecastTypeUsage), - Dataset: &armcostmanagement.ForecastDataset{ - Filter: &armcostmanagement.QueryFilter{ - And: []*armcostmanagement.QueryFilter{ - { - Or: []*armcostmanagement.QueryFilter{ - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceLocation"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("East US"), - to.Ptr("West Europe")}, - }, - }, - { - Tags: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("Environment"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("UAT"), - to.Ptr("Prod")}, - }, - }}, - }, - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceGroup"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("API")}, - }, - }}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - Timeframe: to.Ptr(armcostmanagement.ForecastTimeframeTypeMonthToDate), - }, &armcostmanagement.ForecastClientExternalCloudProviderUsageOptions{Filter: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("d99477af-7510-40ee-aca2-e59bdca0d10d"), - // Type: to.Ptr("Microsoft.CostManagement/query"), - // ID: to.Ptr("providers/Microsoft.CostManagement/externalSubscriptions/100/query/d99477af-7510-40ee-aca2-e59bdca0d10d"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("UsageDate"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("CostStatus"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/generatecostdetailsreport_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/generatecostdetailsreport_client.go new file mode 100644 index 000000000000..08a3a58618fc --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/generatecostdetailsreport_client.go @@ -0,0 +1,182 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcostmanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// GenerateCostDetailsReportClient contains the methods for the GenerateCostDetailsReport group. +// Don't use this type directly, use NewGenerateCostDetailsReportClient() instead. +type GenerateCostDetailsReportClient struct { + internal *arm.Client +} + +// NewGenerateCostDetailsReportClient creates a new instance of GenerateCostDetailsReportClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewGenerateCostDetailsReportClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GenerateCostDetailsReportClient, error) { + cl, err := arm.NewClient(moduleName+".GenerateCostDetailsReportClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &GenerateCostDetailsReportClient{ + internal: cl, + } + return client, nil +} + +// BeginCreateOperation - This API is the replacement for all previously release Usage Details APIs. Request to generate a +// cost details report for the provided date range, billing period (Only enterprise customers) or Invoice +// Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' +// header. The 'Location' header will provide the endpoint to poll to get +// the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. +// A call to poll the report operation will provide a 202 response with a +// 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint +// will provide a 200 response along with details on the report blob(s) that +// are available for download. The details on the file(s) available for download will be available in the polling response +// body. To Understand cost details (formerly known as usage details) fields found +// in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - scope - The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see +// https://aka.ms/costmgmt/scopes. +// - parameters - Parameters supplied to the Create cost details operation. +// - options - GenerateCostDetailsReportClientBeginCreateOperationOptions contains the optional parameters for the GenerateCostDetailsReportClient.BeginCreateOperation +// method. +func (client *GenerateCostDetailsReportClient) BeginCreateOperation(ctx context.Context, scope string, parameters GenerateCostDetailsReportRequestDefinition, options *GenerateCostDetailsReportClientBeginCreateOperationOptions) (*runtime.Poller[GenerateCostDetailsReportClientCreateOperationResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOperation(ctx, scope, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GenerateCostDetailsReportClientCreateOperationResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[GenerateCostDetailsReportClientCreateOperationResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOperation - This API is the replacement for all previously release Usage Details APIs. Request to generate a cost +// details report for the provided date range, billing period (Only enterprise customers) or Invoice +// Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' +// header. The 'Location' header will provide the endpoint to poll to get +// the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. +// A call to poll the report operation will provide a 202 response with a +// 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint +// will provide a 200 response along with details on the report blob(s) that +// are available for download. The details on the file(s) available for download will be available in the polling response +// body. To Understand cost details (formerly known as usage details) fields found +// in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +func (client *GenerateCostDetailsReportClient) createOperation(ctx context.Context, scope string, parameters GenerateCostDetailsReportRequestDefinition, options *GenerateCostDetailsReportClientBeginCreateOperationOptions) (*http.Response, error) { + req, err := client.createOperationCreateRequest(ctx, scope, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOperationCreateRequest creates the CreateOperation request. +func (client *GenerateCostDetailsReportClient) createOperationCreateRequest(ctx context.Context, scope string, parameters GenerateCostDetailsReportRequestDefinition, options *GenerateCostDetailsReportClientBeginCreateOperationOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.CostManagement/generateCostDetailsReport" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginGetOperationResults - Get the result of the specified operation. This link is provided in the CostDetails creation +// request response Location header. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - scope - The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see +// https://aka.ms/costmgmt/scopes. +// - operationID - The target operation Id. +// - options - GenerateCostDetailsReportClientBeginGetOperationResultsOptions contains the optional parameters for the GenerateCostDetailsReportClient.BeginGetOperationResults +// method. +func (client *GenerateCostDetailsReportClient) BeginGetOperationResults(ctx context.Context, scope string, operationID string, options *GenerateCostDetailsReportClientBeginGetOperationResultsOptions) (*runtime.Poller[GenerateCostDetailsReportClientGetOperationResultsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.getOperationResults(ctx, scope, operationID, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GenerateCostDetailsReportClientGetOperationResultsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[GenerateCostDetailsReportClientGetOperationResultsResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// GetOperationResults - Get the result of the specified operation. This link is provided in the CostDetails creation request +// response Location header. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +func (client *GenerateCostDetailsReportClient) getOperationResults(ctx context.Context, scope string, operationID string, options *GenerateCostDetailsReportClientBeginGetOperationResultsOptions) (*http.Response, error) { + req, err := client.getOperationResultsCreateRequest(ctx, scope, operationID, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getOperationResultsCreateRequest creates the GetOperationResults request. +func (client *GenerateCostDetailsReportClient) getOperationResultsCreateRequest(ctx context.Context, scope string, operationID string, options *GenerateCostDetailsReportClientBeginGetOperationResultsOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.CostManagement/costDetailsOperationResults/{operationId}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreport_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreport_client.go index 416e4614d49f..5e2d1c06d970 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreport_client.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreport_client.go @@ -39,25 +39,16 @@ func NewGenerateDetailedCostReportClient(credential azcore.TokenCredential, opti return client, nil } -// BeginCreateOperation - Generates the detailed cost report for provided date range, billing period(Only enterprise customers) -// or Invoice Id asynchronously at a certain scope. Call returns a 202 with header +// BeginCreateOperation - Generates the detailed cost report for provided date range, billing period(only enterprise customers) +// or Invoice ID asynchronously at a certain scope. Call returns a 202 with header // Azure-Consumption-AsyncOperation providing a link to the operation created. A call on the operation will provide the status // and if the operation is completed the blob file where generated detailed // cost report is being stored. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 -// - scope - The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for -// Billing Account scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount -// scope. Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for billingAccount -// scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile -// scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. +// Generated from API version 2023-03-01 +// - scope - The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see +// https://aka.ms/costmgmt/scopes. // - parameters - Parameters supplied to the Create detailed cost report operation. // - options - GenerateDetailedCostReportClientBeginCreateOperationOptions contains the optional parameters for the GenerateDetailedCostReportClient.BeginCreateOperation // method. @@ -75,14 +66,14 @@ func (client *GenerateDetailedCostReportClient) BeginCreateOperation(ctx context } } -// CreateOperation - Generates the detailed cost report for provided date range, billing period(Only enterprise customers) -// or Invoice Id asynchronously at a certain scope. Call returns a 202 with header +// CreateOperation - Generates the detailed cost report for provided date range, billing period(only enterprise customers) +// or Invoice ID asynchronously at a certain scope. Call returns a 202 with header // Azure-Consumption-AsyncOperation providing a link to the operation created. A call on the operation will provide the status // and if the operation is completed the blob file where generated detailed // cost report is being stored. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 func (client *GenerateDetailedCostReportClient) createOperation(ctx context.Context, scope string, parameters GenerateDetailedCostReportDefinition, options *GenerateDetailedCostReportClientBeginCreateOperationOptions) (*http.Response, error) { req, err := client.createOperationCreateRequest(ctx, scope, parameters, options) if err != nil { @@ -107,7 +98,7 @@ func (client *GenerateDetailedCostReportClient) createOperationCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreport_client_example_test.go b/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreport_client_example_test.go deleted file mode 100644 index 0c1449b31b90..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreport_client_example_test.go +++ /dev/null @@ -1,206 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcostmanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/GenerateDetailedCostReportByBillingAccountLegacyAndBillingPeriod.json -func ExampleGenerateDetailedCostReportClient_BeginCreateOperation_generateDetailedCostReportByBillingAccountLegacyAndBillingPeriod() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGenerateDetailedCostReportClient().BeginCreateOperation(ctx, "providers/Microsoft.Billing/billingAccounts/12345", armcostmanagement.GenerateDetailedCostReportDefinition{ - BillingPeriod: to.Ptr("202008"), - Metric: to.Ptr(armcostmanagement.GenerateDetailedCostReportMetricTypeActualCost), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GenerateDetailedCostReportOperationResult = armcostmanagement.GenerateDetailedCostReportOperationResult{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Consumption/operationResult"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/operationResults/00000000-0000-0000-0000-000000000000"), - // Properties: &armcostmanagement.DownloadURL{ - // DownloadURL: to.Ptr("https://ccmreportstorageeastus.blob.core.windows.net/armreports/20201207/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd"), - // ValidTill: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-08T05:55:59.4394737Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/GenerateDetailedCostReportByBillingProfileAndInvoiceId.json -func ExampleGenerateDetailedCostReportClient_BeginCreateOperation_generateDetailedCostReportByBillingProfileAndInvoiceId() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGenerateDetailedCostReportClient().BeginCreateOperation(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", armcostmanagement.GenerateDetailedCostReportDefinition{ - InvoiceID: to.Ptr("M1234567"), - Metric: to.Ptr(armcostmanagement.GenerateDetailedCostReportMetricTypeActualCost), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GenerateDetailedCostReportOperationResult = armcostmanagement.GenerateDetailedCostReportOperationResult{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Consumption/operationResult"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/operationResults/00000000-0000-0000-0000-000000000000"), - // Properties: &armcostmanagement.DownloadURL{ - // DownloadURL: to.Ptr("https://ccmreportstorageeastus.blob.core.windows.net/armreports/20201207/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd"), - // ValidTill: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-08T05:55:59.4394737Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/GenerateDetailedCostReportByBillingProfileAndInvoiceIdAndCustomerId.json -func ExampleGenerateDetailedCostReportClient_BeginCreateOperation_generateDetailedCostReportByBillingProfileAndInvoiceIdAndCustomerId() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGenerateDetailedCostReportClient().BeginCreateOperation(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", armcostmanagement.GenerateDetailedCostReportDefinition{ - CustomerID: to.Ptr("456789"), - InvoiceID: to.Ptr("M1234567"), - Metric: to.Ptr(armcostmanagement.GenerateDetailedCostReportMetricTypeActualCost), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GenerateDetailedCostReportOperationResult = armcostmanagement.GenerateDetailedCostReportOperationResult{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Consumption/operationResult"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/operationResults/00000000-0000-0000-0000-000000000000"), - // Properties: &armcostmanagement.DownloadURL{ - // DownloadURL: to.Ptr("https://ccmreportstorageeastus.blob.core.windows.net/armreports/20201207/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd"), - // ValidTill: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-08T05:55:59.4394737Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/GenerateDetailedCostReportByCustomerAndTimePeriod.json -func ExampleGenerateDetailedCostReportClient_BeginCreateOperation_generateDetailedCostReportByCustomerAndTimePeriod() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGenerateDetailedCostReportClient().BeginCreateOperation(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579", armcostmanagement.GenerateDetailedCostReportDefinition{ - Metric: to.Ptr(armcostmanagement.GenerateDetailedCostReportMetricTypeActualCost), - TimePeriod: &armcostmanagement.GenerateDetailedCostReportTimePeriod{ - End: to.Ptr("2020-03-15"), - Start: to.Ptr("2020-03-01"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GenerateDetailedCostReportOperationResult = armcostmanagement.GenerateDetailedCostReportOperationResult{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Consumption/operationResult"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/operationResults/00000000-0000-0000-0000-000000000000"), - // Properties: &armcostmanagement.DownloadURL{ - // DownloadURL: to.Ptr("https://ccmreportstorageeastus.blob.core.windows.net/armreports/20201207/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd"), - // ValidTill: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-08T05:55:59.4394737Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/GenerateDetailedCostReportBySubscriptionAndTimePeriod.json -func ExampleGenerateDetailedCostReportClient_BeginCreateOperation_generateDetailedCostReportBySubscriptionAndTimePeriod() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGenerateDetailedCostReportClient().BeginCreateOperation(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", armcostmanagement.GenerateDetailedCostReportDefinition{ - Metric: to.Ptr(armcostmanagement.GenerateDetailedCostReportMetricTypeActualCost), - TimePeriod: &armcostmanagement.GenerateDetailedCostReportTimePeriod{ - End: to.Ptr("2020-03-15"), - Start: to.Ptr("2020-03-01"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GenerateDetailedCostReportOperationResult = armcostmanagement.GenerateDetailedCostReportOperationResult{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Consumption/operationResult"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/operationResults/00000000-0000-0000-0000-000000000000"), - // Properties: &armcostmanagement.DownloadURL{ - // DownloadURL: to.Ptr("https://ccmreportstorageeastus.blob.core.windows.net/armreports/20201207/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd"), - // ValidTill: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-08T05:55:59.4394737Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreportoperationresults_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreportoperationresults_client.go index 6aa48fa3f52e..dc17049885e1 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreportoperationresults_client.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreportoperationresults_client.go @@ -41,42 +41,50 @@ func NewGenerateDetailedCostReportOperationResultsClient(credential azcore.Token return client, nil } -// Get - Get the result of the specified operation. This link is provided in the GenerateDetailedCostReport creation request -// response header. +// BeginGet - Gets the result of the specified operation. The link with this operationId is provided as a response header +// of the initial request. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - operationID - The target operation Id. -// - scope - The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for -// Billing Account scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount -// scope. Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for billingAccount -// scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile -// scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// - options - GenerateDetailedCostReportOperationResultsClientGetOptions contains the optional parameters for the GenerateDetailedCostReportOperationResultsClient.Get +// - scope - The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see +// https://aka.ms/costmgmt/scopes. +// - options - GenerateDetailedCostReportOperationResultsClientBeginGetOptions contains the optional parameters for the GenerateDetailedCostReportOperationResultsClient.BeginGet // method. -func (client *GenerateDetailedCostReportOperationResultsClient) Get(ctx context.Context, operationID string, scope string, options *GenerateDetailedCostReportOperationResultsClientGetOptions) (GenerateDetailedCostReportOperationResultsClientGetResponse, error) { +func (client *GenerateDetailedCostReportOperationResultsClient) BeginGet(ctx context.Context, operationID string, scope string, options *GenerateDetailedCostReportOperationResultsClientBeginGetOptions) (*runtime.Poller[GenerateDetailedCostReportOperationResultsClientGetResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.get(ctx, operationID, scope, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[GenerateDetailedCostReportOperationResultsClientGetResponse](resp, client.internal.Pipeline(), nil) + } else { + return runtime.NewPollerFromResumeToken[GenerateDetailedCostReportOperationResultsClientGetResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Get - Gets the result of the specified operation. The link with this operationId is provided as a response header of the +// initial request. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +func (client *GenerateDetailedCostReportOperationResultsClient) get(ctx context.Context, operationID string, scope string, options *GenerateDetailedCostReportOperationResultsClientBeginGetOptions) (*http.Response, error) { req, err := client.getCreateRequest(ctx, operationID, scope, options) if err != nil { - return GenerateDetailedCostReportOperationResultsClientGetResponse{}, err + return nil, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { - return GenerateDetailedCostReportOperationResultsClientGetResponse{}, err + return nil, err } if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return GenerateDetailedCostReportOperationResultsClientGetResponse{}, runtime.NewResponseError(resp) + return nil, runtime.NewResponseError(resp) } - return client.getHandleResponse(resp) + return resp, nil } // getCreateRequest creates the Get request. -func (client *GenerateDetailedCostReportOperationResultsClient) getCreateRequest(ctx context.Context, operationID string, scope string, options *GenerateDetailedCostReportOperationResultsClientGetOptions) (*policy.Request, error) { +func (client *GenerateDetailedCostReportOperationResultsClient) getCreateRequest(ctx context.Context, operationID string, scope string, options *GenerateDetailedCostReportOperationResultsClientBeginGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.CostManagement/operationResults/{operationId}" if operationID == "" { return nil, errors.New("parameter operationID cannot be empty") @@ -88,17 +96,8 @@ func (client *GenerateDetailedCostReportOperationResultsClient) getCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } - -// getHandleResponse handles the Get response. -func (client *GenerateDetailedCostReportOperationResultsClient) getHandleResponse(resp *http.Response) (GenerateDetailedCostReportOperationResultsClientGetResponse, error) { - result := GenerateDetailedCostReportOperationResultsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GenerateDetailedCostReportOperationResult); err != nil { - return GenerateDetailedCostReportOperationResultsClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreportoperationresults_client_example_test.go b/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreportoperationresults_client_example_test.go deleted file mode 100644 index ab7d576db244..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreportoperationresults_client_example_test.go +++ /dev/null @@ -1,47 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcostmanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/GenerateDetailedCostReportOperationResultsBySubscriptionScope.json -func ExampleGenerateDetailedCostReportOperationResultsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGenerateDetailedCostReportOperationResultsClient().Get(ctx, "00000000-0000-0000-0000-000000000000", "subscriptions/00000000-0000-0000-0000-000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GenerateDetailedCostReportOperationResult = armcostmanagement.GenerateDetailedCostReportOperationResult{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Consumption/operationResult"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/operationResults/00000000-0000-0000-0000-000000000000"), - // Properties: &armcostmanagement.DownloadURL{ - // DownloadURL: to.Ptr("https://ccmreportstorageeastus.blob.core.windows.net/armreports/20201207/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd"), - // ValidTill: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-08T05:55:59.4394737Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreportoperationstatus_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreportoperationstatus_client.go index 3c3fdec4d45c..9a66e35ff762 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreportoperationstatus_client.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreportoperationstatus_client.go @@ -45,19 +45,10 @@ func NewGenerateDetailedCostReportOperationStatusClient(credential azcore.TokenC // response header. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - operationID - The target operation Id. -// - scope - The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for -// Billing Account scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount -// scope. Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for billingAccount -// scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile -// scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. +// - scope - The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see +// https://aka.ms/costmgmt/scopes. // - options - GenerateDetailedCostReportOperationStatusClientGetOptions contains the optional parameters for the GenerateDetailedCostReportOperationStatusClient.Get // method. func (client *GenerateDetailedCostReportOperationStatusClient) Get(ctx context.Context, operationID string, scope string, options *GenerateDetailedCostReportOperationStatusClientGetOptions) (GenerateDetailedCostReportOperationStatusClientGetResponse, error) { @@ -88,7 +79,7 @@ func (client *GenerateDetailedCostReportOperationStatusClient) getCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreportoperationstatus_client_example_test.go b/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreportoperationstatus_client_example_test.go deleted file mode 100644 index da37a37be5aa..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreportoperationstatus_client_example_test.go +++ /dev/null @@ -1,52 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcostmanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/GenerateDetailedCostReportOperationStatusBySubscriptionScope.json -func ExampleGenerateDetailedCostReportOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGenerateDetailedCostReportOperationStatusClient().Get(ctx, "00000000-0000-0000-0000-000000000000", "subscriptions/00000000-0000-0000-0000-000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GenerateDetailedCostReportOperationStatuses = armcostmanagement.GenerateDetailedCostReportOperationStatuses{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Consumption/operationStatus"), - // Error: &armcostmanagement.ErrorDetails{ - // Code: to.Ptr("0"), - // }, - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/operationStatus/00000000-0000-0000-0000-000000000000"), - // Properties: &armcostmanagement.DownloadURL{ - // DownloadURL: to.Ptr("https://ccmreportstorageeastus.blob.core.windows.net/armreports/20201207/00000000-0000-0000-0000-000000000000?sv=2020-05-31&sr=b&sig=abcd"), - // ValidTill: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-08T05:55:59.4394737Z"); return t}()), - // }, - // Status: &armcostmanagement.Status{ - // }, - // } -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/generatereservationdetailsreport_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/generatereservationdetailsreport_client.go index 89723561bafd..7d76525b9e50 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/generatereservationdetailsreport_client.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/generatereservationdetailsreport_client.go @@ -46,7 +46,7 @@ func NewGenerateReservationDetailsReportClient(credential azcore.TokenCredential // on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - billingAccountID - Enrollment ID (Legacy BillingAccount ID) // - startDate - Start Date // - endDate - End Date @@ -71,7 +71,7 @@ func (client *GenerateReservationDetailsReportClient) BeginByBillingAccountID(ct // on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 func (client *GenerateReservationDetailsReportClient) byBillingAccountID(ctx context.Context, billingAccountID string, startDate string, endDate string, options *GenerateReservationDetailsReportClientBeginByBillingAccountIDOptions) (*http.Response, error) { req, err := client.byBillingAccountIDCreateRequest(ctx, billingAccountID, startDate, endDate, options) if err != nil { @@ -101,7 +101,7 @@ func (client *GenerateReservationDetailsReportClient) byBillingAccountIDCreateRe reqQP := req.Raw().URL.Query() reqQP.Set("startDate", startDate) reqQP.Set("endDate", endDate) - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -112,9 +112,9 @@ func (client *GenerateReservationDetailsReportClient) byBillingAccountIDCreateRe // details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 -// - billingAccountID - BillingAccount ID -// - billingProfileID - BillingProfile ID +// Generated from API version 2023-03-01 +// - billingAccountID - Billing account ID +// - billingProfileID - Billing profile ID. // - startDate - Start Date // - endDate - End Date // - options - GenerateReservationDetailsReportClientBeginByBillingProfileIDOptions contains the optional parameters for the @@ -138,7 +138,7 @@ func (client *GenerateReservationDetailsReportClient) BeginByBillingProfileID(ct // details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 func (client *GenerateReservationDetailsReportClient) byBillingProfileID(ctx context.Context, billingAccountID string, billingProfileID string, startDate string, endDate string, options *GenerateReservationDetailsReportClientBeginByBillingProfileIDOptions) (*http.Response, error) { req, err := client.byBillingProfileIDCreateRequest(ctx, billingAccountID, billingProfileID, startDate, endDate, options) if err != nil { @@ -172,7 +172,7 @@ func (client *GenerateReservationDetailsReportClient) byBillingProfileIDCreateRe reqQP := req.Raw().URL.Query() reqQP.Set("startDate", startDate) reqQP.Set("endDate", endDate) - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/generatereservationdetailsreport_client_example_test.go b/sdk/resourcemanager/costmanagement/armcostmanagement/generatereservationdetailsreport_client_example_test.go deleted file mode 100644 index e8a916879e18..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/generatereservationdetailsreport_client_example_test.go +++ /dev/null @@ -1,80 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcostmanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/GenerateReservationDetailsReportByBillingAccount.json -func ExampleGenerateReservationDetailsReportClient_BeginByBillingAccountID() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGenerateReservationDetailsReportClient().BeginByBillingAccountID(ctx, "9845612", "2020-01-01", "2020-01-30", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationStatus = armcostmanagement.OperationStatus{ - // Properties: &armcostmanagement.ReportURL{ - // ReportURL: to.Ptr(armcostmanagement.ReservationReportSchema("https://storage.blob.core.windows.net/details/20200911/00000000-0000-0000-0000-000000000000?sv=2016-05-31&sr=b&sig=jep8HT2aphfUkyERRZa5LRfd9RPzjXbzB%2F9TNiQ")), - // ValidUntil: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-12T02:56:55.5021869Z"); return t}()), - // }, - // Status: to.Ptr(armcostmanagement.OperationStatusTypeCompleted), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/GenerateReservationDetailsReportByBillingProfile.json -func ExampleGenerateReservationDetailsReportClient_BeginByBillingProfileID() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGenerateReservationDetailsReportClient().BeginByBillingProfileID(ctx, "00000000-0000-0000-0000-000000000000", "CZSFR-SDFXC-DSDF", "2020-01-01", "2020-01-30", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationStatus = armcostmanagement.OperationStatus{ - // Properties: &armcostmanagement.ReportURL{ - // ReportURL: to.Ptr(armcostmanagement.ReservationReportSchema("https://storage.blob.core.windows.net/details/20200911/00000000-0000-0000-0000-000000000000?sv=2016-05-31&sr=b&sig=jep8HT2aphfUkyERRZa5LRfd9RPzjXbzB%2F9TNiQ")), - // ValidUntil: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-12T02:56:55.5021869Z"); return t}()), - // }, - // Status: to.Ptr(armcostmanagement.OperationStatusTypeCompleted), - // } -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/go.mod b/sdk/resourcemanager/costmanagement/armcostmanagement/go.mod index b01a1d34471e..a17abfdd557c 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/go.mod +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/go.mod @@ -1,21 +1,13 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement/v2 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.6.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect golang.org/x/text v0.7.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/go.sum b/sdk/resourcemanager/costmanagement/armcostmanagement/go.sum index 8ba445a8c4da..b6bd7eaad1ba 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/go.sum +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/go.sum @@ -1,31 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/models.go b/sdk/resourcemanager/costmanagement/armcostmanagement/models.go index 6572d0c3064b..7baa8b2eb740 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/models.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/models.go @@ -176,6 +176,393 @@ type AlertsResult struct { Value []*Alert } +// AllSavingsBenefitDetails - Benefit recommendation details. +type AllSavingsBenefitDetails struct { + // READ-ONLY; Estimated average utilization percentage for the 'totalHours' in the look-back period, with this commitment. + AverageUtilizationPercentage *float64 + + // READ-ONLY; The estimated cost with benefit for the 'totalHours' in the look-back period. It's equal to (commitmentAmount + // * totalHours) + BenefitCost *float64 + + // READ-ONLY; The commitment amount at the commitmentGranularity. + CommitmentAmount *float64 + + // READ-ONLY; Estimated benefit coverage percentage for the 'totalHours' in the look-back period, with this commitment. + CoveragePercentage *float64 + + // READ-ONLY; The difference between total cost and benefit cost for the 'totalHours' in the look-back period. + OverageCost *float64 + + // READ-ONLY; The amount saved for the 'totalHours' in the look-back period, by purchasing the recommended quantity of the + // benefit. + SavingsAmount *float64 + + // READ-ONLY; The savings in percentage for the 'totalHours' in the look-back period, by purchasing the recommended quantity + // of benefit. + SavingsPercentage *float64 + + // READ-ONLY; Total cost, which is sum of benefit cost and overage cost. + TotalCost *float64 + + // READ-ONLY; Estimated unused portion of the 'benefitCost'. + WastageCost *float64 +} + +// AllSavingsList - The list of all benefit recommendations with the recommendation details. +type AllSavingsList struct { + // READ-ONLY; The link (URL) to the next page of results. + NextLink *string + + // READ-ONLY; The list of benefit recommendations with the recommendation details.. + Value []*AllSavingsBenefitDetails +} + +// AsyncOperationStatusProperties - Object representing the report url and valid until date of the async report generated. +type AsyncOperationStatusProperties struct { + // Sas url to the async benefit utilization summaries report. Will be empty if the report is in Running or Failed state. + ReportURL *BenefitUtilizationSummaryReportSchema + + // Sas url to async benefit utilization summaries report in secondary storage in case of primary outage. Will be empty if + // the report is in Running or Failed state. + SecondaryReportURL *BenefitUtilizationSummaryReportSchema + + // The date that the sas url provided in reportUrl expires. + ValidUntil *time.Time +} + +// BenefitRecommendationModel - benefit plan recommendation details. +type BenefitRecommendationModel struct { + // Reservation or SavingsPlan. + Kind *BenefitKind + + // The properties of the benefit recommendations. + Properties BenefitRecommendationPropertiesClassification + + // 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; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// BenefitRecommendationPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetBenefitRecommendationProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *BenefitRecommendationProperties, *SharedScopeBenefitRecommendationProperties, *SingleScopeBenefitRecommendationProperties +type BenefitRecommendationPropertiesClassification interface { + // GetBenefitRecommendationProperties returns the BenefitRecommendationProperties content of the underlying type. + GetBenefitRecommendationProperties() *BenefitRecommendationProperties +} + +// BenefitRecommendationProperties - The properties of the benefit recommendations. +type BenefitRecommendationProperties struct { + // REQUIRED; Benefit scope. For example, Single or Shared. + Scope *Scope + + // Grain of the proposed commitment amount. Supported values: 'Hourly' + CommitmentGranularity *Grain + + // The number of days of usage evaluated for computing the recommendations. + LookBackPeriod *LookBackPeriod + + // The details of the proposed recommendation. + RecommendationDetails *AllSavingsBenefitDetails + + // Term period of the benefit. For example, P1Y or P3Y. + Term *Term + + // On-demand charges between firstConsumptionDate and lastConsumptionDate that were used for computing benefit recommendations. + Usage *RecommendationUsageDetails + + // READ-ONLY; The list of all benefit recommendations with the recommendation details. + AllRecommendationDetails *AllSavingsList + + // READ-ONLY; ARM SKU name. 'ComputeSavingsPlan' for SavingsPlan. + ArmSKUName *string + + // READ-ONLY; The current cost without benefit, corresponds to 'totalHours' in the look-back period. + CostWithoutBenefit *float64 + + // READ-ONLY; An ISO 4217 currency code identifier for the costs and savings amounts. + CurrencyCode *string + + // READ-ONLY; The first usage date used for looking back for computing the recommendations. + FirstConsumptionDate *time.Time + + // READ-ONLY; The last usage date used for looking back for computing the recommendations. + LastConsumptionDate *time.Time + + // READ-ONLY; The total hours for which the cost is covered. Its equal to number of records in a property 'properties/usage/charges'. + TotalHours *int32 +} + +// GetBenefitRecommendationProperties implements the BenefitRecommendationPropertiesClassification interface for type BenefitRecommendationProperties. +func (b *BenefitRecommendationProperties) GetBenefitRecommendationProperties() *BenefitRecommendationProperties { + return b +} + +// BenefitRecommendationsClientListOptions contains the optional parameters for the BenefitRecommendationsClient.NewListPager +// method. +type BenefitRecommendationsClientListOptions struct { + // May be used to expand the properties by: properties/usage, properties/allRecommendationDetails + Expand *string + // Can be used to filter benefitRecommendations by: properties/scope with allowed values ['Single', 'Shared'] and default + // value 'Shared'; and properties/lookBackPeriod with allowed values ['Last7Days', + // 'Last30Days', 'Last60Days'] and default value 'Last60Days'; properties/term with allowed values ['P1Y', 'P3Y'] and default + // value 'P3Y'; properties/subscriptionId; properties/resourceGroup + Filter *string + // May be used to order the recommendations by: properties/armSkuName. For the savings plan, the results are in order by default. + // There is no need to use this clause. + Orderby *string +} + +// BenefitRecommendationsListResult - Result of listing benefit recommendations. +type BenefitRecommendationsListResult struct { + // READ-ONLY; The link (URL) to the next page of results. + NextLink *string + + // READ-ONLY; The list of benefit recommendations. + Value []*BenefitRecommendationModel +} + +// BenefitResource - The benefit resource model definition. +type BenefitResource struct { + // Reservation or SavingsPlan. + Kind *BenefitKind + + // 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; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingAccountScopeOptions contains the optional parameters for +// the BenefitUtilizationSummariesAsyncClient.GetOperationStatusBillingAccountScope method. +type BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingAccountScopeOptions struct { + // placeholder for future optional parameters +} + +// BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingProfileScopeOptions contains the optional parameters for +// the BenefitUtilizationSummariesAsyncClient.GetOperationStatusBillingProfileScope method. +type BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingProfileScopeOptions struct { + // placeholder for future optional parameters +} + +// BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationOrderScopeOptions contains the optional parameters for +// the BenefitUtilizationSummariesAsyncClient.GetOperationStatusReservationOrderScope method. +type BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationOrderScopeOptions struct { + // placeholder for future optional parameters +} + +// BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationScopeOptions contains the optional parameters for the +// BenefitUtilizationSummariesAsyncClient.GetOperationStatusReservationScope method. +type BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationScopeOptions struct { + // placeholder for future optional parameters +} + +// BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanOrderScopeOptions contains the optional parameters for +// the BenefitUtilizationSummariesAsyncClient.GetOperationStatusSavingsPlanOrderScope method. +type BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanOrderScopeOptions struct { + // placeholder for future optional parameters +} + +// BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanScopeOptions contains the optional parameters for the +// BenefitUtilizationSummariesAsyncClient.GetOperationStatusSavingsPlanScope method. +type BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanScopeOptions struct { + // placeholder for future optional parameters +} + +// BenefitUtilizationSummariesClientListByBillingAccountIDOptions contains the optional parameters for the BenefitUtilizationSummariesClient.NewListByBillingAccountIDPager +// method. +type BenefitUtilizationSummariesClientListByBillingAccountIDOptions struct { + // Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. + Filter *string + // Grain. + GrainParameter *GrainParameter +} + +// BenefitUtilizationSummariesClientListByBillingProfileIDOptions contains the optional parameters for the BenefitUtilizationSummariesClient.NewListByBillingProfileIDPager +// method. +type BenefitUtilizationSummariesClientListByBillingProfileIDOptions struct { + // Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. + Filter *string + // Grain. + GrainParameter *GrainParameter +} + +// BenefitUtilizationSummariesClientListBySavingsPlanIDOptions contains the optional parameters for the BenefitUtilizationSummariesClient.NewListBySavingsPlanIDPager +// method. +type BenefitUtilizationSummariesClientListBySavingsPlanIDOptions struct { + // Supports filtering by properties/usageDate. + Filter *string + // Grain. + GrainParameter *GrainParameter +} + +// BenefitUtilizationSummariesClientListBySavingsPlanOrderOptions contains the optional parameters for the BenefitUtilizationSummariesClient.NewListBySavingsPlanOrderPager +// method. +type BenefitUtilizationSummariesClientListBySavingsPlanOrderOptions struct { + // Supports filtering by properties/usageDate. + Filter *string + // Grain. + GrainParameter *GrainParameter +} + +// BenefitUtilizationSummariesListResult - List of benefit utilization summaries. +type BenefitUtilizationSummariesListResult struct { + // READ-ONLY; The link (URL) to the next page of results. + NextLink *string + + // READ-ONLY; The list of benefit utilization summaries. + Value []BenefitUtilizationSummaryClassification +} + +// BenefitUtilizationSummariesOperationStatus - Status of a benefit utilization summaries report. Provides Async Benefit Utilization +// Summaries Request input, status, and report sas url. +type BenefitUtilizationSummariesOperationStatus struct { + // Input given to create the benefit utilization summaries report. + Input *BenefitUtilizationSummariesRequest + + // Contains sas url to the async benefit utilization summaries report and a date that the url is valid until. These values + // will be empty if the report is in a Running or Failed state + Properties *AsyncOperationStatusProperties + + // The status of the creation of the benefit utilization summaries report. + Status *OperationStatusType +} + +// BenefitUtilizationSummariesRequest - Properties of an async benefit utilization summaries request. +type BenefitUtilizationSummariesRequest struct { + // REQUIRED; The end date of the summaries data that will be served in the report. + EndDate *time.Time + + // REQUIRED; The grain the summaries data is served at in the report. Accepted values are 'Daily' or 'Monthly'. + Grain *Grain + + // REQUIRED; The start date of the summaries data that will be served in the report. + StartDate *time.Time + + // Benefit id the benefit utilization summaries report is for. Required for benefit id scope. Not supported for benefit order + // or any billing scopes. + BenefitID *string + + // Benefit order id the benefit utilization summaries report is for. Required for benefit order and benefit id scopes. Not + // supported for any billing scopes. + BenefitOrderID *string + + // Billing account the benefit utilization summaries report is for. Required for billing account and billing profile scopes. + // Not supported for any benefit scopes. + BillingAccountID *string + + // Billing profile id the benefit utilization summaries report is for. Required for billing profile scope. Not supported for + // billing account or any benefit scopes. + BillingProfileID *string + + // The type of benefit data requested. Required for billing account and billing profile scopes. Implied and not to be passed + // at benefit scopes. Supported values are Reservation and SavingsPlan + Kind *BenefitKind +} + +// BenefitUtilizationSummaryClassification provides polymorphic access to related types. +// Call the interface's GetBenefitUtilizationSummary() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *BenefitUtilizationSummary, *IncludedQuantityUtilizationSummary, *SavingsPlanUtilizationSummary +type BenefitUtilizationSummaryClassification interface { + // GetBenefitUtilizationSummary returns the BenefitUtilizationSummary content of the underlying type. + GetBenefitUtilizationSummary() *BenefitUtilizationSummary +} + +// BenefitUtilizationSummary - Benefit utilization summary resource. +type BenefitUtilizationSummary struct { + // REQUIRED; Supported values: 'SavingsPlan'. + Kind *BenefitKind + + // 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; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// GetBenefitUtilizationSummary implements the BenefitUtilizationSummaryClassification interface for type BenefitUtilizationSummary. +func (b *BenefitUtilizationSummary) GetBenefitUtilizationSummary() *BenefitUtilizationSummary { + return b +} + +// BenefitUtilizationSummaryProperties - The properties of a benefit utilization summary. +type BenefitUtilizationSummaryProperties struct { + // The benefit type. Supported values: 'SavingsPlan'. + BenefitType *BenefitKind + + // READ-ONLY; ARM SKU name. For example, 'ComputeSavingsPlan' for savings plan. + ArmSKUName *string + + // READ-ONLY; The benefit ID is the identifier of the benefit. + BenefitID *string + + // READ-ONLY; The benefit order ID is the identifier for a benefit purchase. + BenefitOrderID *string + + // READ-ONLY; Date corresponding to the utilization summary record. If the grain of data is monthly, value for this field + // will be first day of the month. + UsageDate *time.Time +} + +// BillingAccountScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions contains the optional parameters for the +// BillingAccountScopeClient.BeginGenerateBenefitUtilizationSummariesReport method. +type BillingAccountScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BillingProfileScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions contains the optional parameters for the +// BillingProfileScopeClient.BeginGenerateBenefitUtilizationSummariesReport method. +type BillingProfileScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BlobInfo - The blob information generated by this operation. +type BlobInfo struct { + // Link to the blob to download file. + BlobLink *string + + // Bytes in the blob. + ByteCount *int64 +} + +// CheckNameAvailabilityRequest - The check availability request body. +type CheckNameAvailabilityRequest struct { + // The name of the resource for which availability needs to be checked. + Name *string + + // The resource type. + Type *string +} + +// CheckNameAvailabilityResponse - The check availability result. +type CheckNameAvailabilityResponse struct { + // Detailed reason why the given name is available. + Message *string + + // Indicates if the resource name is available. + NameAvailable *bool + + // The reason why the given name is not available. + Reason *CheckNameAvailabilityReason +} + // CommonExportProperties - The common properties of the export. type CommonExportProperties struct { // REQUIRED; Has the definition for the export. @@ -188,16 +575,51 @@ type CommonExportProperties struct { Format *FormatType // If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. - // Note: this option is currently available only for modern commerce scopes. + // Note: this option is currently available only for Microsoft Customer Agreement + // commerce scopes. PartitionData *bool - // If requested, has the most recent execution history for the export. + // If requested, has the most recent run history for the export. RunHistory *ExportExecutionListResult - // READ-ONLY; If the export has an active schedule, provides an estimate of the next execution time. + // READ-ONLY; If the export has an active schedule, provides an estimate of the next run time. NextRunTimeEstimate *time.Time } +// CostDetailsOperationResults - The result of the long running operation for cost details Api. +type CostDetailsOperationResults struct { + // The details of the error. + Error *ErrorDetails + + // The id of the long running operation. + ID *string + + // The manifest of the report generated by the operation. + Manifest *ReportManifest + + // The name of the long running operation. + Name *string + + // The status of the cost details operation + Status *CostDetailsStatusType + + // The type of the long running operation. + Type *string + + // The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. + ValidTill *time.Time +} + +// CostDetailsTimePeriod - The start and end date for pulling data for the cost detailed report. API only allows data to be +// pulled for 1 month or less and no older than 13 months. +type CostDetailsTimePeriod struct { + // REQUIRED; The end date to pull data to. example format 2020-03-15 + End *string + + // REQUIRED; The start date to pull data from. example format 2020-03-15 + Start *string +} + // Dimension - List of Dimension. type Dimension struct { // Dimension properties. @@ -305,6 +727,9 @@ type DownloadURL struct { // The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. ValidTill *time.Time + + // READ-ONLY; The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. + ExpiryTime *time.Time } // ErrorDetails - The details of the error. @@ -316,6 +741,18 @@ type ErrorDetails struct { Message *string } +// ErrorDetailsWithNestedDetails - The details of the error. +type ErrorDetailsWithNestedDetails struct { + // READ-ONLY; Error code. + Code *string + + // READ-ONLY; The additional details of the error. + Details []*ErrorDetailsWithNestedDetails + + // READ-ONLY; Error message indicating why the operation failed. + Message *string +} + // ErrorResponse - Error response indicates that the service is not able to process the incoming request. The reason is provided // in the error message. // Some Error responses: @@ -329,6 +766,19 @@ type ErrorResponse struct { Error *ErrorDetails } +// ErrorResponseWithNestedDetails - Error response indicates that the service is not able to process the incoming request. +// The reason is provided in the error message. +// Some Error responses: +// * 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" +// header. +// +// * 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" +// header. +type ErrorResponseWithNestedDetails struct { + // The details of the error. + Error *ErrorDetailsWithNestedDetails +} + // Export - An export resource. type Export struct { // eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating @@ -423,60 +873,10 @@ type ExportDeliveryInfo struct { Destination *ExportDeliveryDestination } -// ExportExecution - An export execution. -type ExportExecution struct { - // eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating - // the latest version or not. - ETag *string - - // The properties of the export execution. - Properties *ExportExecutionProperties - - // READ-ONLY; Resource Id. - ID *string - - // READ-ONLY; Resource name. - Name *string - - // READ-ONLY; Resource type. - Type *string -} - -// ExportExecutionListResult - Result of listing the execution history of an export. +// ExportExecutionListResult - Result of listing the run history of an export. type ExportExecutionListResult struct { - // READ-ONLY; A list of export executions. - Value []*ExportExecution -} - -// ExportExecutionProperties - The properties of the export execution. -type ExportExecutionProperties struct { - // The details of any error. - Error *ErrorDetails - - // The type of the export execution. - ExecutionType *ExecutionType - - // The name of the exported file. - FileName *string - - // The time when the export execution finished. - ProcessingEndTime *time.Time - - // The time when export was picked up to be executed. - ProcessingStartTime *time.Time - - // The export settings that were in effect for this execution. - RunSettings *CommonExportProperties - - // The last known status of the export execution. - Status *ExecutionStatus - - // The identifier for the entity that executed the export. For OnDemand executions it is the user email. For scheduled executions - // it is 'System'. - SubmittedBy *string - - // The time when export was queued to be executed. - SubmittedTime *time.Time + // READ-ONLY; A list of export runs. + Value []*ExportRun } // ExportListResult - Result of listing exports. It contains a list of available exports in the scope provided. @@ -497,16 +897,17 @@ type ExportProperties struct { Format *FormatType // If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. - // Note: this option is currently available only for modern commerce scopes. + // Note: this option is currently available only for Microsoft Customer Agreement + // commerce scopes. PartitionData *bool - // If requested, has the most recent execution history for the export. + // If requested, has the most recent run history for the export. RunHistory *ExportExecutionListResult // Has schedule information for the export. Schedule *ExportSchedule - // READ-ONLY; If the export has an active schedule, provides an estimate of the next execution time. + // READ-ONLY; If the export has an active schedule, provides an estimate of the next run time. NextRunTimeEstimate *time.Time } @@ -519,6 +920,56 @@ type ExportRecurrencePeriod struct { To *time.Time } +// ExportRun - An export run. +type ExportRun struct { + // eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating + // the latest version or not. + ETag *string + + // The properties of the export run. + Properties *ExportRunProperties + + // READ-ONLY; Resource Id. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// ExportRunProperties - The properties of the export run. +type ExportRunProperties struct { + // The details of any error. + Error *ErrorDetails + + // The type of the export run. + ExecutionType *ExecutionType + + // The name of the exported file. + FileName *string + + // The time when the export run finished. + ProcessingEndTime *time.Time + + // The time when export was picked up to be run. + ProcessingStartTime *time.Time + + // The export settings that were in effect for this run. + RunSettings *CommonExportProperties + + // The last known status of the export run. + Status *ExecutionStatus + + // The identifier for the entity that triggered the export. For on-demand runs it is the user email. For scheduled runs it + // is 'System'. + SubmittedBy *string + + // The time when export was queued to be run. + SubmittedTime *time.Time +} + // ExportSchedule - The schedule associated with the export. type ExportSchedule struct { // The schedule recurrence. @@ -565,17 +1016,32 @@ type ExportsClientGetExecutionHistoryOptions struct { // ExportsClientGetOptions contains the optional parameters for the ExportsClient.Get method. type ExportsClientGetOptions struct { // May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information - // for the last 10 executions of the export. + // for the last 10 runs of the export. Expand *string } // ExportsClientListOptions contains the optional parameters for the ExportsClient.List method. type ExportsClientListOptions struct { // May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information - // for the last execution of each export. + // for the last run of each export. Expand *string } +// FileDestination - Destination of the view data. This is optional. Currently only CSV format is supported. +type FileDestination struct { + // Destination of the view data. Currently only CSV format is supported. + FileFormats []*FileFormat +} + +// ForecastAggregation - The aggregation expression to be used in the forecast. +type ForecastAggregation struct { + // REQUIRED; The name of the aggregation function to use. + Function *FunctionType + + // REQUIRED; The name of the column to aggregate. + Name *FunctionName +} + // ForecastClientExternalCloudProviderUsageOptions contains the optional parameters for the ForecastClient.ExternalCloudProviderUsage // method. type ForecastClientExternalCloudProviderUsageOptions struct { @@ -593,42 +1059,195 @@ type ForecastClientUsageOptions struct { Filter *string } +// ForecastColumn - Forecast column properties +type ForecastColumn struct { + // The name of column. + Name *string + + // The type of column. + Type *string +} + +// ForecastComparisonExpression - The comparison expression to be used in the forecast. +type ForecastComparisonExpression struct { + // REQUIRED; The name of the column to use in comparison. + Name *string + + // REQUIRED; The operator to use for comparison. + Operator *ForecastOperatorType + + // REQUIRED; Array of values to use for comparison + Values []*string +} + // ForecastDataset - The definition of data present in the forecast. type ForecastDataset struct { - // Dictionary of aggregation expression to use in the forecast. The key of each item in the dictionary is the alias for the - // aggregated column. forecast can have up to 2 aggregation clauses. - Aggregation map[string]*QueryAggregation + // REQUIRED; Dictionary of aggregation expression to use in the forecast. The key of each item in the dictionary is the alias + // for the aggregated column. forecast can have up to 2 aggregation clauses. + Aggregation map[string]*ForecastAggregation // Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping // are provided. - Configuration *QueryDatasetConfiguration + Configuration *ForecastDatasetConfiguration // Has filter expression to use in the forecast. - Filter *QueryFilter + Filter *ForecastFilter // The granularity of rows in the forecast. Granularity *GranularityType } +// ForecastDatasetConfiguration - The configuration of dataset in the forecast. +type ForecastDatasetConfiguration struct { + // Array of column names to be included in the forecast. Any valid forecast column name is allowed. If not provided, then + // forecast includes all columns. + Columns []*string +} + // ForecastDefinition - The definition of a forecast. type ForecastDefinition struct { // REQUIRED; Has definition for data in this forecast. Dataset *ForecastDataset // REQUIRED; The time frame for pulling data for the forecast. If custom, then a specific time period must be provided. - Timeframe *ForecastTimeframeType + Timeframe *ForecastTimeframe // REQUIRED; The type of the forecast. Type *ForecastType - // a boolean determining if actualCost will be included + // A boolean determining if actualCost will be included. IncludeActualCost *bool - // a boolean determining if FreshPartialCost will be included + // A boolean determining if FreshPartialCost will be included. IncludeFreshPartialCost *bool // Has time period for pulling data for the forecast. - TimePeriod *QueryTimePeriod + TimePeriod *ForecastTimePeriod +} + +// ForecastFilter - The filter expression to be used in the export. +type ForecastFilter struct { + // The logical "AND" expression. Must have at least 2 items. + And []*ForecastFilter + + // Has comparison expression for a dimension + Dimensions *ForecastComparisonExpression + + // The logical "OR" expression. Must have at least 2 items. + Or []*ForecastFilter + + // Has comparison expression for a tag + Tags *ForecastComparisonExpression +} + +// ForecastProperties - Forecast properties +type ForecastProperties struct { + // Array of columns + Columns []*ForecastColumn + + // The link (url) to the next page of results. + NextLink *string + + // Array of rows + Rows [][]any +} + +// ForecastResult - Result of forecast. It contains all columns listed under groupings and aggregation. +type ForecastResult struct { + // Forecast properties + Properties *ForecastProperties + + // READ-ONLY; ETag of the resource. + ETag *string + + // READ-ONLY; Resource Id. + ID *string + + // READ-ONLY; Location of the resource. + Location *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; SKU of the resource. + SKU *string + + // READ-ONLY; Resource tags. + Tags map[string]*string + + // READ-ONLY; Resource type. + Type *string +} + +// ForecastTimePeriod - Has time period for pulling data for the forecast. +type ForecastTimePeriod struct { + // REQUIRED; The start date to pull data from. + From *time.Time + + // REQUIRED; The end date to pull data to. + To *time.Time +} + +// GenerateCostDetailsReportClientBeginCreateOperationOptions contains the optional parameters for the GenerateCostDetailsReportClient.BeginCreateOperation +// method. +type GenerateCostDetailsReportClientBeginCreateOperationOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GenerateCostDetailsReportClientBeginGetOperationResultsOptions contains the optional parameters for the GenerateCostDetailsReportClient.BeginGetOperationResults +// method. +type GenerateCostDetailsReportClientBeginGetOperationResultsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GenerateCostDetailsReportErrorResponse - Error response indicates that the service is not able to process the incoming +// request. The reason is provided in the error message. +// Some Error responses: +// * 400 Bad Request - Invalid Request Payload. Request payload provided is not in a json format or had an invalid member +// not accepted in the request payload. +// +// * 400 Bad Request - Invalid request payload: can only have either timePeriod or invoiceId or billingPeriod. API only allows +// data to be pulled for either timePeriod or invoiceId or billingPeriod. +// Customer should provide only one of these parameters. +// +// * 400 Bad Request - Start date must be after . API only allows data to be pulled no older than 13 months from now. +// +// * 400 Bad Request - The maximum allowed date range is 1 months. API only allows data to be pulled for 1 month or less. +// +// * 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "retry-after" header. +// +// * 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" +// header. +type GenerateCostDetailsReportErrorResponse struct { + // The details of the error. + Error *ErrorDetails +} + +// GenerateCostDetailsReportRequestDefinition - The definition of a cost detailed report. +type GenerateCostDetailsReportRequestDefinition struct { + // This parameter can be used only by Enterprise Agreement customers. Use the YearMonth(e.g. 202008) format. This parameter + // cannot be used alongside either the invoiceId or timePeriod parameters. If a + // timePeriod, invoiceId or billingPeriod parameter is not provided in the request body the API will return the current month's + // cost. + BillingPeriod *string + + // This parameter can only be used by Microsoft Customer Agreement customers. Additionally, it can only be used at the Billing + // Profile or Customer scope. This parameter cannot be used alongside either + // the billingPeriod or timePeriod parameters. If a timePeriod, invoiceId or billingPeriod parameter is not provided in the + // request body the API will return the current month's cost. + InvoiceID *string + + // The type of the detailed report. By default ActualCost is provided + Metric *CostDetailsMetricType + + // The specific date range of cost details requested for the report. This parameter cannot be used alongside either the invoiceId + // or billingPeriod parameters. If a timePeriod, invoiceId or billingPeriod + // parameter is not provided in the request body the API will return the current month's cost. API only allows data to be + // pulled for 1 month or less and no older than 13 months. If no timePeriod or + // billingPeriod or invoiceId is provided the API defaults to the open month time period + TimePeriod *CostDetailsTimePeriod } // GenerateDetailedCostReportClientBeginCreateOperationOptions contains the optional parameters for the GenerateDetailedCostReportClient.BeginCreateOperation @@ -640,15 +1259,15 @@ type GenerateDetailedCostReportClientBeginCreateOperationOptions struct { // GenerateDetailedCostReportDefinition - The definition of a cost detailed report. type GenerateDetailedCostReportDefinition struct { - // Billing Period in YearMonth(e.g. 202008) format. Only for legacy enterprise customers can use this. Can only have one of + // Billing period in YearMonth(e.g. 202008) format. Only for legacy enterprise customers can use this. Can only have one of // either timePeriod or invoiceId or billingPeriod parameters. If none provided // current month cost is provided. BillingPeriod *string - // Customer Id for Modern (Invoice Id and billing profile is also required for this). + // Customer ID for Microsoft Customer Agreement scopes (Invoice Id is also required for this). CustomerID *string - // Invoice Id for PayAsYouGo customers and Modern billing profile scope. Can only have one of either timePeriod or invoiceId + // Invoice ID for Pay-as-you-go and Microsoft Customer Agreement scopes. Can only have one of either timePeriod or invoiceId // or billingPeriod parameters. If none provided current month cost is provided. InvoiceID *string @@ -678,7 +1297,7 @@ type GenerateDetailedCostReportErrorResponse struct { // GenerateDetailedCostReportOperationResult - The result of the long running operation for cost detailed report. type GenerateDetailedCostReportOperationResult struct { - // The id of the long running operation. + // The ARM resource id of the long running operation. ID *string // The name of the long running operation. @@ -691,10 +1310,11 @@ type GenerateDetailedCostReportOperationResult struct { Type *string } -// GenerateDetailedCostReportOperationResultsClientGetOptions contains the optional parameters for the GenerateDetailedCostReportOperationResultsClient.Get +// GenerateDetailedCostReportOperationResultsClientBeginGetOptions contains the optional parameters for the GenerateDetailedCostReportOperationResultsClient.BeginGet // method. -type GenerateDetailedCostReportOperationResultsClientGetOptions struct { - // placeholder for future optional parameters +type GenerateDetailedCostReportOperationResultsClientBeginGetOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string } // GenerateDetailedCostReportOperationStatusClientGetOptions contains the optional parameters for the GenerateDetailedCostReportOperationStatusClient.Get @@ -705,18 +1325,24 @@ type GenerateDetailedCostReportOperationStatusClientGetOptions struct { // GenerateDetailedCostReportOperationStatuses - The status of the long running operation for cost detailed report. type GenerateDetailedCostReportOperationStatuses struct { + // The endTime of the operation. + EndTime *string + // The details of the error. Error *ErrorDetails - // The id of the long running operation. + // The ID of the long running operation. ID *string // The name of the long running operation. Name *string - // The properties of the resource generated. + // The properties of the usage file generated. Properties *DownloadURL + // The startTime of the operation. + StartTime *string + // The status of the long running operation. Status *Status @@ -747,6 +1373,56 @@ type GenerateReservationDetailsReportClientBeginByBillingProfileIDOptions struct ResumeToken string } +// IncludedQuantityUtilizationSummary - Included Quantity utilization summary resource. +type IncludedQuantityUtilizationSummary struct { + // REQUIRED; Supported values: 'SavingsPlan'. + Kind *BenefitKind + + // Included Quantity utilization summary properties. + Properties *IncludedQuantityUtilizationSummaryProperties + + // 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; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// GetBenefitUtilizationSummary implements the BenefitUtilizationSummaryClassification interface for type IncludedQuantityUtilizationSummary. +func (i *IncludedQuantityUtilizationSummary) GetBenefitUtilizationSummary() *BenefitUtilizationSummary { + return &BenefitUtilizationSummary{ + Kind: i.Kind, + ID: i.ID, + Name: i.Name, + Type: i.Type, + } +} + +// IncludedQuantityUtilizationSummaryProperties - Included Quantity utilization summary properties. +type IncludedQuantityUtilizationSummaryProperties struct { + // The benefit type. Supported values: 'SavingsPlan'. + BenefitType *BenefitKind + + // READ-ONLY; ARM SKU name. For example, 'ComputeSavingsPlan' for savings plan. + ArmSKUName *string + + // READ-ONLY; The benefit ID is the identifier of the benefit. + BenefitID *string + + // READ-ONLY; The benefit order ID is the identifier for a benefit purchase. + BenefitOrderID *string + + // READ-ONLY; Date corresponding to the utilization summary record. If the grain of data is monthly, value for this field + // will be first day of the month. + UsageDate *time.Time + + // READ-ONLY; This is the utilized percentage for the benefit ID. + UtilizationPercentage *float64 +} + // KpiProperties - Each KPI must contain a 'type' and 'enabled' key. type KpiProperties struct { // show the KPI in the UI? @@ -759,33 +1435,87 @@ type KpiProperties struct { Type *KpiType } -// Operation - A Cost management REST API operation. +// NotificationProperties - The properties of the scheduled action notification. +type NotificationProperties struct { + // REQUIRED; Subject of the email. Length is limited to 70 characters. + Subject *string + + // REQUIRED; Array of email addresses. + To []*string + + // Locale of the email. + Language *string + + // Optional message to be added in the email. Length is limited to 250 characters. + Message *string + + // Regional format used for formatting date/time and currency values in the email. + RegionalFormat *string +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { - // The object that represents the operation. + // Localized display information for this particular operation. Display *OperationDisplay - // READ-ONLY; Operation id: {provider}/{resource}/{operation}. - ID *string + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType - // READ-ONLY; Operation name: {provider}/{resource}/{operation}. + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + // operations. + IsDataAction *bool + + // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + // "Microsoft.Compute/virtualMachines/capture/action" Name *string + + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin } -// OperationDisplay - The object that represents the operation. +// OperationDisplay - Localized display information for this particular operation. type OperationDisplay struct { - // READ-ONLY; Operation description + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. Description *string - // READ-ONLY; Operation type: Read, write, delete, etc. + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". Operation *string - // READ-ONLY; Service provider: Microsoft.CostManagement. + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". Provider *string - // READ-ONLY; Resource on which the operation is performed: Dimensions, Query. + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". Resource *string } +// OperationForCostManagement - A Cost management REST API operation. +type OperationForCostManagement struct { + // Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Operation id: {provider}/{resource}/{operation}. + ID *string + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + // operations. + IsDataAction *bool + + // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + // "Microsoft.Compute/virtualMachines/capture/action" + Name *string + + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin +} + // OperationListResult - Result of listing cost management operations. It contains a list of operations and a URL link to // get the next set of results. type OperationListResult struct { @@ -793,7 +1523,7 @@ type OperationListResult struct { NextLink *string // READ-ONLY; List of cost management operations supported by the Microsoft.CostManagement resource provider. - Value []*Operation + Value []*OperationForCostManagement } // OperationStatus - The status of the long running operation. @@ -819,8 +1549,34 @@ type PivotProperties struct { Type *PivotType } -// ProxyResource - The Resource model definition. +// PriceSheetClientBeginDownloadByBillingProfileOptions contains the optional parameters for the PriceSheetClient.BeginDownloadByBillingProfile +// method. +type PriceSheetClientBeginDownloadByBillingProfileOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PriceSheetClientBeginDownloadOptions contains the optional parameters for the PriceSheetClient.BeginDownload method. +type PriceSheetClientBeginDownloadOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a +// location type ProxyResource struct { + // 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; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ProxyResourceForCostManagement - The Resource model definition. +type ProxyResourceForCostManagement 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 @@ -991,6 +1747,17 @@ type QueryTimePeriod struct { To *time.Time } +// RecommendationUsageDetails - On-demand charges between firstConsumptionDate and lastConsumptionDate that were used for +// computing benefit recommendations. +type RecommendationUsageDetails struct { + // The grain of the usage. Supported values: 'Hourly' + UsageGrain *Grain + + // READ-ONLY; On-demand charges for each hour between firstConsumptionDate and lastConsumptionDate that were used for computing + // benefit recommendations. + Charges []*float64 +} + // ReportConfigAggregation - The aggregation expression to be used in the report. type ReportConfigAggregation struct { // REQUIRED; The name of the aggregation function to use. @@ -1083,7 +1850,7 @@ type ReportConfigGrouping struct { Name *string // REQUIRED; Has type of the column to group. - Type *ReportConfigColumnType + Type *QueryColumnType } // ReportConfigSorting - The order by expression to be used in the report. @@ -1104,6 +1871,30 @@ type ReportConfigTimePeriod struct { To *time.Time } +// ReportManifest - The manifest of the report generated by the operation. +type ReportManifest struct { + // The total number of blobs. + BlobCount *int32 + + // List of blob information generated by this operation. + Blobs []*BlobInfo + + // The total number of bytes in all blobs. + ByteCount *int64 + + // Is the data in compressed format. + CompressData *bool + + // The data format of the report + DataFormat *CostDetailsDataFormat + + // The Manifest version. + ManifestVersion *string + + // The context of the Cost Details request. + RequestContext *RequestContext +} + // ReportURL - The URL to download the generated report. type ReportURL struct { // The CSV file from the reportUrl blob link consists of reservation usage data with the following schema at daily granularity @@ -1113,8 +1904,43 @@ type ReportURL struct { ValidUntil *time.Time } -// Resource - The Resource model definition. +// RequestContext - The context of the Cost Details request. +type RequestContext struct { + // The request payload body provided in Cost Details call + RequestBody *GenerateCostDetailsReportRequestDefinition + + // The request scope of the request. + RequestScope *string +} + +// ReservationOrderScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions contains the optional parameters for the +// ReservationOrderScopeClient.BeginGenerateBenefitUtilizationSummariesReport method. +type ReservationOrderScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ReservationScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions contains the optional parameters for the ReservationScopeClient.BeginGenerateBenefitUtilizationSummariesReport +// method. +type ReservationScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { + // 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; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ResourceForCostManagement - The Resource model definition. +type ResourceForCostManagement struct { // READ-ONLY; ETag of the resource. ETag *string @@ -1137,12 +1963,445 @@ type Resource struct { Type *string } +// SavingsPlanOrderScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions contains the optional parameters for the +// SavingsPlanOrderScopeClient.BeginGenerateBenefitUtilizationSummariesReport method. +type SavingsPlanOrderScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SavingsPlanScopeClientBeginGenerateBenefitUtilizationSummariesReportAsyncOptions contains the optional parameters for the +// SavingsPlanScopeClient.BeginGenerateBenefitUtilizationSummariesReportAsync method. +type SavingsPlanScopeClientBeginGenerateBenefitUtilizationSummariesReportAsyncOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SavingsPlanUtilizationSummary - Savings plan utilization summary resource. +type SavingsPlanUtilizationSummary struct { + // REQUIRED; Supported values: 'SavingsPlan'. + Kind *BenefitKind + + // Savings plan utilization summary properties. + Properties *SavingsPlanUtilizationSummaryProperties + + // 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; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// GetBenefitUtilizationSummary implements the BenefitUtilizationSummaryClassification interface for type SavingsPlanUtilizationSummary. +func (s *SavingsPlanUtilizationSummary) GetBenefitUtilizationSummary() *BenefitUtilizationSummary { + return &BenefitUtilizationSummary{ + Kind: s.Kind, + ID: s.ID, + Name: s.Name, + Type: s.Type, + } +} + +// SavingsPlanUtilizationSummaryProperties - Savings plan utilization summary properties. +type SavingsPlanUtilizationSummaryProperties struct { + // The benefit type. Supported values: 'SavingsPlan'. + BenefitType *BenefitKind + + // READ-ONLY; ARM SKU name. For example, 'ComputeSavingsPlan' for savings plan. + ArmSKUName *string + + // READ-ONLY; This is the average hourly utilization for each date range that corresponds to given grain (Daily, Monthly). + // Suppose the API call is for usageDate > 2023-03-01 and usageDate < 2022-10-31 at a daily + // granularity. There will be one record per benefit id for each day. For a single day, the avgUtilizationPercentage value + // will be equal to the average of the set of values where the set contains 24 + // utilization percentage entries one for each hour in a specific day. + AvgUtilizationPercentage *float64 + + // READ-ONLY; The benefit ID is the identifier of the benefit. + BenefitID *string + + // READ-ONLY; The benefit order ID is the identifier for a benefit purchase. + BenefitOrderID *string + + // READ-ONLY; This is the maximum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). + // Suppose the API call is for usageDate > 2023-03-01 and usageDate < 2022-10-31 at a daily + // granularity. There will be one record per benefit id for each day. For a single day, the maxUtilizationPercentage value + // will be equal to the largest in the set of values where the set contains 24 + // utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the largest utilization percentage + // was 90% at hour 5, then the value for the maxUtilizationPercentage in + // the response will be 90%. + MaxUtilizationPercentage *float64 + + // READ-ONLY; This is the minimum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). + // Suppose the API call is for usageDate > 2023-03-01 and usageDate < 2022-10-31 at a daily + // granularity. There will be one record per benefit id for each day. For a single day, the minUtilizationPercentage value + // will be equal to the smallest in the set of values where the set contains 24 + // utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the lowest utilization percentage + // was 10% at hour 4, then the value for the minUtilizationPercentage in + // the response will be 10%. + MinUtilizationPercentage *float64 + + // READ-ONLY; Date corresponding to the utilization summary record. If the grain of data is monthly, value for this field + // will be first day of the month. + UsageDate *time.Time +} + +// ScheduleProperties - The properties of the schedule. +type ScheduleProperties struct { + // REQUIRED; The end date and time of the scheduled action (UTC). + EndDate *time.Time + + // REQUIRED; Frequency of the schedule. + Frequency *ScheduleFrequency + + // REQUIRED; The start date and time of the scheduled action (UTC). + StartDate *time.Time + + // UTC day on which cost analysis data will be emailed. Must be between 1 and 31. This property is applicable when frequency + // is Monthly and overrides weeksOfMonth or daysOfWeek. + DayOfMonth *int32 + + // Day names in english on which cost analysis data will be emailed. This property is applicable when frequency is Weekly + // or Monthly. + DaysOfWeek []*DaysOfWeek + + // UTC time at which cost analysis data will be emailed. + HourOfDay *int32 + + // Weeks in which cost analysis data will be emailed. This property is applicable when frequency is Monthly and used in combination + // with daysOfWeek. + WeeksOfMonth []*WeeksOfMonth +} + +// ScheduledAction - Scheduled action definition. +type ScheduledAction struct { + // Kind of the scheduled action. + Kind *ScheduledActionKind + + // The properties of the scheduled action. + Properties *ScheduledActionProperties + + // READ-ONLY; Resource Etag. For update calls, eTag is mandatory. Fetch the resource's eTag by doing a 'GET' call first and + // then including the latest eTag as part of the request body or 'If-Match' header while + // performing the update. For create calls, eTag is not required. + 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; Kind of the scheduled action. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ScheduledActionListResult - Scheduled actions list result. It contains a list of scheduled actions. +type ScheduledActionListResult struct { + // READ-ONLY; The link (url) to the next page of results. + NextLink *string + + // READ-ONLY; The list of scheduled actions. + Value []*ScheduledAction +} + +// ScheduledActionProperties - The properties of the scheduled action. +type ScheduledActionProperties struct { + // REQUIRED; Scheduled action name. + DisplayName *string + + // REQUIRED; Notification properties based on scheduled action kind. + Notification *NotificationProperties + + // REQUIRED; Schedule of the scheduled action. + Schedule *ScheduleProperties + + // REQUIRED; Status of the scheduled action. + Status *ScheduledActionStatus + + // REQUIRED; Cost analysis viewId used for scheduled action. For example, '/providers/Microsoft.CostManagement/views/swaggerExample' + ViewID *string + + // Destination format of the view data. This is optional. + FileDestination *FileDestination + + // Email address of the point of contact that should get the unsubscribe requests and notification emails. + NotificationEmail *string + + // Cost Management scope like 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + // for resourceGroup scope, + // 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + // for Department + // scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount + // scope, + // 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile + // scope, + // 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection + // scope, + // '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, + // and + // '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope. + Scope *string +} + +// ScheduledActionProxyResource - The Resource model definition. +type ScheduledActionProxyResource struct { + // Kind of the scheduled action. + Kind *ScheduledActionKind + + // READ-ONLY; Resource Etag. For update calls, eTag is mandatory. Fetch the resource's eTag by doing a 'GET' call first and + // then including the latest eTag as part of the request body or 'If-Match' header while + // performing the update. For create calls, eTag is not required. + 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; Kind of the scheduled action. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ScheduledActionsClientCheckNameAvailabilityByScopeOptions contains the optional parameters for the ScheduledActionsClient.CheckNameAvailabilityByScope +// method. +type ScheduledActionsClientCheckNameAvailabilityByScopeOptions struct { + // placeholder for future optional parameters +} + +// ScheduledActionsClientCheckNameAvailabilityOptions contains the optional parameters for the ScheduledActionsClient.CheckNameAvailability +// method. +type ScheduledActionsClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// ScheduledActionsClientCreateOrUpdateByScopeOptions contains the optional parameters for the ScheduledActionsClient.CreateOrUpdateByScope +// method. +type ScheduledActionsClientCreateOrUpdateByScopeOptions struct { + // ETag of the Entity. Not required when creating an entity. Optional when updating an entity and can be specified to achieve + // optimistic concurrency. + IfMatch *string +} + +// ScheduledActionsClientCreateOrUpdateOptions contains the optional parameters for the ScheduledActionsClient.CreateOrUpdate +// method. +type ScheduledActionsClientCreateOrUpdateOptions struct { + // ETag of the Entity. Not required when creating an entity. Optional when updating an entity and can be specified to achieve + // optimistic concurrency. + IfMatch *string +} + +// ScheduledActionsClientDeleteByScopeOptions contains the optional parameters for the ScheduledActionsClient.DeleteByScope +// method. +type ScheduledActionsClientDeleteByScopeOptions struct { + // placeholder for future optional parameters +} + +// ScheduledActionsClientDeleteOptions contains the optional parameters for the ScheduledActionsClient.Delete method. +type ScheduledActionsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ScheduledActionsClientGetByScopeOptions contains the optional parameters for the ScheduledActionsClient.GetByScope method. +type ScheduledActionsClientGetByScopeOptions struct { + // placeholder for future optional parameters +} + +// ScheduledActionsClientGetOptions contains the optional parameters for the ScheduledActionsClient.Get method. +type ScheduledActionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ScheduledActionsClientListByScopeOptions contains the optional parameters for the ScheduledActionsClient.NewListByScopePager +// method. +type ScheduledActionsClientListByScopeOptions struct { + // May be used to filter scheduled actions by properties/viewId. Supported operator is 'eq'. + Filter *string +} + +// ScheduledActionsClientListOptions contains the optional parameters for the ScheduledActionsClient.NewListPager method. +type ScheduledActionsClientListOptions struct { + // May be used to filter scheduled actions by properties/viewId. Supported operator is 'eq'. + Filter *string +} + +// ScheduledActionsClientRunByScopeOptions contains the optional parameters for the ScheduledActionsClient.RunByScope method. +type ScheduledActionsClientRunByScopeOptions struct { + // placeholder for future optional parameters +} + +// ScheduledActionsClientRunOptions contains the optional parameters for the ScheduledActionsClient.Run method. +type ScheduledActionsClientRunOptions struct { + // placeholder for future optional parameters +} + +// SharedScopeBenefitRecommendationProperties - The properties of the benefit recommendation when scope is 'Shared'. +type SharedScopeBenefitRecommendationProperties struct { + // REQUIRED; Benefit scope. For example, Single or Shared. + Scope *Scope + + // Grain of the proposed commitment amount. Supported values: 'Hourly' + CommitmentGranularity *Grain + + // The number of days of usage evaluated for computing the recommendations. + LookBackPeriod *LookBackPeriod + + // The details of the proposed recommendation. + RecommendationDetails *AllSavingsBenefitDetails + + // Term period of the benefit. For example, P1Y or P3Y. + Term *Term + + // On-demand charges between firstConsumptionDate and lastConsumptionDate that were used for computing benefit recommendations. + Usage *RecommendationUsageDetails + + // READ-ONLY; The list of all benefit recommendations with the recommendation details. + AllRecommendationDetails *AllSavingsList + + // READ-ONLY; ARM SKU name. 'ComputeSavingsPlan' for SavingsPlan. + ArmSKUName *string + + // READ-ONLY; The current cost without benefit, corresponds to 'totalHours' in the look-back period. + CostWithoutBenefit *float64 + + // READ-ONLY; An ISO 4217 currency code identifier for the costs and savings amounts. + CurrencyCode *string + + // READ-ONLY; The first usage date used for looking back for computing the recommendations. + FirstConsumptionDate *time.Time + + // READ-ONLY; The last usage date used for looking back for computing the recommendations. + LastConsumptionDate *time.Time + + // READ-ONLY; The total hours for which the cost is covered. Its equal to number of records in a property 'properties/usage/charges'. + TotalHours *int32 +} + +// GetBenefitRecommendationProperties implements the BenefitRecommendationPropertiesClassification interface for type SharedScopeBenefitRecommendationProperties. +func (s *SharedScopeBenefitRecommendationProperties) GetBenefitRecommendationProperties() *BenefitRecommendationProperties { + return &BenefitRecommendationProperties{ + FirstConsumptionDate: s.FirstConsumptionDate, + LastConsumptionDate: s.LastConsumptionDate, + LookBackPeriod: s.LookBackPeriod, + TotalHours: s.TotalHours, + Usage: s.Usage, + ArmSKUName: s.ArmSKUName, + Term: s.Term, + CommitmentGranularity: s.CommitmentGranularity, + CurrencyCode: s.CurrencyCode, + CostWithoutBenefit: s.CostWithoutBenefit, + RecommendationDetails: s.RecommendationDetails, + AllRecommendationDetails: s.AllRecommendationDetails, + Scope: s.Scope, + } +} + +// SingleScopeBenefitRecommendationProperties - The properties of the benefit recommendations when scope is 'Single'. +type SingleScopeBenefitRecommendationProperties struct { + // REQUIRED; Benefit scope. For example, Single or Shared. + Scope *Scope + + // Grain of the proposed commitment amount. Supported values: 'Hourly' + CommitmentGranularity *Grain + + // The number of days of usage evaluated for computing the recommendations. + LookBackPeriod *LookBackPeriod + + // The details of the proposed recommendation. + RecommendationDetails *AllSavingsBenefitDetails + + // Term period of the benefit. For example, P1Y or P3Y. + Term *Term + + // On-demand charges between firstConsumptionDate and lastConsumptionDate that were used for computing benefit recommendations. + Usage *RecommendationUsageDetails + + // READ-ONLY; The list of all benefit recommendations with the recommendation details. + AllRecommendationDetails *AllSavingsList + + // READ-ONLY; ARM SKU name. 'ComputeSavingsPlan' for SavingsPlan. + ArmSKUName *string + + // READ-ONLY; The current cost without benefit, corresponds to 'totalHours' in the look-back period. + CostWithoutBenefit *float64 + + // READ-ONLY; An ISO 4217 currency code identifier for the costs and savings amounts. + CurrencyCode *string + + // READ-ONLY; The first usage date used for looking back for computing the recommendations. + FirstConsumptionDate *time.Time + + // READ-ONLY; The last usage date used for looking back for computing the recommendations. + LastConsumptionDate *time.Time + + // READ-ONLY; The resource group that this single scope recommendation is for. Applicable only if recommendation is for 'Single' + // scope and 'ResourceGroup' request scope. + ResourceGroup *string + + // READ-ONLY; The subscription ID that this single scope recommendation is for. Applicable only if recommendation is for 'Single' + // scope. + SubscriptionID *string + + // READ-ONLY; The total hours for which the cost is covered. Its equal to number of records in a property 'properties/usage/charges'. + TotalHours *int32 +} + +// GetBenefitRecommendationProperties implements the BenefitRecommendationPropertiesClassification interface for type SingleScopeBenefitRecommendationProperties. +func (s *SingleScopeBenefitRecommendationProperties) GetBenefitRecommendationProperties() *BenefitRecommendationProperties { + return &BenefitRecommendationProperties{ + FirstConsumptionDate: s.FirstConsumptionDate, + LastConsumptionDate: s.LastConsumptionDate, + LookBackPeriod: s.LookBackPeriod, + TotalHours: s.TotalHours, + Usage: s.Usage, + ArmSKUName: s.ArmSKUName, + Term: s.Term, + CommitmentGranularity: s.CommitmentGranularity, + CurrencyCode: s.CurrencyCode, + CostWithoutBenefit: s.CostWithoutBenefit, + RecommendationDetails: s.RecommendationDetails, + AllRecommendationDetails: s.AllRecommendationDetails, + Scope: s.Scope, + } +} + // Status - The status of the long running operation. type Status struct { // The status of the long running operation. Status *ReportOperationStatusType } +// SystemData - Metadata pertaining to creation and last modification of the resource. +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 +} + // View - States and configurations of Cost Analysis. type View struct { // eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/models_serde.go b/sdk/resourcemanager/costmanagement/armcostmanagement/models_serde.go index 91536544b487..2f8897bf0b0a 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/models_serde.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/models_serde.go @@ -303,803 +303,961 @@ func (a *AlertsResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CommonExportProperties. -func (c CommonExportProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AllSavingsBenefitDetails. +func (a AllSavingsBenefitDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "definition", c.Definition) - populate(objectMap, "deliveryInfo", c.DeliveryInfo) - populate(objectMap, "format", c.Format) - populateTimeRFC3339(objectMap, "nextRunTimeEstimate", c.NextRunTimeEstimate) - populate(objectMap, "partitionData", c.PartitionData) - populate(objectMap, "runHistory", c.RunHistory) + populate(objectMap, "averageUtilizationPercentage", a.AverageUtilizationPercentage) + populate(objectMap, "benefitCost", a.BenefitCost) + populate(objectMap, "commitmentAmount", a.CommitmentAmount) + populate(objectMap, "coveragePercentage", a.CoveragePercentage) + populate(objectMap, "overageCost", a.OverageCost) + populate(objectMap, "savingsAmount", a.SavingsAmount) + populate(objectMap, "savingsPercentage", a.SavingsPercentage) + populate(objectMap, "totalCost", a.TotalCost) + populate(objectMap, "wastageCost", a.WastageCost) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CommonExportProperties. -func (c *CommonExportProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AllSavingsBenefitDetails. +func (a *AllSavingsBenefitDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "definition": - err = unpopulate(val, "Definition", &c.Definition) + case "averageUtilizationPercentage": + err = unpopulate(val, "AverageUtilizationPercentage", &a.AverageUtilizationPercentage) delete(rawMsg, key) - case "deliveryInfo": - err = unpopulate(val, "DeliveryInfo", &c.DeliveryInfo) + case "benefitCost": + err = unpopulate(val, "BenefitCost", &a.BenefitCost) delete(rawMsg, key) - case "format": - err = unpopulate(val, "Format", &c.Format) + case "commitmentAmount": + err = unpopulate(val, "CommitmentAmount", &a.CommitmentAmount) delete(rawMsg, key) - case "nextRunTimeEstimate": - err = unpopulateTimeRFC3339(val, "NextRunTimeEstimate", &c.NextRunTimeEstimate) + case "coveragePercentage": + err = unpopulate(val, "CoveragePercentage", &a.CoveragePercentage) delete(rawMsg, key) - case "partitionData": - err = unpopulate(val, "PartitionData", &c.PartitionData) + case "overageCost": + err = unpopulate(val, "OverageCost", &a.OverageCost) delete(rawMsg, key) - case "runHistory": - err = unpopulate(val, "RunHistory", &c.RunHistory) + case "savingsAmount": + err = unpopulate(val, "SavingsAmount", &a.SavingsAmount) + delete(rawMsg, key) + case "savingsPercentage": + err = unpopulate(val, "SavingsPercentage", &a.SavingsPercentage) + delete(rawMsg, key) + case "totalCost": + err = unpopulate(val, "TotalCost", &a.TotalCost) + delete(rawMsg, key) + case "wastageCost": + err = unpopulate(val, "WastageCost", &a.WastageCost) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Dimension. -func (d Dimension) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AllSavingsList. +func (a AllSavingsList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", d.ETag) - populate(objectMap, "id", d.ID) - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "sku", d.SKU) - populate(objectMap, "tags", d.Tags) - populate(objectMap, "type", d.Type) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Dimension. -func (d *Dimension) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AllSavingsList. +func (a *AllSavingsList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &d.ETag) + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AsyncOperationStatusProperties. +func (a AsyncOperationStatusProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "reportUrl", a.ReportURL) + populate(objectMap, "secondaryReportUrl", a.SecondaryReportURL) + populateTimeRFC3339(objectMap, "validUntil", a.ValidUntil) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AsyncOperationStatusProperties. +func (a *AsyncOperationStatusProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "reportUrl": + err = unpopulate(val, "ReportURL", &a.ReportURL) + delete(rawMsg, key) + case "secondaryReportUrl": + err = unpopulate(val, "SecondaryReportURL", &a.SecondaryReportURL) + delete(rawMsg, key) + case "validUntil": + err = unpopulateTimeRFC3339(val, "ValidUntil", &a.ValidUntil) delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BenefitRecommendationModel. +func (b BenefitRecommendationModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", b.ID) + populate(objectMap, "kind", b.Kind) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BenefitRecommendationModel. +func (b *BenefitRecommendationModel) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { case "id": - err = unpopulate(val, "ID", &d.ID) + err = unpopulate(val, "ID", &b.ID) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &d.Location) + case "kind": + err = unpopulate(val, "Kind", &b.Kind) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &d.Name) + err = unpopulate(val, "Name", &b.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) - case "sku": - err = unpopulate(val, "SKU", &d.SKU) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &d.Tags) + b.Properties, err = unmarshalBenefitRecommendationPropertiesClassification(val) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &d.Type) + err = unpopulate(val, "Type", &b.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DimensionProperties. -func (d DimensionProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BenefitRecommendationProperties. +func (b BenefitRecommendationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "category", d.Category) - populate(objectMap, "data", d.Data) - populate(objectMap, "description", d.Description) - populate(objectMap, "filterEnabled", d.FilterEnabled) - populate(objectMap, "groupingEnabled", d.GroupingEnabled) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "total", d.Total) - populateTimeRFC3339(objectMap, "usageEnd", d.UsageEnd) - populateTimeRFC3339(objectMap, "usageStart", d.UsageStart) + populate(objectMap, "allRecommendationDetails", b.AllRecommendationDetails) + populate(objectMap, "armSkuName", b.ArmSKUName) + populate(objectMap, "commitmentGranularity", b.CommitmentGranularity) + populate(objectMap, "costWithoutBenefit", b.CostWithoutBenefit) + populate(objectMap, "currencyCode", b.CurrencyCode) + populateTimeRFC3339(objectMap, "firstConsumptionDate", b.FirstConsumptionDate) + populateTimeRFC3339(objectMap, "lastConsumptionDate", b.LastConsumptionDate) + populate(objectMap, "lookBackPeriod", b.LookBackPeriod) + populate(objectMap, "recommendationDetails", b.RecommendationDetails) + objectMap["scope"] = b.Scope + populate(objectMap, "term", b.Term) + populate(objectMap, "totalHours", b.TotalHours) + populate(objectMap, "usage", b.Usage) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DimensionProperties. -func (d *DimensionProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type BenefitRecommendationProperties. +func (b *BenefitRecommendationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } for key, val := range rawMsg { var err error switch key { - case "category": - err = unpopulate(val, "Category", &d.Category) + case "allRecommendationDetails": + err = unpopulate(val, "AllRecommendationDetails", &b.AllRecommendationDetails) delete(rawMsg, key) - case "data": - err = unpopulate(val, "Data", &d.Data) + case "armSkuName": + err = unpopulate(val, "ArmSKUName", &b.ArmSKUName) delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) + case "commitmentGranularity": + err = unpopulate(val, "CommitmentGranularity", &b.CommitmentGranularity) delete(rawMsg, key) - case "filterEnabled": - err = unpopulate(val, "FilterEnabled", &d.FilterEnabled) + case "costWithoutBenefit": + err = unpopulate(val, "CostWithoutBenefit", &b.CostWithoutBenefit) delete(rawMsg, key) - case "groupingEnabled": - err = unpopulate(val, "GroupingEnabled", &d.GroupingEnabled) + case "currencyCode": + err = unpopulate(val, "CurrencyCode", &b.CurrencyCode) delete(rawMsg, key) - case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) + case "firstConsumptionDate": + err = unpopulateTimeRFC3339(val, "FirstConsumptionDate", &b.FirstConsumptionDate) delete(rawMsg, key) - case "total": - err = unpopulate(val, "Total", &d.Total) + case "lastConsumptionDate": + err = unpopulateTimeRFC3339(val, "LastConsumptionDate", &b.LastConsumptionDate) delete(rawMsg, key) - case "usageEnd": - err = unpopulateTimeRFC3339(val, "UsageEnd", &d.UsageEnd) + case "lookBackPeriod": + err = unpopulate(val, "LookBackPeriod", &b.LookBackPeriod) delete(rawMsg, key) - case "usageStart": - err = unpopulateTimeRFC3339(val, "UsageStart", &d.UsageStart) + case "recommendationDetails": + err = unpopulate(val, "RecommendationDetails", &b.RecommendationDetails) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &b.Scope) + delete(rawMsg, key) + case "term": + err = unpopulate(val, "Term", &b.Term) + delete(rawMsg, key) + case "totalHours": + err = unpopulate(val, "TotalHours", &b.TotalHours) + delete(rawMsg, key) + case "usage": + err = unpopulate(val, "Usage", &b.Usage) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DimensionsListResult. -func (d DimensionsListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BenefitRecommendationsListResult. +func (b BenefitRecommendationsListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", d.Value) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DimensionsListResult. -func (d *DimensionsListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type BenefitRecommendationsListResult. +func (b *BenefitRecommendationsListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &b.NextLink) + delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &d.Value) + err = unpopulate(val, "Value", &b.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DismissAlertPayload. -func (d DismissAlertPayload) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BenefitResource. +func (b BenefitResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", d.Properties) + populate(objectMap, "id", b.ID) + populate(objectMap, "kind", b.Kind) + populate(objectMap, "name", b.Name) + populate(objectMap, "type", b.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DismissAlertPayload. -func (d *DismissAlertPayload) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type BenefitResource. +func (b *BenefitResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &d.Properties) + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &b.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DownloadURL. -func (d DownloadURL) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BenefitUtilizationSummariesListResult. +func (b BenefitUtilizationSummariesListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "downloadUrl", d.DownloadURL) - populateTimeRFC3339(objectMap, "validTill", d.ValidTill) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DownloadURL. -func (d *DownloadURL) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type BenefitUtilizationSummariesListResult. +func (b *BenefitUtilizationSummariesListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } for key, val := range rawMsg { var err error switch key { - case "downloadUrl": - err = unpopulate(val, "DownloadURL", &d.DownloadURL) + case "nextLink": + err = unpopulate(val, "NextLink", &b.NextLink) delete(rawMsg, key) - case "validTill": - err = unpopulateTimeRFC3339(val, "ValidTill", &d.ValidTill) + case "value": + b.Value, err = unmarshalBenefitUtilizationSummaryClassificationArray(val) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorDetails. -func (e ErrorDetails) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BenefitUtilizationSummariesOperationStatus. +func (b BenefitUtilizationSummariesOperationStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "message", e.Message) + populate(objectMap, "input", b.Input) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "status", b.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetails. -func (e *ErrorDetails) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type BenefitUtilizationSummariesOperationStatus. +func (b *BenefitUtilizationSummariesOperationStatus) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &e.Code) + case "input": + err = unpopulate(val, "Input", &b.Input) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &b.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BenefitUtilizationSummariesRequest. +func (b BenefitUtilizationSummariesRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) + populate(objectMap, "benefitId", b.BenefitID) + populate(objectMap, "benefitOrderId", b.BenefitOrderID) + populate(objectMap, "billingAccountId", b.BillingAccountID) + populate(objectMap, "billingProfileId", b.BillingProfileID) + populateTimeRFC3339(objectMap, "endDate", b.EndDate) + populate(objectMap, "grain", b.Grain) + populate(objectMap, "kind", b.Kind) + populateTimeRFC3339(objectMap, "startDate", b.StartDate) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type BenefitUtilizationSummariesRequest. +func (b *BenefitUtilizationSummariesRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) + case "benefitId": + err = unpopulate(val, "BenefitID", &b.BenefitID) + delete(rawMsg, key) + case "benefitOrderId": + err = unpopulate(val, "BenefitOrderID", &b.BenefitOrderID) + delete(rawMsg, key) + case "billingAccountId": + err = unpopulate(val, "BillingAccountID", &b.BillingAccountID) + delete(rawMsg, key) + case "billingProfileId": + err = unpopulate(val, "BillingProfileID", &b.BillingProfileID) + delete(rawMsg, key) + case "endDate": + err = unpopulateTimeRFC3339(val, "EndDate", &b.EndDate) + delete(rawMsg, key) + case "grain": + err = unpopulate(val, "Grain", &b.Grain) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &b.Kind) + delete(rawMsg, key) + case "startDate": + err = unpopulateTimeRFC3339(val, "StartDate", &b.StartDate) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Export. -func (e Export) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BenefitUtilizationSummary. +func (b BenefitUtilizationSummary) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", e.ETag) - populate(objectMap, "id", e.ID) - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "type", e.Type) + populate(objectMap, "id", b.ID) + objectMap["kind"] = b.Kind + populate(objectMap, "name", b.Name) + populate(objectMap, "type", b.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Export. -func (e *Export) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type BenefitUtilizationSummary. +func (b *BenefitUtilizationSummary) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &e.ETag) - delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &e.ID) + err = unpopulate(val, "ID", &b.ID) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) + case "kind": + err = unpopulate(val, "Kind", &b.Kind) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &e.Properties) + case "name": + err = unpopulate(val, "Name", &b.Name) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &e.Type) + err = unpopulate(val, "Type", &b.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExportDataset. -func (e ExportDataset) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BenefitUtilizationSummaryProperties. +func (b BenefitUtilizationSummaryProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "configuration", e.Configuration) - populate(objectMap, "granularity", e.Granularity) + populate(objectMap, "armSkuName", b.ArmSKUName) + populate(objectMap, "benefitId", b.BenefitID) + populate(objectMap, "benefitOrderId", b.BenefitOrderID) + populate(objectMap, "benefitType", b.BenefitType) + populateTimeRFC3339(objectMap, "usageDate", b.UsageDate) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportDataset. -func (e *ExportDataset) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type BenefitUtilizationSummaryProperties. +func (b *BenefitUtilizationSummaryProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } for key, val := range rawMsg { var err error switch key { - case "configuration": - err = unpopulate(val, "Configuration", &e.Configuration) + case "armSkuName": + err = unpopulate(val, "ArmSKUName", &b.ArmSKUName) delete(rawMsg, key) - case "granularity": - err = unpopulate(val, "Granularity", &e.Granularity) + case "benefitId": + err = unpopulate(val, "BenefitID", &b.BenefitID) + delete(rawMsg, key) + case "benefitOrderId": + err = unpopulate(val, "BenefitOrderID", &b.BenefitOrderID) + delete(rawMsg, key) + case "benefitType": + err = unpopulate(val, "BenefitType", &b.BenefitType) + delete(rawMsg, key) + case "usageDate": + err = unpopulateTimeRFC3339(val, "UsageDate", &b.UsageDate) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExportDatasetConfiguration. -func (e ExportDatasetConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BlobInfo. +func (b BlobInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "columns", e.Columns) + populate(objectMap, "blobLink", b.BlobLink) + populate(objectMap, "byteCount", b.ByteCount) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportDatasetConfiguration. -func (e *ExportDatasetConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type BlobInfo. +func (b *BlobInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } for key, val := range rawMsg { var err error switch key { - case "columns": - err = unpopulate(val, "Columns", &e.Columns) + case "blobLink": + err = unpopulate(val, "BlobLink", &b.BlobLink) + delete(rawMsg, key) + case "byteCount": + err = unpopulate(val, "ByteCount", &b.ByteCount) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExportDefinition. -func (e ExportDefinition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityRequest. +func (c CheckNameAvailabilityRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dataSet", e.DataSet) - populate(objectMap, "timePeriod", e.TimePeriod) - populate(objectMap, "timeframe", e.Timeframe) - populate(objectMap, "type", e.Type) + populate(objectMap, "name", c.Name) + populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportDefinition. -func (e *ExportDefinition) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityRequest. +func (c *CheckNameAvailabilityRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "dataSet": - err = unpopulate(val, "DataSet", &e.DataSet) - delete(rawMsg, key) - case "timePeriod": - err = unpopulate(val, "TimePeriod", &e.TimePeriod) - delete(rawMsg, key) - case "timeframe": - err = unpopulate(val, "Timeframe", &e.Timeframe) + case "name": + err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &e.Type) + err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExportDeliveryDestination. -func (e ExportDeliveryDestination) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityResponse. +func (c CheckNameAvailabilityResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "container", e.Container) - populate(objectMap, "resourceId", e.ResourceID) - populate(objectMap, "rootFolderPath", e.RootFolderPath) - populate(objectMap, "sasToken", e.SasToken) - populate(objectMap, "storageAccount", e.StorageAccount) + populate(objectMap, "message", c.Message) + populate(objectMap, "nameAvailable", c.NameAvailable) + populate(objectMap, "reason", c.Reason) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportDeliveryDestination. -func (e *ExportDeliveryDestination) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityResponse. +func (c *CheckNameAvailabilityResponse) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "container": - err = unpopulate(val, "Container", &e.Container) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &e.ResourceID) - delete(rawMsg, key) - case "rootFolderPath": - err = unpopulate(val, "RootFolderPath", &e.RootFolderPath) + case "message": + err = unpopulate(val, "Message", &c.Message) delete(rawMsg, key) - case "sasToken": - err = unpopulate(val, "SasToken", &e.SasToken) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &c.NameAvailable) delete(rawMsg, key) - case "storageAccount": - err = unpopulate(val, "StorageAccount", &e.StorageAccount) + case "reason": + err = unpopulate(val, "Reason", &c.Reason) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExportDeliveryInfo. -func (e ExportDeliveryInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CommonExportProperties. +func (c CommonExportProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "destination", e.Destination) + populate(objectMap, "definition", c.Definition) + populate(objectMap, "deliveryInfo", c.DeliveryInfo) + populate(objectMap, "format", c.Format) + populateTimeRFC3339(objectMap, "nextRunTimeEstimate", c.NextRunTimeEstimate) + populate(objectMap, "partitionData", c.PartitionData) + populate(objectMap, "runHistory", c.RunHistory) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportDeliveryInfo. -func (e *ExportDeliveryInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CommonExportProperties. +func (c *CommonExportProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "destination": - err = unpopulate(val, "Destination", &e.Destination) + case "definition": + err = unpopulate(val, "Definition", &c.Definition) + delete(rawMsg, key) + case "deliveryInfo": + err = unpopulate(val, "DeliveryInfo", &c.DeliveryInfo) + delete(rawMsg, key) + case "format": + err = unpopulate(val, "Format", &c.Format) + delete(rawMsg, key) + case "nextRunTimeEstimate": + err = unpopulateTimeRFC3339(val, "NextRunTimeEstimate", &c.NextRunTimeEstimate) + delete(rawMsg, key) + case "partitionData": + err = unpopulate(val, "PartitionData", &c.PartitionData) + delete(rawMsg, key) + case "runHistory": + err = unpopulate(val, "RunHistory", &c.RunHistory) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExportExecution. -func (e ExportExecution) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CostDetailsOperationResults. +func (c CostDetailsOperationResults) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", e.ETag) - populate(objectMap, "id", e.ID) - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "type", e.Type) + populate(objectMap, "error", c.Error) + populate(objectMap, "id", c.ID) + populate(objectMap, "manifest", c.Manifest) + populate(objectMap, "name", c.Name) + populate(objectMap, "status", c.Status) + populate(objectMap, "type", c.Type) + populateTimeRFC3339(objectMap, "validTill", c.ValidTill) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportExecution. -func (e *ExportExecution) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CostDetailsOperationResults. +func (c *CostDetailsOperationResults) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &e.ETag) + case "error": + err = unpopulate(val, "Error", &c.Error) delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &e.ID) + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "manifest": + err = unpopulate(val, "Manifest", &c.Manifest) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &e.Name) + err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &e.Properties) + case "status": + err = unpopulate(val, "Status", &c.Status) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &e.Type) + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + case "validTill": + err = unpopulateTimeRFC3339(val, "ValidTill", &c.ValidTill) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExportExecutionListResult. -func (e ExportExecutionListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CostDetailsTimePeriod. +func (c CostDetailsTimePeriod) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", e.Value) + populate(objectMap, "end", c.End) + populate(objectMap, "start", c.Start) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportExecutionListResult. -func (e *ExportExecutionListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CostDetailsTimePeriod. +func (c *CostDetailsTimePeriod) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &e.Value) + case "end": + err = unpopulate(val, "End", &c.End) + delete(rawMsg, key) + case "start": + err = unpopulate(val, "Start", &c.Start) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExportExecutionProperties. -func (e ExportExecutionProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Dimension. +func (d Dimension) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) - populate(objectMap, "executionType", e.ExecutionType) - populate(objectMap, "fileName", e.FileName) - populateTimeRFC3339(objectMap, "processingEndTime", e.ProcessingEndTime) - populateTimeRFC3339(objectMap, "processingStartTime", e.ProcessingStartTime) - populate(objectMap, "runSettings", e.RunSettings) - populate(objectMap, "status", e.Status) - populate(objectMap, "submittedBy", e.SubmittedBy) - populateTimeRFC3339(objectMap, "submittedTime", e.SubmittedTime) + populate(objectMap, "eTag", d.ETag) + populate(objectMap, "id", d.ID) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "sku", d.SKU) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportExecutionProperties. -func (e *ExportExecutionProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Dimension. +func (d *Dimension) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) - delete(rawMsg, key) - case "executionType": - err = unpopulate(val, "ExecutionType", &e.ExecutionType) + case "eTag": + err = unpopulate(val, "ETag", &d.ETag) delete(rawMsg, key) - case "fileName": - err = unpopulate(val, "FileName", &e.FileName) + case "id": + err = unpopulate(val, "ID", &d.ID) delete(rawMsg, key) - case "processingEndTime": - err = unpopulateTimeRFC3339(val, "ProcessingEndTime", &e.ProcessingEndTime) + case "location": + err = unpopulate(val, "Location", &d.Location) delete(rawMsg, key) - case "processingStartTime": - err = unpopulateTimeRFC3339(val, "ProcessingStartTime", &e.ProcessingStartTime) + case "name": + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) - case "runSettings": - err = unpopulate(val, "RunSettings", &e.RunSettings) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &e.Status) + case "sku": + err = unpopulate(val, "SKU", &d.SKU) delete(rawMsg, key) - case "submittedBy": - err = unpopulate(val, "SubmittedBy", &e.SubmittedBy) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) delete(rawMsg, key) - case "submittedTime": - err = unpopulateTimeRFC3339(val, "SubmittedTime", &e.SubmittedTime) + case "type": + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExportListResult. -func (e ExportListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DimensionProperties. +func (d DimensionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", e.Value) + populate(objectMap, "category", d.Category) + populate(objectMap, "data", d.Data) + populate(objectMap, "description", d.Description) + populate(objectMap, "filterEnabled", d.FilterEnabled) + populate(objectMap, "groupingEnabled", d.GroupingEnabled) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "total", d.Total) + populateTimeRFC3339(objectMap, "usageEnd", d.UsageEnd) + populateTimeRFC3339(objectMap, "usageStart", d.UsageStart) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportListResult. -func (e *ExportListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DimensionProperties. +func (d *DimensionProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &e.Value) + case "category": + err = unpopulate(val, "Category", &d.Category) + delete(rawMsg, key) + case "data": + err = unpopulate(val, "Data", &d.Data) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "filterEnabled": + err = unpopulate(val, "FilterEnabled", &d.FilterEnabled) + delete(rawMsg, key) + case "groupingEnabled": + err = unpopulate(val, "GroupingEnabled", &d.GroupingEnabled) + delete(rawMsg, key) + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "total": + err = unpopulate(val, "Total", &d.Total) + delete(rawMsg, key) + case "usageEnd": + err = unpopulateTimeRFC3339(val, "UsageEnd", &d.UsageEnd) + delete(rawMsg, key) + case "usageStart": + err = unpopulateTimeRFC3339(val, "UsageStart", &d.UsageStart) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExportProperties. -func (e ExportProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DimensionsListResult. +func (d DimensionsListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "definition", e.Definition) - populate(objectMap, "deliveryInfo", e.DeliveryInfo) - populate(objectMap, "format", e.Format) - populateTimeRFC3339(objectMap, "nextRunTimeEstimate", e.NextRunTimeEstimate) - populate(objectMap, "partitionData", e.PartitionData) - populate(objectMap, "runHistory", e.RunHistory) - populate(objectMap, "schedule", e.Schedule) + populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportProperties. -func (e *ExportProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DimensionsListResult. +func (d *DimensionsListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "definition": - err = unpopulate(val, "Definition", &e.Definition) - delete(rawMsg, key) - case "deliveryInfo": - err = unpopulate(val, "DeliveryInfo", &e.DeliveryInfo) - delete(rawMsg, key) - case "format": - err = unpopulate(val, "Format", &e.Format) - delete(rawMsg, key) - case "nextRunTimeEstimate": - err = unpopulateTimeRFC3339(val, "NextRunTimeEstimate", &e.NextRunTimeEstimate) - delete(rawMsg, key) - case "partitionData": - err = unpopulate(val, "PartitionData", &e.PartitionData) - delete(rawMsg, key) - case "runHistory": - err = unpopulate(val, "RunHistory", &e.RunHistory) - delete(rawMsg, key) - case "schedule": - err = unpopulate(val, "Schedule", &e.Schedule) + case "value": + err = unpopulate(val, "Value", &d.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExportRecurrencePeriod. -func (e ExportRecurrencePeriod) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DismissAlertPayload. +func (d DismissAlertPayload) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "from", e.From) - populateTimeRFC3339(objectMap, "to", e.To) + populate(objectMap, "properties", d.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportRecurrencePeriod. -func (e *ExportRecurrencePeriod) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DismissAlertPayload. +func (d *DismissAlertPayload) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "from": - err = unpopulateTimeRFC3339(val, "From", &e.From) - delete(rawMsg, key) - case "to": - err = unpopulateTimeRFC3339(val, "To", &e.To) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExportSchedule. -func (e ExportSchedule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DownloadURL. +func (d DownloadURL) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "recurrence", e.Recurrence) - populate(objectMap, "recurrencePeriod", e.RecurrencePeriod) - populate(objectMap, "status", e.Status) + populate(objectMap, "downloadUrl", d.DownloadURL) + populateTimeRFC3339(objectMap, "expiryTime", d.ExpiryTime) + populateTimeRFC3339(objectMap, "validTill", d.ValidTill) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportSchedule. -func (e *ExportSchedule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DownloadURL. +func (d *DownloadURL) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "recurrence": - err = unpopulate(val, "Recurrence", &e.Recurrence) + case "downloadUrl": + err = unpopulate(val, "DownloadURL", &d.DownloadURL) delete(rawMsg, key) - case "recurrencePeriod": - err = unpopulate(val, "RecurrencePeriod", &e.RecurrencePeriod) + case "expiryTime": + err = unpopulateTimeRFC3339(val, "ExpiryTime", &d.ExpiryTime) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &e.Status) + case "validTill": + err = unpopulateTimeRFC3339(val, "ValidTill", &d.ValidTill) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExportTimePeriod. -func (e ExportTimePeriod) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorDetails. +func (e ErrorDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "from", e.From) - populateTimeRFC3339(objectMap, "to", e.To) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportTimePeriod. -func (e *ExportTimePeriod) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetails. +func (e *ErrorDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -1107,11 +1265,11 @@ func (e *ExportTimePeriod) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "from": - err = unpopulateTimeRFC3339(val, "From", &e.From) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "to": - err = unpopulateTimeRFC3339(val, "To", &e.To) + case "message": + err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) } if err != nil { @@ -1121,927 +1279,2598 @@ func (e *ExportTimePeriod) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ForecastDataset. -func (f ForecastDataset) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorDetailsWithNestedDetails. +func (e ErrorDetailsWithNestedDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "aggregation", f.Aggregation) - populate(objectMap, "configuration", f.Configuration) - populate(objectMap, "filter", f.Filter) - populate(objectMap, "granularity", f.Granularity) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ForecastDataset. -func (f *ForecastDataset) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetailsWithNestedDetails. +func (e *ErrorDetailsWithNestedDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "aggregation": - err = unpopulate(val, "Aggregation", &f.Aggregation) - delete(rawMsg, key) - case "configuration": - err = unpopulate(val, "Configuration", &f.Configuration) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "filter": - err = unpopulate(val, "Filter", &f.Filter) + case "details": + err = unpopulate(val, "Details", &e.Details) delete(rawMsg, key) - case "granularity": - err = unpopulate(val, "Granularity", &f.Granularity) + case "message": + err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ForecastDefinition. -func (f ForecastDefinition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dataset", f.Dataset) - populate(objectMap, "includeActualCost", f.IncludeActualCost) - populate(objectMap, "includeFreshPartialCost", f.IncludeFreshPartialCost) - populate(objectMap, "timePeriod", f.TimePeriod) - populate(objectMap, "timeframe", f.Timeframe) - populate(objectMap, "type", f.Type) + populate(objectMap, "error", e.Error) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ForecastDefinition. -func (f *ForecastDefinition) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "dataset": - err = unpopulate(val, "Dataset", &f.Dataset) - delete(rawMsg, key) - case "includeActualCost": - err = unpopulate(val, "IncludeActualCost", &f.IncludeActualCost) - delete(rawMsg, key) - case "includeFreshPartialCost": - err = unpopulate(val, "IncludeFreshPartialCost", &f.IncludeFreshPartialCost) - delete(rawMsg, key) - case "timePeriod": - err = unpopulate(val, "TimePeriod", &f.TimePeriod) - delete(rawMsg, key) - case "timeframe": - err = unpopulate(val, "Timeframe", &f.Timeframe) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &f.Type) + case "error": + err = unpopulate(val, "Error", &e.Error) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GenerateDetailedCostReportDefinition. -func (g GenerateDetailedCostReportDefinition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseWithNestedDetails. +func (e ErrorResponseWithNestedDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "billingPeriod", g.BillingPeriod) - populate(objectMap, "customerId", g.CustomerID) - populate(objectMap, "invoiceId", g.InvoiceID) - populate(objectMap, "metric", g.Metric) - populate(objectMap, "timePeriod", g.TimePeriod) + populate(objectMap, "error", e.Error) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateDetailedCostReportDefinition. -func (g *GenerateDetailedCostReportDefinition) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseWithNestedDetails. +func (e *ErrorResponseWithNestedDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "billingPeriod": - err = unpopulate(val, "BillingPeriod", &g.BillingPeriod) - delete(rawMsg, key) - case "customerId": - err = unpopulate(val, "CustomerID", &g.CustomerID) - delete(rawMsg, key) - case "invoiceId": - err = unpopulate(val, "InvoiceID", &g.InvoiceID) - delete(rawMsg, key) - case "metric": - err = unpopulate(val, "Metric", &g.Metric) - delete(rawMsg, key) - case "timePeriod": - err = unpopulate(val, "TimePeriod", &g.TimePeriod) + case "error": + err = unpopulate(val, "Error", &e.Error) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GenerateDetailedCostReportErrorResponse. -func (g GenerateDetailedCostReportErrorResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Export. +func (e Export) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", g.Error) + populate(objectMap, "eTag", e.ETag) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateDetailedCostReportErrorResponse. -func (g *GenerateDetailedCostReportErrorResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Export. +func (e *Export) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &g.Error) + case "eTag": + err = unpopulate(val, "ETag", &e.ETag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GenerateDetailedCostReportOperationResult. -func (g GenerateDetailedCostReportOperationResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExportDataset. +func (e ExportDataset) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", g.ID) - populate(objectMap, "name", g.Name) - populate(objectMap, "properties", g.Properties) - populate(objectMap, "type", g.Type) + populate(objectMap, "configuration", e.Configuration) + populate(objectMap, "granularity", e.Granularity) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateDetailedCostReportOperationResult. -func (g *GenerateDetailedCostReportOperationResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportDataset. +func (e *ExportDataset) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &g.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &g.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &g.Properties) + case "configuration": + err = unpopulate(val, "Configuration", &e.Configuration) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &g.Type) + case "granularity": + err = unpopulate(val, "Granularity", &e.Granularity) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GenerateDetailedCostReportOperationStatuses. -func (g GenerateDetailedCostReportOperationStatuses) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) +// MarshalJSON implements the json.Marshaller interface for type ExportDatasetConfiguration. +func (e ExportDatasetConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "columns", e.Columns) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportDatasetConfiguration. +func (e *ExportDatasetConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "columns": + err = unpopulate(val, "Columns", &e.Columns) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExportDefinition. +func (e ExportDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dataSet", e.DataSet) + populate(objectMap, "timePeriod", e.TimePeriod) + populate(objectMap, "timeframe", e.Timeframe) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportDefinition. +func (e *ExportDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataSet": + err = unpopulate(val, "DataSet", &e.DataSet) + delete(rawMsg, key) + case "timePeriod": + err = unpopulate(val, "TimePeriod", &e.TimePeriod) + delete(rawMsg, key) + case "timeframe": + err = unpopulate(val, "Timeframe", &e.Timeframe) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExportDeliveryDestination. +func (e ExportDeliveryDestination) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "container", e.Container) + populate(objectMap, "resourceId", e.ResourceID) + populate(objectMap, "rootFolderPath", e.RootFolderPath) + populate(objectMap, "sasToken", e.SasToken) + populate(objectMap, "storageAccount", e.StorageAccount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportDeliveryDestination. +func (e *ExportDeliveryDestination) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "container": + err = unpopulate(val, "Container", &e.Container) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &e.ResourceID) + delete(rawMsg, key) + case "rootFolderPath": + err = unpopulate(val, "RootFolderPath", &e.RootFolderPath) + delete(rawMsg, key) + case "sasToken": + err = unpopulate(val, "SasToken", &e.SasToken) + delete(rawMsg, key) + case "storageAccount": + err = unpopulate(val, "StorageAccount", &e.StorageAccount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExportDeliveryInfo. +func (e ExportDeliveryInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "destination", e.Destination) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportDeliveryInfo. +func (e *ExportDeliveryInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destination": + err = unpopulate(val, "Destination", &e.Destination) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExportExecutionListResult. +func (e ExportExecutionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportExecutionListResult. +func (e *ExportExecutionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExportListResult. +func (e ExportListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportListResult. +func (e *ExportListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExportProperties. +func (e ExportProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "definition", e.Definition) + populate(objectMap, "deliveryInfo", e.DeliveryInfo) + populate(objectMap, "format", e.Format) + populateTimeRFC3339(objectMap, "nextRunTimeEstimate", e.NextRunTimeEstimate) + populate(objectMap, "partitionData", e.PartitionData) + populate(objectMap, "runHistory", e.RunHistory) + populate(objectMap, "schedule", e.Schedule) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportProperties. +func (e *ExportProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "definition": + err = unpopulate(val, "Definition", &e.Definition) + delete(rawMsg, key) + case "deliveryInfo": + err = unpopulate(val, "DeliveryInfo", &e.DeliveryInfo) + delete(rawMsg, key) + case "format": + err = unpopulate(val, "Format", &e.Format) + delete(rawMsg, key) + case "nextRunTimeEstimate": + err = unpopulateTimeRFC3339(val, "NextRunTimeEstimate", &e.NextRunTimeEstimate) + delete(rawMsg, key) + case "partitionData": + err = unpopulate(val, "PartitionData", &e.PartitionData) + delete(rawMsg, key) + case "runHistory": + err = unpopulate(val, "RunHistory", &e.RunHistory) + delete(rawMsg, key) + case "schedule": + err = unpopulate(val, "Schedule", &e.Schedule) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExportRecurrencePeriod. +func (e ExportRecurrencePeriod) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "from", e.From) + populateTimeRFC3339(objectMap, "to", e.To) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportRecurrencePeriod. +func (e *ExportRecurrencePeriod) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "from": + err = unpopulateTimeRFC3339(val, "From", &e.From) + delete(rawMsg, key) + case "to": + err = unpopulateTimeRFC3339(val, "To", &e.To) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExportRun. +func (e ExportRun) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "eTag", e.ETag) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportRun. +func (e *ExportRun) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "eTag": + err = unpopulate(val, "ETag", &e.ETag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExportRunProperties. +func (e ExportRunProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + populate(objectMap, "executionType", e.ExecutionType) + populate(objectMap, "fileName", e.FileName) + populateTimeRFC3339(objectMap, "processingEndTime", e.ProcessingEndTime) + populateTimeRFC3339(objectMap, "processingStartTime", e.ProcessingStartTime) + populate(objectMap, "runSettings", e.RunSettings) + populate(objectMap, "status", e.Status) + populate(objectMap, "submittedBy", e.SubmittedBy) + populateTimeRFC3339(objectMap, "submittedTime", e.SubmittedTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportRunProperties. +func (e *ExportRunProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + case "executionType": + err = unpopulate(val, "ExecutionType", &e.ExecutionType) + delete(rawMsg, key) + case "fileName": + err = unpopulate(val, "FileName", &e.FileName) + delete(rawMsg, key) + case "processingEndTime": + err = unpopulateTimeRFC3339(val, "ProcessingEndTime", &e.ProcessingEndTime) + delete(rawMsg, key) + case "processingStartTime": + err = unpopulateTimeRFC3339(val, "ProcessingStartTime", &e.ProcessingStartTime) + delete(rawMsg, key) + case "runSettings": + err = unpopulate(val, "RunSettings", &e.RunSettings) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &e.Status) + delete(rawMsg, key) + case "submittedBy": + err = unpopulate(val, "SubmittedBy", &e.SubmittedBy) + delete(rawMsg, key) + case "submittedTime": + err = unpopulateTimeRFC3339(val, "SubmittedTime", &e.SubmittedTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExportSchedule. +func (e ExportSchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "recurrence", e.Recurrence) + populate(objectMap, "recurrencePeriod", e.RecurrencePeriod) + populate(objectMap, "status", e.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportSchedule. +func (e *ExportSchedule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "recurrence": + err = unpopulate(val, "Recurrence", &e.Recurrence) + delete(rawMsg, key) + case "recurrencePeriod": + err = unpopulate(val, "RecurrencePeriod", &e.RecurrencePeriod) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &e.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExportTimePeriod. +func (e ExportTimePeriod) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "from", e.From) + populateTimeRFC3339(objectMap, "to", e.To) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportTimePeriod. +func (e *ExportTimePeriod) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "from": + err = unpopulateTimeRFC3339(val, "From", &e.From) + delete(rawMsg, key) + case "to": + err = unpopulateTimeRFC3339(val, "To", &e.To) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FileDestination. +func (f FileDestination) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "fileFormats", f.FileFormats) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileDestination. +func (f *FileDestination) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "fileFormats": + err = unpopulate(val, "FileFormats", &f.FileFormats) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ForecastAggregation. +func (f ForecastAggregation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "function", f.Function) + populate(objectMap, "name", f.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ForecastAggregation. +func (f *ForecastAggregation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "function": + err = unpopulate(val, "Function", &f.Function) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ForecastColumn. +func (f ForecastColumn) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", f.Name) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ForecastColumn. +func (f *ForecastColumn) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ForecastComparisonExpression. +func (f ForecastComparisonExpression) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", f.Name) + populate(objectMap, "operator", f.Operator) + populate(objectMap, "values", f.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ForecastComparisonExpression. +func (f *ForecastComparisonExpression) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "operator": + err = unpopulate(val, "Operator", &f.Operator) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &f.Values) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ForecastDataset. +func (f ForecastDataset) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "aggregation", f.Aggregation) + populate(objectMap, "configuration", f.Configuration) + populate(objectMap, "filter", f.Filter) + populate(objectMap, "granularity", f.Granularity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ForecastDataset. +func (f *ForecastDataset) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aggregation": + err = unpopulate(val, "Aggregation", &f.Aggregation) + delete(rawMsg, key) + case "configuration": + err = unpopulate(val, "Configuration", &f.Configuration) + delete(rawMsg, key) + case "filter": + err = unpopulate(val, "Filter", &f.Filter) + delete(rawMsg, key) + case "granularity": + err = unpopulate(val, "Granularity", &f.Granularity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ForecastDatasetConfiguration. +func (f ForecastDatasetConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "columns", f.Columns) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ForecastDatasetConfiguration. +func (f *ForecastDatasetConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "columns": + err = unpopulate(val, "Columns", &f.Columns) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ForecastDefinition. +func (f ForecastDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dataset", f.Dataset) + populate(objectMap, "includeActualCost", f.IncludeActualCost) + populate(objectMap, "includeFreshPartialCost", f.IncludeFreshPartialCost) + populate(objectMap, "timePeriod", f.TimePeriod) + populate(objectMap, "timeframe", f.Timeframe) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ForecastDefinition. +func (f *ForecastDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataset": + err = unpopulate(val, "Dataset", &f.Dataset) + delete(rawMsg, key) + case "includeActualCost": + err = unpopulate(val, "IncludeActualCost", &f.IncludeActualCost) + delete(rawMsg, key) + case "includeFreshPartialCost": + err = unpopulate(val, "IncludeFreshPartialCost", &f.IncludeFreshPartialCost) + delete(rawMsg, key) + case "timePeriod": + err = unpopulate(val, "TimePeriod", &f.TimePeriod) + delete(rawMsg, key) + case "timeframe": + err = unpopulate(val, "Timeframe", &f.Timeframe) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ForecastFilter. +func (f ForecastFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "and", f.And) + populate(objectMap, "dimensions", f.Dimensions) + populate(objectMap, "or", f.Or) + populate(objectMap, "tags", f.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ForecastFilter. +func (f *ForecastFilter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "and": + err = unpopulate(val, "And", &f.And) + delete(rawMsg, key) + case "dimensions": + err = unpopulate(val, "Dimensions", &f.Dimensions) + delete(rawMsg, key) + case "or": + err = unpopulate(val, "Or", &f.Or) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &f.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ForecastProperties. +func (f ForecastProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "columns", f.Columns) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "rows", f.Rows) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ForecastProperties. +func (f *ForecastProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "columns": + err = unpopulate(val, "Columns", &f.Columns) + delete(rawMsg, key) + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "rows": + err = unpopulate(val, "Rows", &f.Rows) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ForecastResult. +func (f ForecastResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "eTag", f.ETag) + populate(objectMap, "id", f.ID) + populate(objectMap, "location", f.Location) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "sku", f.SKU) + populate(objectMap, "tags", f.Tags) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ForecastResult. +func (f *ForecastResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "eTag": + err = unpopulate(val, "ETag", &f.ETag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &f.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &f.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &f.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ForecastTimePeriod. +func (f ForecastTimePeriod) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "from", f.From) + populateTimeRFC3339(objectMap, "to", f.To) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ForecastTimePeriod. +func (f *ForecastTimePeriod) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "from": + err = unpopulateTimeRFC3339(val, "From", &f.From) + delete(rawMsg, key) + case "to": + err = unpopulateTimeRFC3339(val, "To", &f.To) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GenerateCostDetailsReportErrorResponse. +func (g GenerateCostDetailsReportErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", g.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateCostDetailsReportErrorResponse. +func (g *GenerateCostDetailsReportErrorResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &g.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GenerateCostDetailsReportRequestDefinition. +func (g GenerateCostDetailsReportRequestDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "billingPeriod", g.BillingPeriod) + populate(objectMap, "invoiceId", g.InvoiceID) + populate(objectMap, "metric", g.Metric) + populate(objectMap, "timePeriod", g.TimePeriod) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateCostDetailsReportRequestDefinition. +func (g *GenerateCostDetailsReportRequestDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "billingPeriod": + err = unpopulate(val, "BillingPeriod", &g.BillingPeriod) + delete(rawMsg, key) + case "invoiceId": + err = unpopulate(val, "InvoiceID", &g.InvoiceID) + delete(rawMsg, key) + case "metric": + err = unpopulate(val, "Metric", &g.Metric) + delete(rawMsg, key) + case "timePeriod": + err = unpopulate(val, "TimePeriod", &g.TimePeriod) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GenerateDetailedCostReportDefinition. +func (g GenerateDetailedCostReportDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "billingPeriod", g.BillingPeriod) + populate(objectMap, "customerId", g.CustomerID) + populate(objectMap, "invoiceId", g.InvoiceID) + populate(objectMap, "metric", g.Metric) + populate(objectMap, "timePeriod", g.TimePeriod) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateDetailedCostReportDefinition. +func (g *GenerateDetailedCostReportDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "billingPeriod": + err = unpopulate(val, "BillingPeriod", &g.BillingPeriod) + delete(rawMsg, key) + case "customerId": + err = unpopulate(val, "CustomerID", &g.CustomerID) + delete(rawMsg, key) + case "invoiceId": + err = unpopulate(val, "InvoiceID", &g.InvoiceID) + delete(rawMsg, key) + case "metric": + err = unpopulate(val, "Metric", &g.Metric) + delete(rawMsg, key) + case "timePeriod": + err = unpopulate(val, "TimePeriod", &g.TimePeriod) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GenerateDetailedCostReportErrorResponse. +func (g GenerateDetailedCostReportErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", g.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateDetailedCostReportErrorResponse. +func (g *GenerateDetailedCostReportErrorResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &g.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GenerateDetailedCostReportOperationResult. +func (g GenerateDetailedCostReportOperationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateDetailedCostReportOperationResult. +func (g *GenerateDetailedCostReportOperationResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GenerateDetailedCostReportOperationStatuses. +func (g GenerateDetailedCostReportOperationStatuses) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endTime", g.EndTime) populate(objectMap, "error", g.Error) populate(objectMap, "id", g.ID) populate(objectMap, "name", g.Name) populate(objectMap, "properties", g.Properties) + populate(objectMap, "startTime", g.StartTime) populate(objectMap, "status", g.Status) populate(objectMap, "type", g.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateDetailedCostReportOperationStatuses. -func (g *GenerateDetailedCostReportOperationStatuses) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateDetailedCostReportOperationStatuses. +func (g *GenerateDetailedCostReportOperationStatuses) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulate(val, "EndTime", &g.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &g.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "startTime": + err = unpopulate(val, "StartTime", &g.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &g.Status) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GenerateDetailedCostReportTimePeriod. +func (g GenerateDetailedCostReportTimePeriod) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "end", g.End) + populate(objectMap, "start", g.Start) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateDetailedCostReportTimePeriod. +func (g *GenerateDetailedCostReportTimePeriod) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "end": + err = unpopulate(val, "End", &g.End) + delete(rawMsg, key) + case "start": + err = unpopulate(val, "Start", &g.Start) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IncludedQuantityUtilizationSummary. +func (i IncludedQuantityUtilizationSummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", i.ID) + objectMap["kind"] = BenefitKindIncludedQuantity + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IncludedQuantityUtilizationSummary. +func (i *IncludedQuantityUtilizationSummary) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &i.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IncludedQuantityUtilizationSummaryProperties. +func (i IncludedQuantityUtilizationSummaryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "armSkuName", i.ArmSKUName) + populate(objectMap, "benefitId", i.BenefitID) + populate(objectMap, "benefitOrderId", i.BenefitOrderID) + populate(objectMap, "benefitType", i.BenefitType) + populateTimeRFC3339(objectMap, "usageDate", i.UsageDate) + populate(objectMap, "utilizationPercentage", i.UtilizationPercentage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IncludedQuantityUtilizationSummaryProperties. +func (i *IncludedQuantityUtilizationSummaryProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "armSkuName": + err = unpopulate(val, "ArmSKUName", &i.ArmSKUName) + delete(rawMsg, key) + case "benefitId": + err = unpopulate(val, "BenefitID", &i.BenefitID) + delete(rawMsg, key) + case "benefitOrderId": + err = unpopulate(val, "BenefitOrderID", &i.BenefitOrderID) + delete(rawMsg, key) + case "benefitType": + err = unpopulate(val, "BenefitType", &i.BenefitType) + delete(rawMsg, key) + case "usageDate": + err = unpopulateTimeRFC3339(val, "UsageDate", &i.UsageDate) + delete(rawMsg, key) + case "utilizationPercentage": + err = unpopulate(val, "UtilizationPercentage", &i.UtilizationPercentage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KpiProperties. +func (k KpiProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", k.Enabled) + populate(objectMap, "id", k.ID) + populate(objectMap, "type", k.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KpiProperties. +func (k *KpiProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &k.Enabled) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &k.ID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &k.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NotificationProperties. +func (n NotificationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "language", n.Language) + populate(objectMap, "message", n.Message) + populate(objectMap, "regionalFormat", n.RegionalFormat) + populate(objectMap, "subject", n.Subject) + populate(objectMap, "to", n.To) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NotificationProperties. +func (n *NotificationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "language": + err = unpopulate(val, "Language", &n.Language) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &n.Message) + delete(rawMsg, key) + case "regionalFormat": + err = unpopulate(val, "RegionalFormat", &n.RegionalFormat) + delete(rawMsg, key) + case "subject": + err = unpopulate(val, "Subject", &n.Subject) + delete(rawMsg, key) + case "to": + err = unpopulate(val, "To", &n.To) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationForCostManagement. +func (o OperationForCostManagement) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "id", o.ID) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationForCostManagement. +func (o *OperationForCostManagement) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationStatus. +func (o OperationStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "status", o.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatus. +func (o *OperationStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &o.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PivotProperties. +func (p PivotProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", p.Name) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PivotProperties. +func (p *PivotProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. +func (p *ProxyResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProxyResourceForCostManagement. +func (p ProxyResourceForCostManagement) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "eTag", p.ETag) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResourceForCostManagement. +func (p *ProxyResourceForCostManagement) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "eTag": + err = unpopulate(val, "ETag", &p.ETag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QueryAggregation. +func (q QueryAggregation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "function", q.Function) + populate(objectMap, "name", q.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryAggregation. +func (q *QueryAggregation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "function": + err = unpopulate(val, "Function", &q.Function) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &q.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QueryColumn. +func (q QueryColumn) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", q.Name) + populate(objectMap, "type", q.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryColumn. +func (q *QueryColumn) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &g.Error) + case "name": + err = unpopulate(val, "Name", &q.Name) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &g.ID) + case "type": + err = unpopulate(val, "Type", &q.Type) delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QueryComparisonExpression. +func (q QueryComparisonExpression) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", q.Name) + populate(objectMap, "operator", q.Operator) + populate(objectMap, "values", q.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryComparisonExpression. +func (q *QueryComparisonExpression) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { case "name": - err = unpopulate(val, "Name", &g.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &g.Properties) + err = unpopulate(val, "Name", &q.Name) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &g.Status) + case "operator": + err = unpopulate(val, "Operator", &q.Operator) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &g.Type) + case "values": + err = unpopulate(val, "Values", &q.Values) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GenerateDetailedCostReportTimePeriod. -func (g GenerateDetailedCostReportTimePeriod) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type QueryDataset. +func (q QueryDataset) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "end", g.End) - populate(objectMap, "start", g.Start) + populate(objectMap, "aggregation", q.Aggregation) + populate(objectMap, "configuration", q.Configuration) + populate(objectMap, "filter", q.Filter) + populate(objectMap, "granularity", q.Granularity) + populate(objectMap, "grouping", q.Grouping) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateDetailedCostReportTimePeriod. -func (g *GenerateDetailedCostReportTimePeriod) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryDataset. +func (q *QueryDataset) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } for key, val := range rawMsg { var err error switch key { - case "end": - err = unpopulate(val, "End", &g.End) + case "aggregation": + err = unpopulate(val, "Aggregation", &q.Aggregation) delete(rawMsg, key) - case "start": - err = unpopulate(val, "Start", &g.Start) + case "configuration": + err = unpopulate(val, "Configuration", &q.Configuration) + delete(rawMsg, key) + case "filter": + err = unpopulate(val, "Filter", &q.Filter) + delete(rawMsg, key) + case "granularity": + err = unpopulate(val, "Granularity", &q.Granularity) + delete(rawMsg, key) + case "grouping": + err = unpopulate(val, "Grouping", &q.Grouping) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type KpiProperties. -func (k KpiProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type QueryDatasetConfiguration. +func (q QueryDatasetConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "enabled", k.Enabled) - populate(objectMap, "id", k.ID) - populate(objectMap, "type", k.Type) + populate(objectMap, "columns", q.Columns) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type KpiProperties. -func (k *KpiProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryDatasetConfiguration. +func (q *QueryDatasetConfiguration) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } for key, val := range rawMsg { var err error switch key { - case "enabled": - err = unpopulate(val, "Enabled", &k.Enabled) + case "columns": + err = unpopulate(val, "Columns", &q.Columns) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &k.ID) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QueryDefinition. +func (q QueryDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dataset", q.Dataset) + populate(objectMap, "timePeriod", q.TimePeriod) + populate(objectMap, "timeframe", q.Timeframe) + populate(objectMap, "type", q.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryDefinition. +func (q *QueryDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataset": + err = unpopulate(val, "Dataset", &q.Dataset) + delete(rawMsg, key) + case "timePeriod": + err = unpopulate(val, "TimePeriod", &q.TimePeriod) + delete(rawMsg, key) + case "timeframe": + err = unpopulate(val, "Timeframe", &q.Timeframe) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &k.Type) + err = unpopulate(val, "Type", &q.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Operation. -func (o Operation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type QueryFilter. +func (q QueryFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "display", o.Display) - populate(objectMap, "id", o.ID) - populate(objectMap, "name", o.Name) + populate(objectMap, "and", q.And) + populate(objectMap, "dimensions", q.Dimensions) + populate(objectMap, "or", q.Or) + populate(objectMap, "tags", q.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. -func (o *Operation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryFilter. +func (q *QueryFilter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } for key, val := range rawMsg { var err error switch key { - case "display": - err = unpopulate(val, "Display", &o.Display) + case "and": + err = unpopulate(val, "And", &q.And) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &o.ID) + case "dimensions": + err = unpopulate(val, "Dimensions", &q.Dimensions) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) + case "or": + err = unpopulate(val, "Or", &q.Or) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &q.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. -func (o OperationDisplay) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type QueryGrouping. +func (q QueryGrouping) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", o.Description) - populate(objectMap, "operation", o.Operation) - populate(objectMap, "provider", o.Provider) - populate(objectMap, "resource", o.Resource) + populate(objectMap, "name", q.Name) + populate(objectMap, "type", q.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. -func (o *OperationDisplay) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryGrouping. +func (q *QueryGrouping) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &o.Description) + case "name": + err = unpopulate(val, "Name", &q.Name) delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &o.Operation) + case "type": + err = unpopulate(val, "Type", &q.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QueryProperties. +func (q QueryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "columns", q.Columns) + populate(objectMap, "nextLink", q.NextLink) + populate(objectMap, "rows", q.Rows) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryProperties. +func (q *QueryProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "columns": + err = unpopulate(val, "Columns", &q.Columns) delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) + case "nextLink": + err = unpopulate(val, "NextLink", &q.NextLink) delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) + case "rows": + err = unpopulate(val, "Rows", &q.Rows) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationListResult. -func (o OperationListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type QueryResult. +func (q QueryResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) + populate(objectMap, "eTag", q.ETag) + populate(objectMap, "id", q.ID) + populate(objectMap, "location", q.Location) + populate(objectMap, "name", q.Name) + populate(objectMap, "properties", q.Properties) + populate(objectMap, "sku", q.SKU) + populate(objectMap, "tags", q.Tags) + populate(objectMap, "type", q.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. -func (o *OperationListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryResult. +func (q *QueryResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) + case "eTag": + err = unpopulate(val, "ETag", &q.ETag) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &o.Value) + case "id": + err = unpopulate(val, "ID", &q.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &q.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &q.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &q.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &q.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &q.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &q.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationStatus. -func (o OperationStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type QueryTimePeriod. +func (q QueryTimePeriod) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", o.Properties) - populate(objectMap, "status", o.Status) + populateTimeRFC3339(objectMap, "from", q.From) + populateTimeRFC3339(objectMap, "to", q.To) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatus. -func (o *OperationStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryTimePeriod. +func (q *QueryTimePeriod) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &o.Properties) + case "from": + err = unpopulateTimeRFC3339(val, "From", &q.From) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &o.Status) + case "to": + err = unpopulateTimeRFC3339(val, "To", &q.To) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PivotProperties. -func (p PivotProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecommendationUsageDetails. +func (r RecommendationUsageDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", p.Name) - populate(objectMap, "type", p.Type) + populate(objectMap, "charges", r.Charges) + populate(objectMap, "usageGrain", r.UsageGrain) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PivotProperties. -func (p *PivotProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendationUsageDetails. +func (r *RecommendationUsageDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &p.Name) + case "charges": + err = unpopulate(val, "Charges", &r.Charges) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "usageGrain": + err = unpopulate(val, "UsageGrain", &r.UsageGrain) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProxyResource. -func (p ProxyResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReportConfigAggregation. +func (r ReportConfigAggregation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", p.ETag) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "type", p.Type) + populate(objectMap, "function", r.Function) + populate(objectMap, "name", r.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. -func (p *ProxyResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigAggregation. +func (r *ReportConfigAggregation) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &p.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) + case "function": + err = unpopulate(val, "Function", &r.Function) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type QueryAggregation. -func (q QueryAggregation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReportConfigComparisonExpression. +func (r ReportConfigComparisonExpression) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "function", q.Function) - populate(objectMap, "name", q.Name) + populate(objectMap, "name", r.Name) + populate(objectMap, "operator", r.Operator) + populate(objectMap, "values", r.Values) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type QueryAggregation. -func (q *QueryAggregation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigComparisonExpression. +func (r *ReportConfigComparisonExpression) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "function": - err = unpopulate(val, "Function", &q.Function) - delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &q.Name) + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "operator": + err = unpopulate(val, "Operator", &r.Operator) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &r.Values) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type QueryColumn. -func (q QueryColumn) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReportConfigDataset. +func (r ReportConfigDataset) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", q.Name) - populate(objectMap, "type", q.Type) + populate(objectMap, "aggregation", r.Aggregation) + populate(objectMap, "configuration", r.Configuration) + populate(objectMap, "filter", r.Filter) + populate(objectMap, "granularity", r.Granularity) + populate(objectMap, "grouping", r.Grouping) + populate(objectMap, "sorting", r.Sorting) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type QueryColumn. -func (q *QueryColumn) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigDataset. +func (r *ReportConfigDataset) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &q.Name) + case "aggregation": + err = unpopulate(val, "Aggregation", &r.Aggregation) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &q.Type) + case "configuration": + err = unpopulate(val, "Configuration", &r.Configuration) + delete(rawMsg, key) + case "filter": + err = unpopulate(val, "Filter", &r.Filter) + delete(rawMsg, key) + case "granularity": + err = unpopulate(val, "Granularity", &r.Granularity) + delete(rawMsg, key) + case "grouping": + err = unpopulate(val, "Grouping", &r.Grouping) + delete(rawMsg, key) + case "sorting": + err = unpopulate(val, "Sorting", &r.Sorting) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type QueryComparisonExpression. -func (q QueryComparisonExpression) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReportConfigDatasetConfiguration. +func (r ReportConfigDatasetConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", q.Name) - populate(objectMap, "operator", q.Operator) - populate(objectMap, "values", q.Values) + populate(objectMap, "columns", r.Columns) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type QueryComparisonExpression. -func (q *QueryComparisonExpression) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigDatasetConfiguration. +func (r *ReportConfigDatasetConfiguration) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &q.Name) - delete(rawMsg, key) - case "operator": - err = unpopulate(val, "Operator", &q.Operator) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &q.Values) + case "columns": + err = unpopulate(val, "Columns", &r.Columns) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type QueryDataset. -func (q QueryDataset) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReportConfigDefinition. +func (r ReportConfigDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "aggregation", q.Aggregation) - populate(objectMap, "configuration", q.Configuration) - populate(objectMap, "filter", q.Filter) - populate(objectMap, "granularity", q.Granularity) - populate(objectMap, "grouping", q.Grouping) + populate(objectMap, "dataSet", r.DataSet) + populate(objectMap, "includeMonetaryCommitment", r.IncludeMonetaryCommitment) + populate(objectMap, "timePeriod", r.TimePeriod) + populate(objectMap, "timeframe", r.Timeframe) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type QueryDataset. -func (q *QueryDataset) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigDefinition. +func (r *ReportConfigDefinition) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "aggregation": - err = unpopulate(val, "Aggregation", &q.Aggregation) + case "dataSet": + err = unpopulate(val, "DataSet", &r.DataSet) delete(rawMsg, key) - case "configuration": - err = unpopulate(val, "Configuration", &q.Configuration) + case "includeMonetaryCommitment": + err = unpopulate(val, "IncludeMonetaryCommitment", &r.IncludeMonetaryCommitment) delete(rawMsg, key) - case "filter": - err = unpopulate(val, "Filter", &q.Filter) + case "timePeriod": + err = unpopulate(val, "TimePeriod", &r.TimePeriod) delete(rawMsg, key) - case "granularity": - err = unpopulate(val, "Granularity", &q.Granularity) + case "timeframe": + err = unpopulate(val, "Timeframe", &r.Timeframe) delete(rawMsg, key) - case "grouping": - err = unpopulate(val, "Grouping", &q.Grouping) + case "type": + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type QueryDatasetConfiguration. -func (q QueryDatasetConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReportConfigFilter. +func (r ReportConfigFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "columns", q.Columns) + populate(objectMap, "and", r.And) + populate(objectMap, "dimensions", r.Dimensions) + populate(objectMap, "or", r.Or) + populate(objectMap, "tags", r.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type QueryDatasetConfiguration. -func (q *QueryDatasetConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigFilter. +func (r *ReportConfigFilter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "columns": - err = unpopulate(val, "Columns", &q.Columns) + case "and": + err = unpopulate(val, "And", &r.And) + delete(rawMsg, key) + case "dimensions": + err = unpopulate(val, "Dimensions", &r.Dimensions) + delete(rawMsg, key) + case "or": + err = unpopulate(val, "Or", &r.Or) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type QueryDefinition. -func (q QueryDefinition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReportConfigGrouping. +func (r ReportConfigGrouping) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dataset", q.Dataset) - populate(objectMap, "timePeriod", q.TimePeriod) - populate(objectMap, "timeframe", q.Timeframe) - populate(objectMap, "type", q.Type) + populate(objectMap, "name", r.Name) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type QueryDefinition. -func (q *QueryDefinition) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigGrouping. +func (r *ReportConfigGrouping) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "dataset": - err = unpopulate(val, "Dataset", &q.Dataset) - delete(rawMsg, key) - case "timePeriod": - err = unpopulate(val, "TimePeriod", &q.TimePeriod) - delete(rawMsg, key) - case "timeframe": - err = unpopulate(val, "Timeframe", &q.Timeframe) + case "name": + err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &q.Type) + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type QueryFilter. -func (q QueryFilter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReportConfigSorting. +func (r ReportConfigSorting) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "and", q.And) - populate(objectMap, "dimensions", q.Dimensions) - populate(objectMap, "or", q.Or) - populate(objectMap, "tags", q.Tags) + populate(objectMap, "direction", r.Direction) + populate(objectMap, "name", r.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type QueryFilter. -func (q *QueryFilter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigSorting. +func (r *ReportConfigSorting) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "and": - err = unpopulate(val, "And", &q.And) - delete(rawMsg, key) - case "dimensions": - err = unpopulate(val, "Dimensions", &q.Dimensions) - delete(rawMsg, key) - case "or": - err = unpopulate(val, "Or", &q.Or) + case "direction": + err = unpopulate(val, "Direction", &r.Direction) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &q.Tags) + case "name": + err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type QueryGrouping. -func (q QueryGrouping) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReportConfigTimePeriod. +func (r ReportConfigTimePeriod) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", q.Name) - populate(objectMap, "type", q.Type) + populateTimeRFC3339(objectMap, "from", r.From) + populateTimeRFC3339(objectMap, "to", r.To) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type QueryGrouping. -func (q *QueryGrouping) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigTimePeriod. +func (r *ReportConfigTimePeriod) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &q.Name) + case "from": + err = unpopulateTimeRFC3339(val, "From", &r.From) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &q.Type) + case "to": + err = unpopulateTimeRFC3339(val, "To", &r.To) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type QueryProperties. -func (q QueryProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReportManifest. +func (r ReportManifest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "columns", q.Columns) - populate(objectMap, "nextLink", q.NextLink) - populate(objectMap, "rows", q.Rows) + populate(objectMap, "blobCount", r.BlobCount) + populate(objectMap, "blobs", r.Blobs) + populate(objectMap, "byteCount", r.ByteCount) + populate(objectMap, "compressData", r.CompressData) + populate(objectMap, "dataFormat", r.DataFormat) + populate(objectMap, "manifestVersion", r.ManifestVersion) + populate(objectMap, "requestContext", r.RequestContext) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type QueryProperties. -func (q *QueryProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReportManifest. +func (r *ReportManifest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "columns": - err = unpopulate(val, "Columns", &q.Columns) + case "blobCount": + err = unpopulate(val, "BlobCount", &r.BlobCount) delete(rawMsg, key) - case "nextLink": - err = unpopulate(val, "NextLink", &q.NextLink) + case "blobs": + err = unpopulate(val, "Blobs", &r.Blobs) delete(rawMsg, key) - case "rows": - err = unpopulate(val, "Rows", &q.Rows) + case "byteCount": + err = unpopulate(val, "ByteCount", &r.ByteCount) + delete(rawMsg, key) + case "compressData": + err = unpopulate(val, "CompressData", &r.CompressData) + delete(rawMsg, key) + case "dataFormat": + err = unpopulate(val, "DataFormat", &r.DataFormat) + delete(rawMsg, key) + case "manifestVersion": + err = unpopulate(val, "ManifestVersion", &r.ManifestVersion) + delete(rawMsg, key) + case "requestContext": + err = unpopulate(val, "RequestContext", &r.RequestContext) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type QueryResult. -func (q QueryResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReportURL. +func (r ReportURL) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", q.ETag) - populate(objectMap, "id", q.ID) - populate(objectMap, "location", q.Location) - populate(objectMap, "name", q.Name) - populate(objectMap, "properties", q.Properties) - populate(objectMap, "sku", q.SKU) - populate(objectMap, "tags", q.Tags) - populate(objectMap, "type", q.Type) + populate(objectMap, "reportUrl", r.ReportURL) + populateTimeRFC3339(objectMap, "validUntil", r.ValidUntil) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type QueryResult. -func (q *QueryResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReportURL. +func (r *ReportURL) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &q.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &q.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &q.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &q.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &q.Properties) - delete(rawMsg, key) - case "sku": - err = unpopulate(val, "SKU", &q.SKU) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &q.Tags) + case "reportUrl": + err = unpopulate(val, "ReportURL", &r.ReportURL) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &q.Type) + case "validUntil": + err = unpopulateTimeRFC3339(val, "ValidUntil", &r.ValidUntil) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type QueryTimePeriod. -func (q QueryTimePeriod) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RequestContext. +func (r RequestContext) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "from", q.From) - populateTimeRFC3339(objectMap, "to", q.To) + populate(objectMap, "requestBody", r.RequestBody) + populate(objectMap, "requestScope", r.RequestScope) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type QueryTimePeriod. -func (q *QueryTimePeriod) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RequestContext. +func (r *RequestContext) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "from": - err = unpopulateTimeRFC3339(val, "From", &q.From) + case "requestBody": + err = unpopulate(val, "RequestBody", &r.RequestBody) delete(rawMsg, key) - case "to": - err = unpopulateTimeRFC3339(val, "To", &q.To) + case "requestScope": + err = unpopulate(val, "RequestScope", &r.RequestScope) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ReportConfigAggregation. -func (r ReportConfigAggregation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "function", r.Function) + populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigAggregation. -func (r *ReportConfigAggregation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -2049,12 +3878,15 @@ func (r *ReportConfigAggregation) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "function": - err = unpopulate(val, "Function", &r.Function) + case "id": + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -2063,17 +3895,21 @@ func (r *ReportConfigAggregation) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ReportConfigComparisonExpression. -func (r ReportConfigComparisonExpression) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResourceForCostManagement. +func (r ResourceForCostManagement) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "eTag", r.ETag) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) - populate(objectMap, "operator", r.Operator) - populate(objectMap, "values", r.Values) + populate(objectMap, "sku", r.SKU) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigComparisonExpression. -func (r *ReportConfigComparisonExpression) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceForCostManagement. +func (r *ResourceForCostManagement) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -2081,14 +3917,26 @@ func (r *ReportConfigComparisonExpression) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "eTag": + err = unpopulate(val, "ETag", &r.ETag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) - case "operator": - err = unpopulate(val, "Operator", &r.Operator) + case "sku": + err = unpopulate(val, "SKU", &r.SKU) delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &r.Values) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { @@ -2098,332 +3946,492 @@ func (r *ReportConfigComparisonExpression) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ReportConfigDataset. -func (r ReportConfigDataset) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SavingsPlanUtilizationSummary. +func (s SavingsPlanUtilizationSummary) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "aggregation", r.Aggregation) - populate(objectMap, "configuration", r.Configuration) - populate(objectMap, "filter", r.Filter) - populate(objectMap, "granularity", r.Granularity) - populate(objectMap, "grouping", r.Grouping) - populate(objectMap, "sorting", r.Sorting) + populate(objectMap, "id", s.ID) + objectMap["kind"] = BenefitKindSavingsPlan + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigDataset. -func (r *ReportConfigDataset) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SavingsPlanUtilizationSummary. +func (s *SavingsPlanUtilizationSummary) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "aggregation": - err = unpopulate(val, "Aggregation", &r.Aggregation) - delete(rawMsg, key) - case "configuration": - err = unpopulate(val, "Configuration", &r.Configuration) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "filter": - err = unpopulate(val, "Filter", &r.Filter) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) delete(rawMsg, key) - case "granularity": - err = unpopulate(val, "Granularity", &r.Granularity) + case "name": + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "grouping": - err = unpopulate(val, "Grouping", &r.Grouping) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) - case "sorting": - err = unpopulate(val, "Sorting", &r.Sorting) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ReportConfigDatasetConfiguration. -func (r ReportConfigDatasetConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SavingsPlanUtilizationSummaryProperties. +func (s SavingsPlanUtilizationSummaryProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "columns", r.Columns) + populate(objectMap, "armSkuName", s.ArmSKUName) + populate(objectMap, "avgUtilizationPercentage", s.AvgUtilizationPercentage) + populate(objectMap, "benefitId", s.BenefitID) + populate(objectMap, "benefitOrderId", s.BenefitOrderID) + populate(objectMap, "benefitType", s.BenefitType) + populate(objectMap, "maxUtilizationPercentage", s.MaxUtilizationPercentage) + populate(objectMap, "minUtilizationPercentage", s.MinUtilizationPercentage) + populateTimeRFC3339(objectMap, "usageDate", s.UsageDate) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigDatasetConfiguration. -func (r *ReportConfigDatasetConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SavingsPlanUtilizationSummaryProperties. +func (s *SavingsPlanUtilizationSummaryProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "columns": - err = unpopulate(val, "Columns", &r.Columns) + case "armSkuName": + err = unpopulate(val, "ArmSKUName", &s.ArmSKUName) + delete(rawMsg, key) + case "avgUtilizationPercentage": + err = unpopulate(val, "AvgUtilizationPercentage", &s.AvgUtilizationPercentage) + delete(rawMsg, key) + case "benefitId": + err = unpopulate(val, "BenefitID", &s.BenefitID) + delete(rawMsg, key) + case "benefitOrderId": + err = unpopulate(val, "BenefitOrderID", &s.BenefitOrderID) + delete(rawMsg, key) + case "benefitType": + err = unpopulate(val, "BenefitType", &s.BenefitType) + delete(rawMsg, key) + case "maxUtilizationPercentage": + err = unpopulate(val, "MaxUtilizationPercentage", &s.MaxUtilizationPercentage) + delete(rawMsg, key) + case "minUtilizationPercentage": + err = unpopulate(val, "MinUtilizationPercentage", &s.MinUtilizationPercentage) + delete(rawMsg, key) + case "usageDate": + err = unpopulateTimeRFC3339(val, "UsageDate", &s.UsageDate) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ReportConfigDefinition. -func (r ReportConfigDefinition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ScheduleProperties. +func (s ScheduleProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dataSet", r.DataSet) - populate(objectMap, "includeMonetaryCommitment", r.IncludeMonetaryCommitment) - populate(objectMap, "timePeriod", r.TimePeriod) - populate(objectMap, "timeframe", r.Timeframe) - populate(objectMap, "type", r.Type) + populate(objectMap, "dayOfMonth", s.DayOfMonth) + populate(objectMap, "daysOfWeek", s.DaysOfWeek) + populateTimeRFC3339(objectMap, "endDate", s.EndDate) + populate(objectMap, "frequency", s.Frequency) + populate(objectMap, "hourOfDay", s.HourOfDay) + populateTimeRFC3339(objectMap, "startDate", s.StartDate) + populate(objectMap, "weeksOfMonth", s.WeeksOfMonth) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigDefinition. -func (r *ReportConfigDefinition) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduleProperties. +func (s *ScheduleProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "dataSet": - err = unpopulate(val, "DataSet", &r.DataSet) + case "dayOfMonth": + err = unpopulate(val, "DayOfMonth", &s.DayOfMonth) delete(rawMsg, key) - case "includeMonetaryCommitment": - err = unpopulate(val, "IncludeMonetaryCommitment", &r.IncludeMonetaryCommitment) + case "daysOfWeek": + err = unpopulate(val, "DaysOfWeek", &s.DaysOfWeek) delete(rawMsg, key) - case "timePeriod": - err = unpopulate(val, "TimePeriod", &r.TimePeriod) + case "endDate": + err = unpopulateTimeRFC3339(val, "EndDate", &s.EndDate) delete(rawMsg, key) - case "timeframe": - err = unpopulate(val, "Timeframe", &r.Timeframe) + case "frequency": + err = unpopulate(val, "Frequency", &s.Frequency) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "hourOfDay": + err = unpopulate(val, "HourOfDay", &s.HourOfDay) + delete(rawMsg, key) + case "startDate": + err = unpopulateTimeRFC3339(val, "StartDate", &s.StartDate) + delete(rawMsg, key) + case "weeksOfMonth": + err = unpopulate(val, "WeeksOfMonth", &s.WeeksOfMonth) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ReportConfigFilter. -func (r ReportConfigFilter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ScheduledAction. +func (s ScheduledAction) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "and", r.And) - populate(objectMap, "dimensions", r.Dimensions) - populate(objectMap, "or", r.Or) - populate(objectMap, "tags", r.Tags) + populate(objectMap, "eTag", s.ETag) + populate(objectMap, "id", s.ID) + populate(objectMap, "kind", s.Kind) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigFilter. -func (r *ReportConfigFilter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledAction. +func (s *ScheduledAction) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "and": - err = unpopulate(val, "And", &r.And) + case "eTag": + err = unpopulate(val, "ETag", &s.ETag) delete(rawMsg, key) - case "dimensions": - err = unpopulate(val, "Dimensions", &r.Dimensions) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "or": - err = unpopulate(val, "Or", &r.Or) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ReportConfigGrouping. -func (r ReportConfigGrouping) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ScheduledActionListResult. +func (s ScheduledActionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", r.Name) - populate(objectMap, "type", r.Type) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigGrouping. -func (r *ReportConfigGrouping) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledActionListResult. +func (s *ScheduledActionListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &r.Name) + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "value": + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ReportConfigSorting. -func (r ReportConfigSorting) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ScheduledActionProperties. +func (s ScheduledActionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "direction", r.Direction) - populate(objectMap, "name", r.Name) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "fileDestination", s.FileDestination) + populate(objectMap, "notification", s.Notification) + populate(objectMap, "notificationEmail", s.NotificationEmail) + populate(objectMap, "schedule", s.Schedule) + populate(objectMap, "scope", s.Scope) + populate(objectMap, "status", s.Status) + populate(objectMap, "viewId", s.ViewID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigSorting. -func (r *ReportConfigSorting) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledActionProperties. +func (s *ScheduledActionProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "direction": - err = unpopulate(val, "Direction", &r.Direction) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) + case "fileDestination": + err = unpopulate(val, "FileDestination", &s.FileDestination) + delete(rawMsg, key) + case "notification": + err = unpopulate(val, "Notification", &s.Notification) + delete(rawMsg, key) + case "notificationEmail": + err = unpopulate(val, "NotificationEmail", &s.NotificationEmail) + delete(rawMsg, key) + case "schedule": + err = unpopulate(val, "Schedule", &s.Schedule) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &s.Scope) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + case "viewId": + err = unpopulate(val, "ViewID", &s.ViewID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ReportConfigTimePeriod. -func (r ReportConfigTimePeriod) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ScheduledActionProxyResource. +func (s ScheduledActionProxyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "from", r.From) - populateTimeRFC3339(objectMap, "to", r.To) + populate(objectMap, "eTag", s.ETag) + populate(objectMap, "id", s.ID) + populate(objectMap, "kind", s.Kind) + populate(objectMap, "name", s.Name) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigTimePeriod. -func (r *ReportConfigTimePeriod) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledActionProxyResource. +func (s *ScheduledActionProxyResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "from": - err = unpopulateTimeRFC3339(val, "From", &r.From) + case "eTag": + err = unpopulate(val, "ETag", &s.ETag) delete(rawMsg, key) - case "to": - err = unpopulateTimeRFC3339(val, "To", &r.To) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ReportURL. -func (r ReportURL) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SharedScopeBenefitRecommendationProperties. +func (s SharedScopeBenefitRecommendationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "reportUrl", r.ReportURL) - populateTimeRFC3339(objectMap, "validUntil", r.ValidUntil) + populate(objectMap, "allRecommendationDetails", s.AllRecommendationDetails) + populate(objectMap, "armSkuName", s.ArmSKUName) + populate(objectMap, "commitmentGranularity", s.CommitmentGranularity) + populate(objectMap, "costWithoutBenefit", s.CostWithoutBenefit) + populate(objectMap, "currencyCode", s.CurrencyCode) + populateTimeRFC3339(objectMap, "firstConsumptionDate", s.FirstConsumptionDate) + populateTimeRFC3339(objectMap, "lastConsumptionDate", s.LastConsumptionDate) + populate(objectMap, "lookBackPeriod", s.LookBackPeriod) + populate(objectMap, "recommendationDetails", s.RecommendationDetails) + objectMap["scope"] = ScopeShared + populate(objectMap, "term", s.Term) + populate(objectMap, "totalHours", s.TotalHours) + populate(objectMap, "usage", s.Usage) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReportURL. -func (r *ReportURL) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SharedScopeBenefitRecommendationProperties. +func (s *SharedScopeBenefitRecommendationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "reportUrl": - err = unpopulate(val, "ReportURL", &r.ReportURL) + case "allRecommendationDetails": + err = unpopulate(val, "AllRecommendationDetails", &s.AllRecommendationDetails) delete(rawMsg, key) - case "validUntil": - err = unpopulateTimeRFC3339(val, "ValidUntil", &r.ValidUntil) + case "armSkuName": + err = unpopulate(val, "ArmSKUName", &s.ArmSKUName) + delete(rawMsg, key) + case "commitmentGranularity": + err = unpopulate(val, "CommitmentGranularity", &s.CommitmentGranularity) + delete(rawMsg, key) + case "costWithoutBenefit": + err = unpopulate(val, "CostWithoutBenefit", &s.CostWithoutBenefit) + delete(rawMsg, key) + case "currencyCode": + err = unpopulate(val, "CurrencyCode", &s.CurrencyCode) + delete(rawMsg, key) + case "firstConsumptionDate": + err = unpopulateTimeRFC3339(val, "FirstConsumptionDate", &s.FirstConsumptionDate) + delete(rawMsg, key) + case "lastConsumptionDate": + err = unpopulateTimeRFC3339(val, "LastConsumptionDate", &s.LastConsumptionDate) + delete(rawMsg, key) + case "lookBackPeriod": + err = unpopulate(val, "LookBackPeriod", &s.LookBackPeriod) + delete(rawMsg, key) + case "recommendationDetails": + err = unpopulate(val, "RecommendationDetails", &s.RecommendationDetails) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &s.Scope) + delete(rawMsg, key) + case "term": + err = unpopulate(val, "Term", &s.Term) + delete(rawMsg, key) + case "totalHours": + err = unpopulate(val, "TotalHours", &s.TotalHours) + delete(rawMsg, key) + case "usage": + err = unpopulate(val, "Usage", &s.Usage) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SingleScopeBenefitRecommendationProperties. +func (s SingleScopeBenefitRecommendationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", r.ETag) - populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "sku", r.SKU) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) + populate(objectMap, "allRecommendationDetails", s.AllRecommendationDetails) + populate(objectMap, "armSkuName", s.ArmSKUName) + populate(objectMap, "commitmentGranularity", s.CommitmentGranularity) + populate(objectMap, "costWithoutBenefit", s.CostWithoutBenefit) + populate(objectMap, "currencyCode", s.CurrencyCode) + populateTimeRFC3339(objectMap, "firstConsumptionDate", s.FirstConsumptionDate) + populateTimeRFC3339(objectMap, "lastConsumptionDate", s.LastConsumptionDate) + populate(objectMap, "lookBackPeriod", s.LookBackPeriod) + populate(objectMap, "recommendationDetails", s.RecommendationDetails) + populate(objectMap, "resourceGroup", s.ResourceGroup) + objectMap["scope"] = ScopeSingle + populate(objectMap, "subscriptionId", s.SubscriptionID) + populate(objectMap, "term", s.Term) + populate(objectMap, "totalHours", s.TotalHours) + populate(objectMap, "usage", s.Usage) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. -func (r *Resource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SingleScopeBenefitRecommendationProperties. +func (s *SingleScopeBenefitRecommendationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &r.ETag) + case "allRecommendationDetails": + err = unpopulate(val, "AllRecommendationDetails", &s.AllRecommendationDetails) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &r.ID) + case "armSkuName": + err = unpopulate(val, "ArmSKUName", &s.ArmSKUName) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) + case "commitmentGranularity": + err = unpopulate(val, "CommitmentGranularity", &s.CommitmentGranularity) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) + case "costWithoutBenefit": + err = unpopulate(val, "CostWithoutBenefit", &s.CostWithoutBenefit) delete(rawMsg, key) - case "sku": - err = unpopulate(val, "SKU", &r.SKU) + case "currencyCode": + err = unpopulate(val, "CurrencyCode", &s.CurrencyCode) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) + case "firstConsumptionDate": + err = unpopulateTimeRFC3339(val, "FirstConsumptionDate", &s.FirstConsumptionDate) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "lastConsumptionDate": + err = unpopulateTimeRFC3339(val, "LastConsumptionDate", &s.LastConsumptionDate) + delete(rawMsg, key) + case "lookBackPeriod": + err = unpopulate(val, "LookBackPeriod", &s.LookBackPeriod) + delete(rawMsg, key) + case "recommendationDetails": + err = unpopulate(val, "RecommendationDetails", &s.RecommendationDetails) + delete(rawMsg, key) + case "resourceGroup": + err = unpopulate(val, "ResourceGroup", &s.ResourceGroup) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &s.Scope) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &s.SubscriptionID) + delete(rawMsg, key) + case "term": + err = unpopulate(val, "Term", &s.Term) + delete(rawMsg, key) + case "totalHours": + err = unpopulate(val, "TotalHours", &s.TotalHours) + delete(rawMsg, key) + case "usage": + err = unpopulate(val, "Usage", &s.Usage) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil @@ -2456,6 +4464,53 @@ func (s *Status) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type View. func (v View) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/operations_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/operations_client.go index dc9572730268..d244615015ad 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/operations_client.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/operations_client.go @@ -40,7 +40,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available cost management REST API operations. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -78,7 +78,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/operations_client_example_test.go b/sdk/resourcemanager/costmanagement/armcostmanagement/operations_client_example_test.go deleted file mode 100644 index ab9ae62580d0..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/operations_client_example_test.go +++ /dev/null @@ -1,146 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcostmanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/OperationList.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armcostmanagement.OperationListResult{ - // Value: []*armcostmanagement.Operation{ - // { - // Name: to.Ptr("Microsoft.CostManagement/budgets/read"), - // Display: &armcostmanagement.OperationDisplay{ - // Description: to.Ptr("List the budgets by a subscription or a management group."), - // Operation: to.Ptr("List budgets"), - // Provider: to.Ptr("Microsoft.CostManagement"), - // Resource: to.Ptr("Budgets"), - // }, - // ID: to.Ptr("Microsoft.CostManagement/budgets/read"), - // }, - // { - // Name: to.Ptr("Microsoft.CostManagement/query/action"), - // Display: &armcostmanagement.OperationDisplay{ - // Description: to.Ptr("Query usage data by a scope."), - // Operation: to.Ptr("Query usage data"), - // Provider: to.Ptr("Microsoft.CostManagement"), - // Resource: to.Ptr("Query"), - // }, - // ID: to.Ptr("Microsoft.CostManagement/query/action"), - // }, - // { - // Name: to.Ptr("Microsoft.CostManagement/exports/read"), - // Display: &armcostmanagement.OperationDisplay{ - // Description: to.Ptr("List the exports by scope."), - // Operation: to.Ptr("List exports"), - // Provider: to.Ptr("Microsoft.CostManagement"), - // Resource: to.Ptr("Exports"), - // }, - // ID: to.Ptr("Microsoft.CostManagement/exports/read"), - // }, - // { - // Name: to.Ptr("Microsoft.CostManagement/exports/write"), - // Display: &armcostmanagement.OperationDisplay{ - // Description: to.Ptr("Create or update the specified export."), - // Operation: to.Ptr("Create and update export"), - // Provider: to.Ptr("Microsoft.CostManagement"), - // Resource: to.Ptr("Exports"), - // }, - // ID: to.Ptr("Microsoft.CostManagement/exports/write"), - // }, - // { - // Name: to.Ptr("Microsoft.CostManagement/exports/action"), - // Display: &armcostmanagement.OperationDisplay{ - // Description: to.Ptr("Run the specified export."), - // Operation: to.Ptr("Run export"), - // Provider: to.Ptr("Microsoft.CostManagement"), - // Resource: to.Ptr("Exports"), - // }, - // ID: to.Ptr("Microsoft.CostManagement/exports/action"), - // }, - // { - // Name: to.Ptr("Microsoft.CostManagement/exports/run/action"), - // Display: &armcostmanagement.OperationDisplay{ - // Description: to.Ptr("Run exports."), - // Operation: to.Ptr("Run exports"), - // Provider: to.Ptr("Microsoft.CostManagement"), - // Resource: to.Ptr("exports/run"), - // }, - // ID: to.Ptr("Microsoft.CostManagement/exports/run/action"), - // }, - // { - // Name: to.Ptr("Microsoft.CostManagement/alerts/read"), - // Display: &armcostmanagement.OperationDisplay{ - // Description: to.Ptr("List alerts."), - // Operation: to.Ptr("List Alerts"), - // Provider: to.Ptr("Microsoft.CostManagement"), - // Resource: to.Ptr("Alerts"), - // }, - // ID: to.Ptr("Microsoft.CostManagement/alerts/read"), - // }, - // { - // Name: to.Ptr("Microsoft.CostManagement/operations/read"), - // Display: &armcostmanagement.OperationDisplay{ - // Description: to.Ptr("List all supported operations by Microsoft.CostManagement resource provider."), - // Operation: to.Ptr("List supported operations"), - // Provider: to.Ptr("Microsoft.CostManagement"), - // Resource: to.Ptr("Operations"), - // }, - // ID: to.Ptr("Microsoft.CostManagement/operations/read"), - // }, - // { - // Name: to.Ptr("Microsoft.CostManagement/views/action"), - // Display: &armcostmanagement.OperationDisplay{ - // Description: to.Ptr("Create view."), - // Operation: to.Ptr("Create views"), - // Provider: to.Ptr("Microsoft.CostManagement"), - // Resource: to.Ptr("Views"), - // }, - // ID: to.Ptr("Microsoft.CostManagement/views/action"), - // }, - // { - // Name: to.Ptr("Microsoft.CostManagement/views/write"), - // Display: &armcostmanagement.OperationDisplay{ - // Description: to.Ptr("Update view."), - // Operation: to.Ptr("Update views"), - // Provider: to.Ptr("Microsoft.CostManagement"), - // Resource: to.Ptr("Views"), - // }, - // ID: to.Ptr("Microsoft.CostManagement/views/write"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/polymorphic_helpers.go b/sdk/resourcemanager/costmanagement/armcostmanagement/polymorphic_helpers.go new file mode 100644 index 000000000000..e0e6de74ae32 --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/polymorphic_helpers.go @@ -0,0 +1,71 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcostmanagement + +import "encoding/json" + +func unmarshalBenefitRecommendationPropertiesClassification(rawMsg json.RawMessage) (BenefitRecommendationPropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b BenefitRecommendationPropertiesClassification + switch m["scope"] { + case string(ScopeShared): + b = &SharedScopeBenefitRecommendationProperties{} + case string(ScopeSingle): + b = &SingleScopeBenefitRecommendationProperties{} + default: + b = &BenefitRecommendationProperties{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalBenefitUtilizationSummaryClassification(rawMsg json.RawMessage) (BenefitUtilizationSummaryClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b BenefitUtilizationSummaryClassification + switch m["kind"] { + case string(BenefitKindIncludedQuantity): + b = &IncludedQuantityUtilizationSummary{} + case string(BenefitKindSavingsPlan): + b = &SavingsPlanUtilizationSummary{} + default: + b = &BenefitUtilizationSummary{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalBenefitUtilizationSummaryClassificationArray(rawMsg json.RawMessage) ([]BenefitUtilizationSummaryClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]BenefitUtilizationSummaryClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalBenefitUtilizationSummaryClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/pricesheet_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/pricesheet_client.go new file mode 100644 index 000000000000..08a24fda6f7c --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/pricesheet_client.go @@ -0,0 +1,183 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcostmanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PriceSheetClient contains the methods for the PriceSheet group. +// Don't use this type directly, use NewPriceSheetClient() instead. +type PriceSheetClient struct { + internal *arm.Client +} + +// NewPriceSheetClient creates a new instance of PriceSheetClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPriceSheetClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*PriceSheetClient, error) { + cl, err := arm.NewClient(moduleName+".PriceSheetClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PriceSheetClient{ + internal: cl, + } + return client, nil +} + +// BeginDownload - Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with +// agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - billingAccountName - The ID that uniquely identifies a billing account. +// - billingProfileName - The ID that uniquely identifies a billing profile. +// - invoiceName - The ID that uniquely identifies an invoice. +// - options - PriceSheetClientBeginDownloadOptions contains the optional parameters for the PriceSheetClient.BeginDownload +// method. +func (client *PriceSheetClient) BeginDownload(ctx context.Context, billingAccountName string, billingProfileName string, invoiceName string, options *PriceSheetClientBeginDownloadOptions) (*runtime.Poller[PriceSheetClientDownloadResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.download(ctx, billingAccountName, billingProfileName, invoiceName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PriceSheetClientDownloadResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[PriceSheetClientDownloadResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Download - Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement +// type Microsoft Partner Agreement or Microsoft Customer Agreement. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +func (client *PriceSheetClient) download(ctx context.Context, billingAccountName string, billingProfileName string, invoiceName string, options *PriceSheetClientBeginDownloadOptions) (*http.Response, error) { + req, err := client.downloadCreateRequest(ctx, billingAccountName, billingProfileName, invoiceName, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// downloadCreateRequest creates the Download request. +func (client *PriceSheetClient) downloadCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceName string, options *PriceSheetClientBeginDownloadOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download" + if billingAccountName == "" { + return nil, errors.New("parameter billingAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{billingAccountName}", url.PathEscape(billingAccountName)) + if billingProfileName == "" { + return nil, errors.New("parameter billingProfileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{billingProfileName}", url.PathEscape(billingProfileName)) + if invoiceName == "" { + return nil, errors.New("parameter invoiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{invoiceName}", url.PathEscape(invoiceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginDownloadByBillingProfile - Gets a URL to download the current month's pricesheet for a billing profile. The operation +// is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer +// Agreement.Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated +// from a single csv file to a Zip file containing multiple csv files, each with +// max 200k records. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - billingAccountName - The ID that uniquely identifies a billing account. +// - billingProfileName - The ID that uniquely identifies a billing profile. +// - options - PriceSheetClientBeginDownloadByBillingProfileOptions contains the optional parameters for the PriceSheetClient.BeginDownloadByBillingProfile +// method. +func (client *PriceSheetClient) BeginDownloadByBillingProfile(ctx context.Context, billingAccountName string, billingProfileName string, options *PriceSheetClientBeginDownloadByBillingProfileOptions) (*runtime.Poller[PriceSheetClientDownloadByBillingProfileResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.downloadByBillingProfile(ctx, billingAccountName, billingProfileName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PriceSheetClientDownloadByBillingProfileResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[PriceSheetClientDownloadByBillingProfileResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// DownloadByBillingProfile - Gets a URL to download the current month's pricesheet for a billing profile. The operation is +// supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer +// Agreement.Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated +// from a single csv file to a Zip file containing multiple csv files, each with +// max 200k records. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +func (client *PriceSheetClient) downloadByBillingProfile(ctx context.Context, billingAccountName string, billingProfileName string, options *PriceSheetClientBeginDownloadByBillingProfileOptions) (*http.Response, error) { + req, err := client.downloadByBillingProfileCreateRequest(ctx, billingAccountName, billingProfileName, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// downloadByBillingProfileCreateRequest creates the DownloadByBillingProfile request. +func (client *PriceSheetClient) downloadByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, options *PriceSheetClientBeginDownloadByBillingProfileOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download" + if billingAccountName == "" { + return nil, errors.New("parameter billingAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{billingAccountName}", url.PathEscape(billingAccountName)) + if billingProfileName == "" { + return nil, errors.New("parameter billingProfileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{billingProfileName}", url.PathEscape(billingProfileName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/query_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/query_client.go index fcce0881a833..8061439f782f 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/query_client.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/query_client.go @@ -44,7 +44,7 @@ func NewQueryClient(credential azcore.TokenCredential, options *arm.ClientOption // Usage - Query the usage data for scope defined. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - scope - The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription // scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for // resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and @@ -81,7 +81,7 @@ func (client *QueryClient) usageCreateRequest(ctx context.Context, scope string, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -99,7 +99,7 @@ func (client *QueryClient) usageHandleResponse(resp *http.Response) (QueryClient // UsageByExternalCloudProviderType - Query the usage data for external cloud provider type defined. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - externalCloudProviderType - The external cloud provider type associated with dimension/query operations. This includes // 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. // - externalCloudProviderID - This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for @@ -138,7 +138,7 @@ func (client *QueryClient) usageByExternalCloudProviderTypeCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/query_client_example_test.go b/sdk/resourcemanager/costmanagement/armcostmanagement/query_client_example_test.go deleted file mode 100644 index 9f528ad33236..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/query_client_example_test.go +++ /dev/null @@ -1,1934 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcostmanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingAccountQuery.json -func ExampleQueryClient_Usage_billingAccountQueryLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/70664866", armcostmanagement.QueryDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeUsage), - Dataset: &armcostmanagement.QueryDataset{ - Filter: &armcostmanagement.QueryFilter{ - And: []*armcostmanagement.QueryFilter{ - { - Or: []*armcostmanagement.QueryFilter{ - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceLocation"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("East US"), - to.Ptr("West Europe")}, - }, - }, - { - Tags: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("Environment"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("UAT"), - to.Ptr("Prod")}, - }, - }}, - }, - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceGroup"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("API")}, - }, - }}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/70664866/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("ResourceGroup"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("UsageDate"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(19.545363672276512), - // "JapanUnifia-Trial", - // float64(20180331), - // "USD"}, - // []any{ - // float64(173.41979241290323), - // "RVIIOT-TRIAL", - // float64(20180331), - // "USD"}, - // []any{ - // float64(20.35941656262545), - // "VSTSHOL-1595322048000", - // float64(20180331), - // "USD"}, - // []any{ - // float64(0.16677720329728665), - // "gs-stms-dev", - // float64(20180331), - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCABillingAccountQuery.json -func ExampleQueryClient_Usage_billingAccountQueryModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789", armcostmanagement.QueryDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeUsage), - Dataset: &armcostmanagement.QueryDataset{ - Filter: &armcostmanagement.QueryFilter{ - And: []*armcostmanagement.QueryFilter{ - { - Or: []*armcostmanagement.QueryFilter{ - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceLocation"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("East US"), - to.Ptr("West Europe")}, - }, - }, - { - Tags: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("Environment"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("UAT"), - to.Ptr("Prod")}, - }, - }}, - }, - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceGroup"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("API")}, - }, - }}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("ResourceGroup"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("UsageDate"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(19.545363672276512), - // "JapanUnifia-Trial", - // float64(20180331), - // "USD"}, - // []any{ - // float64(173.41979241290323), - // "RVIIOT-TRIAL", - // float64(20180331), - // "USD"}, - // []any{ - // float64(20.35941656262545), - // "VSTSHOL-1595322048000", - // float64(20180331), - // "USD"}, - // []any{ - // float64(0.16677720329728665), - // "gs-stms-dev", - // float64(20180331), - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingAccountQueryGrouping.json -func ExampleQueryClient_Usage_billingAccountQueryGroupingLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/70664866", armcostmanagement.QueryDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeUsage), - Dataset: &armcostmanagement.QueryDataset{ - Aggregation: map[string]*armcostmanagement.QueryAggregation{ - "totalCost": { - Name: to.Ptr("PreTaxCost"), - Function: to.Ptr(armcostmanagement.FunctionTypeSum), - }, - }, - Granularity: to.Ptr(armcostmanagement.GranularityType("None")), - Grouping: []*armcostmanagement.QueryGrouping{ - { - Name: to.Ptr("ResourceGroup"), - Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension), - }}, - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/70664866/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("ResourceGroup"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(19.545363672276512), - // "JapanUnifia-Trial", - // "USD"}, - // []any{ - // float64(173.41979241290323), - // "RVIIOT-TRIAL", - // "USD"}, - // []any{ - // float64(20.35941656262545), - // "VSTSHOL-1595322048000", - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCABillingAccountQueryGrouping.json -func ExampleQueryClient_Usage_billingAccountQueryGroupingModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789", armcostmanagement.QueryDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeUsage), - Dataset: &armcostmanagement.QueryDataset{ - Aggregation: map[string]*armcostmanagement.QueryAggregation{ - "totalCost": { - Name: to.Ptr("PreTaxCost"), - Function: to.Ptr(armcostmanagement.FunctionTypeSum), - }, - }, - Granularity: to.Ptr(armcostmanagement.GranularityType("None")), - Grouping: []*armcostmanagement.QueryGrouping{ - { - Name: to.Ptr("ResourceGroup"), - Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension), - }}, - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("ResourceGroup"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(19.545363672276512), - // "JapanUnifia-Trial", - // "USD"}, - // []any{ - // float64(173.41979241290323), - // "RVIIOT-TRIAL", - // "USD"}, - // []any{ - // float64(20.35941656262545), - // "VSTSHOL-1595322048000", - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCABillingProfileQuery.json -func ExampleQueryClient_Usage_billingProfileQueryModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", armcostmanagement.QueryDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeUsage), - Dataset: &armcostmanagement.QueryDataset{ - Filter: &armcostmanagement.QueryFilter{ - And: []*armcostmanagement.QueryFilter{ - { - Or: []*armcostmanagement.QueryFilter{ - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceLocation"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("East US"), - to.Ptr("West Europe")}, - }, - }, - { - Tags: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("Environment"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("UAT"), - to.Ptr("Prod")}, - }, - }}, - }, - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceGroup"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("API")}, - }, - }}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("ResourceGroup"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("UsageDate"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(19.545363672276512), - // "JapanUnifia-Trial", - // float64(20180331), - // "USD"}, - // []any{ - // float64(173.41979241290323), - // "RVIIOT-TRIAL", - // float64(20180331), - // "USD"}, - // []any{ - // float64(20.35941656262545), - // "VSTSHOL-1595322048000", - // float64(20180331), - // "USD"}, - // []any{ - // float64(0.16677720329728665), - // "gs-stms-dev", - // float64(20180331), - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCABillingProfileQueryGrouping.json -func ExampleQueryClient_Usage_billingProfileQueryGroupingModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", armcostmanagement.QueryDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeUsage), - Dataset: &armcostmanagement.QueryDataset{ - Aggregation: map[string]*armcostmanagement.QueryAggregation{ - "totalCost": { - Name: to.Ptr("PreTaxCost"), - Function: to.Ptr(armcostmanagement.FunctionTypeSum), - }, - }, - Granularity: to.Ptr(armcostmanagement.GranularityType("None")), - Grouping: []*armcostmanagement.QueryGrouping{ - { - Name: to.Ptr("ResourceGroup"), - Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension), - }}, - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("ResourceGroup"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(19.545363672276512), - // "JapanUnifia-Trial", - // "USD"}, - // []any{ - // float64(173.41979241290323), - // "RVIIOT-TRIAL", - // "USD"}, - // []any{ - // float64(20.35941656262545), - // "VSTSHOL-1595322048000", - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCACustomerQuery.json -func ExampleQueryClient_Usage_customerQueryModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", armcostmanagement.QueryDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeUsage), - Dataset: &armcostmanagement.QueryDataset{ - Filter: &armcostmanagement.QueryFilter{ - And: []*armcostmanagement.QueryFilter{ - { - Or: []*armcostmanagement.QueryFilter{ - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceLocation"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("East US"), - to.Ptr("West Europe")}, - }, - }, - { - Tags: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("Environment"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("UAT"), - to.Ptr("Prod")}, - }, - }}, - }, - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceGroup"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("API")}, - }, - }}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("ResourceGroup"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("UsageDate"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(19.545363672276512), - // "JapanUnifia-Trial", - // float64(20180331), - // "USD"}, - // []any{ - // float64(173.41979241290323), - // "RVIIOT-TRIAL", - // float64(20180331), - // "USD"}, - // []any{ - // float64(20.35941656262545), - // "VSTSHOL-1595322048000", - // float64(20180331), - // "USD"}, - // []any{ - // float64(0.16677720329728665), - // "gs-stms-dev", - // float64(20180331), - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCACustomerQueryGrouping.json -func ExampleQueryClient_Usage_customerQueryGroupingModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", armcostmanagement.QueryDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeUsage), - Dataset: &armcostmanagement.QueryDataset{ - Aggregation: map[string]*armcostmanagement.QueryAggregation{ - "totalCost": { - Name: to.Ptr("PreTaxCost"), - Function: to.Ptr(armcostmanagement.FunctionTypeSum), - }, - }, - Granularity: to.Ptr(armcostmanagement.GranularityType("None")), - Grouping: []*armcostmanagement.QueryGrouping{ - { - Name: to.Ptr("ResourceGroup"), - Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension), - }}, - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("ResourceGroup"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(19.545363672276512), - // "JapanUnifia-Trial", - // "USD"}, - // []any{ - // float64(173.41979241290323), - // "RVIIOT-TRIAL", - // "USD"}, - // []any{ - // float64(20.35941656262545), - // "VSTSHOL-1595322048000", - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/DepartmentQuery.json -func ExampleQueryClient_Usage_departmentQueryLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/100/departments/123", armcostmanagement.QueryDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeUsage), - Dataset: &armcostmanagement.QueryDataset{ - Filter: &armcostmanagement.QueryFilter{ - And: []*armcostmanagement.QueryFilter{ - { - Or: []*armcostmanagement.QueryFilter{ - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceLocation"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("East US"), - to.Ptr("West Europe")}, - }, - }, - { - Tags: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("Environment"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("UAT"), - to.Ptr("Prod")}, - }, - }}, - }, - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceGroup"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("API")}, - }, - }}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/70664866/departments/123/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("ResourceGroup"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("UsageDate"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(19.545363672276512), - // "JapanUnifia-Trial", - // float64(20180331), - // "USD"}, - // []any{ - // float64(173.41979241290323), - // "RVIIOT-TRIAL", - // float64(20180331), - // "USD"}, - // []any{ - // float64(20.35941656262545), - // "VSTSHOL-1595322048000", - // float64(20180331), - // "USD"}, - // []any{ - // float64(0.16677720329728665), - // "gs-stms-dev", - // float64(20180331), - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/DepartmentQueryGrouping.json -func ExampleQueryClient_Usage_departmentQueryGroupingLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/100/departments/123", armcostmanagement.QueryDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeUsage), - Dataset: &armcostmanagement.QueryDataset{ - Aggregation: map[string]*armcostmanagement.QueryAggregation{ - "totalCost": { - Name: to.Ptr("PreTaxCost"), - Function: to.Ptr(armcostmanagement.FunctionTypeSum), - }, - }, - Granularity: to.Ptr(armcostmanagement.GranularityType("None")), - Grouping: []*armcostmanagement.QueryGrouping{ - { - Name: to.Ptr("ResourceGroup"), - Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension), - }}, - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/70664866/departments/123/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("ResourceGroup"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(19.545363672276512), - // "JapanUnifia-Trial", - // "USD"}, - // []any{ - // float64(173.41979241290323), - // "RVIIOT-TRIAL", - // "USD"}, - // []any{ - // float64(20.35941656262545), - // "VSTSHOL-1595322048000", - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/EnrollmentAccountQuery.json -func ExampleQueryClient_Usage_enrollmentAccountQueryLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", armcostmanagement.QueryDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeUsage), - Dataset: &armcostmanagement.QueryDataset{ - Filter: &armcostmanagement.QueryFilter{ - And: []*armcostmanagement.QueryFilter{ - { - Or: []*armcostmanagement.QueryFilter{ - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceLocation"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("East US"), - to.Ptr("West Europe")}, - }, - }, - { - Tags: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("Environment"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("UAT"), - to.Ptr("Prod")}, - }, - }}, - }, - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceGroup"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("API")}, - }, - }}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/70664866/enrollmentAccounts/456/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("ResourceGroup"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("UsageDate"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(19.545363672276512), - // "JapanUnifia-Trial", - // float64(20180331), - // "USD"}, - // []any{ - // float64(173.41979241290323), - // "RVIIOT-TRIAL", - // float64(20180331), - // "USD"}, - // []any{ - // float64(20.35941656262545), - // "VSTSHOL-1595322048000", - // float64(20180331), - // "USD"}, - // []any{ - // float64(0.16677720329728665), - // "gs-stms-dev", - // float64(20180331), - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/EnrollmentAccountQueryGrouping.json -func ExampleQueryClient_Usage_enrollmentAccountQueryGroupingLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", armcostmanagement.QueryDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeUsage), - Dataset: &armcostmanagement.QueryDataset{ - Aggregation: map[string]*armcostmanagement.QueryAggregation{ - "totalCost": { - Name: to.Ptr("PreTaxCost"), - Function: to.Ptr(armcostmanagement.FunctionTypeSum), - }, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - Grouping: []*armcostmanagement.QueryGrouping{ - { - Name: to.Ptr("ResourceGroup"), - Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension), - }}, - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/70664866/enrollmentAccounts/456/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("ResourceGroup"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("UsageDate"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(19.545363672276512), - // "JapanUnifia-Trial", - // float64(20180331), - // "USD"}, - // []any{ - // float64(173.41979241290323), - // "RVIIOT-TRIAL", - // float64(20180331), - // "USD"}, - // []any{ - // float64(20.35941656262545), - // "VSTSHOL-1595322048000", - // float64(20180331), - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCAInvoiceSectionQuery.json -func ExampleQueryClient_Usage_invoiceSectionQueryModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", armcostmanagement.QueryDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeUsage), - Dataset: &armcostmanagement.QueryDataset{ - Filter: &armcostmanagement.QueryFilter{ - And: []*armcostmanagement.QueryFilter{ - { - Or: []*armcostmanagement.QueryFilter{ - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceLocation"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("East US"), - to.Ptr("West Europe")}, - }, - }, - { - Tags: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("Environment"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("UAT"), - to.Ptr("Prod")}, - }, - }}, - }, - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceGroup"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("API")}, - }, - }}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("ResourceGroup"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("UsageDate"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(19.545363672276512), - // "JapanUnifia-Trial", - // float64(20180331), - // "USD"}, - // []any{ - // float64(173.41979241290323), - // "RVIIOT-TRIAL", - // float64(20180331), - // "USD"}, - // []any{ - // float64(20.35941656262545), - // "VSTSHOL-1595322048000", - // float64(20180331), - // "USD"}, - // []any{ - // float64(0.16677720329728665), - // "gs-stms-dev", - // float64(20180331), - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/MCAInvoiceSectionQueryGrouping.json -func ExampleQueryClient_Usage_invoiceSectionQueryGroupingModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", armcostmanagement.QueryDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeUsage), - Dataset: &armcostmanagement.QueryDataset{ - Aggregation: map[string]*armcostmanagement.QueryAggregation{ - "totalCost": { - Name: to.Ptr("PreTaxCost"), - Function: to.Ptr(armcostmanagement.FunctionTypeSum), - }, - }, - Granularity: to.Ptr(armcostmanagement.GranularityType("None")), - Grouping: []*armcostmanagement.QueryGrouping{ - { - Name: to.Ptr("ResourceGroup"), - Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension), - }}, - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("ResourceGroup"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(19.545363672276512), - // "JapanUnifia-Trial", - // "USD"}, - // []any{ - // float64(173.41979241290323), - // "RVIIOT-TRIAL", - // "USD"}, - // []any{ - // float64(20.35941656262545), - // "VSTSHOL-1595322048000", - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ManagementGroupQuery.json -func ExampleQueryClient_Usage_managementGroupQueryLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Management/managementGroups/MyMgId", armcostmanagement.QueryDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeUsage), - Dataset: &armcostmanagement.QueryDataset{ - Filter: &armcostmanagement.QueryFilter{ - And: []*armcostmanagement.QueryFilter{ - { - Or: []*armcostmanagement.QueryFilter{ - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceLocation"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("East US"), - to.Ptr("West Europe")}, - }, - }, - { - Tags: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("Environment"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("UAT"), - to.Ptr("Prod")}, - }, - }}, - }, - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceGroup"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("API")}, - }, - }}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("providers/Microsoft.Management/managementGroups/MyMgId/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("ResourceGroup"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("UsageDate"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(19.545363672276512), - // "JapanUnifia-Trial", - // float64(20180331), - // "USD"}, - // []any{ - // float64(173.41979241290323), - // "RVIIOT-TRIAL", - // float64(20180331), - // "USD"}, - // []any{ - // float64(20.35941656262545), - // "VSTSHOL-1595322048000", - // float64(20180331), - // "USD"}, - // []any{ - // float64(0.16677720329728665), - // "gs-stms-dev", - // float64(20180331), - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ManagementGroupQueryGrouping.json -func ExampleQueryClient_Usage_managementGroupQueryGroupingLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQueryClient().Usage(ctx, "providers/Microsoft.Management/managementGroups/MyMgId", armcostmanagement.QueryDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeUsage), - Dataset: &armcostmanagement.QueryDataset{ - Aggregation: map[string]*armcostmanagement.QueryAggregation{ - "totalCost": { - Name: to.Ptr("PreTaxCost"), - Function: to.Ptr(armcostmanagement.FunctionTypeSum), - }, - }, - Granularity: to.Ptr(armcostmanagement.GranularityType("None")), - Grouping: []*armcostmanagement.QueryGrouping{ - { - Name: to.Ptr("ResourceGroup"), - Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension), - }}, - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("providers/Microsoft.Management/managementGroups/MyMgId/providers/Microsoft.CostManagement/Query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("ResourceGroup"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("UsageDate"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(20.35941656262545), - // "VSTSHOL-1595322048000", - // float64(20180331), - // "USD"}, - // []any{ - // float64(173.41979241290323), - // "RVIIOT-TRIAL", - // float64(20180331), - // "USD"}, - // []any{ - // float64(19.545363672276512), - // "JapanUnifia-Trial", - // float64(20180331), - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ResourceGroupQuery.json -func ExampleQueryClient_Usage_resourceGroupQueryLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQueryClient().Usage(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", armcostmanagement.QueryDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeUsage), - Dataset: &armcostmanagement.QueryDataset{ - Filter: &armcostmanagement.QueryFilter{ - And: []*armcostmanagement.QueryFilter{ - { - Or: []*armcostmanagement.QueryFilter{ - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceLocation"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("East US"), - to.Ptr("West Europe")}, - }, - }, - { - Tags: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("Environment"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("UAT"), - to.Ptr("Prod")}, - }, - }}, - }, - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceGroup"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("API")}, - }, - }}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("9af9459d-441d-4055-9ed0-83d4c4a363fb"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("subscriptions/55312978-ba1b-415c-9304-c4b9c43c0481/resourcegroups/ScreenSharingTest-peer/providers/Microsoft.CostManagement/Query/9af9459d-441d-4055-9ed0-83d4c4a363fb"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("ResourceGroup"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("UsageDate"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(2.10333307059661), - // "ScreenSharingTest-peer", - // float64(20180417), - // "USD"}, - // []any{ - // float64(20.10333307059661), - // "ScreenSharingTest-peer", - // float64(20180418), - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ResourceGroupQueryGrouping.json -func ExampleQueryClient_Usage_resourceGroupQueryGroupingLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQueryClient().Usage(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", armcostmanagement.QueryDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeUsage), - Dataset: &armcostmanagement.QueryDataset{ - Aggregation: map[string]*armcostmanagement.QueryAggregation{ - "totalCost": { - Name: to.Ptr("PreTaxCost"), - Function: to.Ptr(armcostmanagement.FunctionTypeSum), - }, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - Grouping: []*armcostmanagement.QueryGrouping{ - { - Name: to.Ptr("ResourceType"), - Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension), - }}, - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("9af9459d-441d-4055-9ed0-83d4c4a363fb"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ScreenSharingTest-peer/providers/Microsoft.CostManagement/Query/9af9459d-441d-4055-9ed0-83d4c4a363fb"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("ResourceType"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("UsageDate"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(2.10333307059661), - // "Microsoft.SqlServer", - // float64(20180417), - // "USD"}, - // []any{ - // float64(20.10333307059661), - // "Microsoft.Compute", - // float64(20180418), - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/SubscriptionQuery.json -func ExampleQueryClient_Usage_subscriptionQueryLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQueryClient().Usage(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", armcostmanagement.QueryDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeUsage), - Dataset: &armcostmanagement.QueryDataset{ - Filter: &armcostmanagement.QueryFilter{ - And: []*armcostmanagement.QueryFilter{ - { - Or: []*armcostmanagement.QueryFilter{ - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceLocation"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("East US"), - to.Ptr("West Europe")}, - }, - }, - { - Tags: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("Environment"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("UAT"), - to.Ptr("Prod")}, - }, - }}, - }, - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceGroup"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("API")}, - }, - }}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("55312978-ba1b-415c-9304-cfd9c43c0481"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/Query/00000000-0000-0000-0000-000000000000"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("ResourceGroup"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("UsageDate"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(2.10333307059661), - // "ScreenSharingTest-peer", - // float64(20180331), - // "USD"}, - // []any{ - // float64(218.68795741935486), - // "Ict_StratAndPlan_GoldSprova_Prod", - // float64(20180331), - // "USD"}, - // []any{ - // float64(0.14384913581657052), - // "ssbciotelement01", - // float64(20180401), - // "USD"}, - // []any{ - // float64(0.009865586851323632), - // "ict_stratandplan_goldsprova_prod", - // float64(20180429), - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/SubscriptionQueryGrouping.json -func ExampleQueryClient_Usage_subscriptionQueryGroupingLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQueryClient().Usage(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", armcostmanagement.QueryDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeUsage), - Dataset: &armcostmanagement.QueryDataset{ - Aggregation: map[string]*armcostmanagement.QueryAggregation{ - "totalCost": { - Name: to.Ptr("PreTaxCost"), - Function: to.Ptr(armcostmanagement.FunctionTypeSum), - }, - }, - Granularity: to.Ptr(armcostmanagement.GranularityType("None")), - Grouping: []*armcostmanagement.QueryGrouping{ - { - Name: to.Ptr("ResourceGroup"), - Type: to.Ptr(armcostmanagement.QueryColumnTypeDimension), - }}, - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeTheLastMonth), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("55312978-ba1b-415c-9304-cfd9c43c0481"), - // Type: to.Ptr("microsoft.costmanagement/Query"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/Query/00000000-0000-0000-0000-000000000000"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("ResourceGroup"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(0.009865586851323632), - // "Ict_StratAndPlan_GoldSprova_Prod_0", - // "USD"}, - // []any{ - // float64(218.68795741935486), - // "Ict_StratAndPlan_GoldSprova_Prod_1", - // "USD"}, - // []any{ - // float64(2.10333307059661), - // "ScreenSharingTest-peer1", - // "USD"}, - // []any{ - // float64(0.14384913581657052), - // "Ssbciotelement01", - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalBillingAccountsQuery.json -func ExampleQueryClient_UsageByExternalCloudProviderType_externalBillingAccountQueryList() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQueryClient().UsageByExternalCloudProviderType(ctx, armcostmanagement.ExternalCloudProviderTypeExternalBillingAccounts, "100", armcostmanagement.QueryDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeUsage), - Dataset: &armcostmanagement.QueryDataset{ - Filter: &armcostmanagement.QueryFilter{ - And: []*armcostmanagement.QueryFilter{ - { - Or: []*armcostmanagement.QueryFilter{ - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceLocation"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("East US"), - to.Ptr("West Europe")}, - }, - }, - { - Tags: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("Environment"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("UAT"), - to.Ptr("Prod")}, - }, - }}, - }, - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceGroup"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("API")}, - }, - }}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("6dc7b06a-d90a-4df5-b655-ce6cf1c0814d"), - // Type: to.Ptr("Microsoft.CostManagement/query"), - // ID: to.Ptr("providers/Microsoft.CostManagement/externalBillingAccounts/100/query/6dc7b06a-d90a-4df5-b655-ce6cf1c0814d"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("ServiceName"), - // Type: to.Ptr("String"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // []any{ - // float64(0), - // "abc db", - // "USD"}, - // []any{ - // float64(30.2572751438), - // "abc compute cloud", - // "USD"}, - // []any{ - // float64(0.07675760200000002), - // "abc file system", - // "USD"}, - // []any{ - // float64(50.43096419040001), - // "abc elasticache", - // "USD"}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalSubscriptionsQuery.json -func ExampleQueryClient_UsageByExternalCloudProviderType_externalSubscriptionsQuery() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQueryClient().UsageByExternalCloudProviderType(ctx, armcostmanagement.ExternalCloudProviderTypeExternalSubscriptions, "100", armcostmanagement.QueryDefinition{ - Type: to.Ptr(armcostmanagement.ExportTypeUsage), - Dataset: &armcostmanagement.QueryDataset{ - Filter: &armcostmanagement.QueryFilter{ - And: []*armcostmanagement.QueryFilter{ - { - Or: []*armcostmanagement.QueryFilter{ - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceLocation"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("East US"), - to.Ptr("West Europe")}, - }, - }, - { - Tags: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("Environment"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("UAT"), - to.Ptr("Prod")}, - }, - }}, - }, - { - Dimensions: &armcostmanagement.QueryComparisonExpression{ - Name: to.Ptr("ResourceGroup"), - Operator: to.Ptr(armcostmanagement.QueryOperatorTypeIn), - Values: []*string{ - to.Ptr("API")}, - }, - }}, - }, - Granularity: to.Ptr(armcostmanagement.GranularityTypeDaily), - }, - Timeframe: to.Ptr(armcostmanagement.TimeframeTypeMonthToDate), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResult = armcostmanagement.QueryResult{ - // Name: to.Ptr("d99477af-7510-40ee-aca2-e59bdca0d10d"), - // Type: to.Ptr("Microsoft.CostManagement/query"), - // ID: to.Ptr("providers/Microsoft.CostManagement/externalSubscriptions/100/query/d99477af-7510-40ee-aca2-e59bdca0d10d"), - // Properties: &armcostmanagement.QueryProperties{ - // Columns: []*armcostmanagement.QueryColumn{ - // { - // Name: to.Ptr("PreTaxCost"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("UsageDate"), - // Type: to.Ptr("Number"), - // }, - // { - // Name: to.Ptr("Currency"), - // Type: to.Ptr("String"), - // }}, - // Rows: [][]any{ - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/reservationorderscope_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/reservationorderscope_client.go new file mode 100644 index 000000000000..d522110d524b --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/reservationorderscope_client.go @@ -0,0 +1,103 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcostmanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ReservationOrderScopeClient contains the methods for the ReservationOrderScope group. +// Don't use this type directly, use NewReservationOrderScopeClient() instead. +type ReservationOrderScopeClient struct { + internal *arm.Client +} + +// NewReservationOrderScopeClient creates a new instance of ReservationOrderScopeClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReservationOrderScopeClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ReservationOrderScopeClient, error) { + cl, err := arm.NewClient(moduleName+".ReservationOrderScopeClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ReservationOrderScopeClient{ + internal: cl, + } + return client, nil +} + +// BeginGenerateBenefitUtilizationSummariesReport - Triggers generation of a benefit utilization summaries report for the +// provided reservation order. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - reservationOrderID - Reservation Order ID +// - benefitUtilizationSummariesRequest - Async Benefit Utilization Summary report to be created. +// - options - ReservationOrderScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions contains the optional parameters +// for the ReservationOrderScopeClient.BeginGenerateBenefitUtilizationSummariesReport method. +func (client *ReservationOrderScopeClient) BeginGenerateBenefitUtilizationSummariesReport(ctx context.Context, reservationOrderID string, benefitUtilizationSummariesRequest BenefitUtilizationSummariesRequest, options *ReservationOrderScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions) (*runtime.Poller[ReservationOrderScopeClientGenerateBenefitUtilizationSummariesReportResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.generateBenefitUtilizationSummariesReport(ctx, reservationOrderID, benefitUtilizationSummariesRequest, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReservationOrderScopeClientGenerateBenefitUtilizationSummariesReportResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ReservationOrderScopeClientGenerateBenefitUtilizationSummariesReportResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// GenerateBenefitUtilizationSummariesReport - Triggers generation of a benefit utilization summaries report for the provided +// reservation order. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +func (client *ReservationOrderScopeClient) generateBenefitUtilizationSummariesReport(ctx context.Context, reservationOrderID string, benefitUtilizationSummariesRequest BenefitUtilizationSummariesRequest, options *ReservationOrderScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions) (*http.Response, error) { + req, err := client.generateBenefitUtilizationSummariesReportCreateRequest(ctx, reservationOrderID, benefitUtilizationSummariesRequest, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// generateBenefitUtilizationSummariesReportCreateRequest creates the GenerateBenefitUtilizationSummariesReport request. +func (client *ReservationOrderScopeClient) generateBenefitUtilizationSummariesReportCreateRequest(ctx context.Context, reservationOrderID string, benefitUtilizationSummariesRequest BenefitUtilizationSummariesRequest, options *ReservationOrderScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + if reservationOrderID == "" { + return nil, errors.New("parameter reservationOrderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{reservationOrderId}", url.PathEscape(reservationOrderID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, benefitUtilizationSummariesRequest) +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/reservationscope_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/reservationscope_client.go new file mode 100644 index 000000000000..41ef29addc20 --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/reservationscope_client.go @@ -0,0 +1,108 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcostmanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ReservationScopeClient contains the methods for the ReservationScope group. +// Don't use this type directly, use NewReservationScopeClient() instead. +type ReservationScopeClient struct { + internal *arm.Client +} + +// NewReservationScopeClient creates a new instance of ReservationScopeClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReservationScopeClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ReservationScopeClient, error) { + cl, err := arm.NewClient(moduleName+".ReservationScopeClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ReservationScopeClient{ + internal: cl, + } + return client, nil +} + +// BeginGenerateBenefitUtilizationSummariesReport - Triggers generation of a benefit utilization summaries report for the +// provided reservation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - reservationOrderID - Reservation Order ID +// - reservationID - Reservation ID +// - benefitUtilizationSummariesRequest - Async Benefit Utilization Summary report to be created. +// - options - ReservationScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions contains the optional parameters +// for the ReservationScopeClient.BeginGenerateBenefitUtilizationSummariesReport method. +func (client *ReservationScopeClient) BeginGenerateBenefitUtilizationSummariesReport(ctx context.Context, reservationOrderID string, reservationID string, benefitUtilizationSummariesRequest BenefitUtilizationSummariesRequest, options *ReservationScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions) (*runtime.Poller[ReservationScopeClientGenerateBenefitUtilizationSummariesReportResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.generateBenefitUtilizationSummariesReport(ctx, reservationOrderID, reservationID, benefitUtilizationSummariesRequest, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReservationScopeClientGenerateBenefitUtilizationSummariesReportResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ReservationScopeClientGenerateBenefitUtilizationSummariesReportResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// GenerateBenefitUtilizationSummariesReport - Triggers generation of a benefit utilization summaries report for the provided +// reservation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +func (client *ReservationScopeClient) generateBenefitUtilizationSummariesReport(ctx context.Context, reservationOrderID string, reservationID string, benefitUtilizationSummariesRequest BenefitUtilizationSummariesRequest, options *ReservationScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions) (*http.Response, error) { + req, err := client.generateBenefitUtilizationSummariesReportCreateRequest(ctx, reservationOrderID, reservationID, benefitUtilizationSummariesRequest, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// generateBenefitUtilizationSummariesReportCreateRequest creates the GenerateBenefitUtilizationSummariesReport request. +func (client *ReservationScopeClient) generateBenefitUtilizationSummariesReportCreateRequest(ctx context.Context, reservationOrderID string, reservationID string, benefitUtilizationSummariesRequest BenefitUtilizationSummariesRequest, options *ReservationScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + if reservationOrderID == "" { + return nil, errors.New("parameter reservationOrderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{reservationOrderId}", url.PathEscape(reservationOrderID)) + if reservationID == "" { + return nil, errors.New("parameter reservationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{reservationId}", url.PathEscape(reservationID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, benefitUtilizationSummariesRequest) +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/response_types.go b/sdk/resourcemanager/costmanagement/armcostmanagement/response_types.go index 67db9ed9125f..6e3ea7f1d46b 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/response_types.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/response_types.go @@ -29,6 +29,73 @@ type AlertsClientListResponse struct { AlertsResult } +// BenefitRecommendationsClientListResponse contains the response from method BenefitRecommendationsClient.NewListPager. +type BenefitRecommendationsClientListResponse struct { + BenefitRecommendationsListResult +} + +// BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingAccountScopeResponse contains the response from method BenefitUtilizationSummariesAsyncClient.GetOperationStatusBillingAccountScope. +type BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingAccountScopeResponse struct { + BenefitUtilizationSummariesOperationStatus +} + +// BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingProfileScopeResponse contains the response from method BenefitUtilizationSummariesAsyncClient.GetOperationStatusBillingProfileScope. +type BenefitUtilizationSummariesAsyncClientGetOperationStatusBillingProfileScopeResponse struct { + BenefitUtilizationSummariesOperationStatus +} + +// BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationOrderScopeResponse contains the response from method +// BenefitUtilizationSummariesAsyncClient.GetOperationStatusReservationOrderScope. +type BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationOrderScopeResponse struct { + BenefitUtilizationSummariesOperationStatus +} + +// BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationScopeResponse contains the response from method BenefitUtilizationSummariesAsyncClient.GetOperationStatusReservationScope. +type BenefitUtilizationSummariesAsyncClientGetOperationStatusReservationScopeResponse struct { + BenefitUtilizationSummariesOperationStatus +} + +// BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanOrderScopeResponse contains the response from method +// BenefitUtilizationSummariesAsyncClient.GetOperationStatusSavingsPlanOrderScope. +type BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanOrderScopeResponse struct { + BenefitUtilizationSummariesOperationStatus +} + +// BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanScopeResponse contains the response from method BenefitUtilizationSummariesAsyncClient.GetOperationStatusSavingsPlanScope. +type BenefitUtilizationSummariesAsyncClientGetOperationStatusSavingsPlanScopeResponse struct { + BenefitUtilizationSummariesOperationStatus +} + +// BenefitUtilizationSummariesClientListByBillingAccountIDResponse contains the response from method BenefitUtilizationSummariesClient.NewListByBillingAccountIDPager. +type BenefitUtilizationSummariesClientListByBillingAccountIDResponse struct { + BenefitUtilizationSummariesListResult +} + +// BenefitUtilizationSummariesClientListByBillingProfileIDResponse contains the response from method BenefitUtilizationSummariesClient.NewListByBillingProfileIDPager. +type BenefitUtilizationSummariesClientListByBillingProfileIDResponse struct { + BenefitUtilizationSummariesListResult +} + +// BenefitUtilizationSummariesClientListBySavingsPlanIDResponse contains the response from method BenefitUtilizationSummariesClient.NewListBySavingsPlanIDPager. +type BenefitUtilizationSummariesClientListBySavingsPlanIDResponse struct { + BenefitUtilizationSummariesListResult +} + +// BenefitUtilizationSummariesClientListBySavingsPlanOrderResponse contains the response from method BenefitUtilizationSummariesClient.NewListBySavingsPlanOrderPager. +type BenefitUtilizationSummariesClientListBySavingsPlanOrderResponse struct { + BenefitUtilizationSummariesListResult +} + +// BillingAccountScopeClientGenerateBenefitUtilizationSummariesReportResponse contains the response from method BillingAccountScopeClient.BeginGenerateBenefitUtilizationSummariesReport. +type BillingAccountScopeClientGenerateBenefitUtilizationSummariesReportResponse struct { + BenefitUtilizationSummariesOperationStatus +} + +// BillingProfileScopeClientGenerateBenefitUtilizationSummariesReportResponse contains the response from method BillingProfileScopeClient.BeginGenerateBenefitUtilizationSummariesReport. +type BillingProfileScopeClientGenerateBenefitUtilizationSummariesReportResponse struct { + BenefitUtilizationSummariesOperationStatus +} + // DimensionsClientByExternalCloudProviderTypeResponse contains the response from method DimensionsClient.NewByExternalCloudProviderTypePager. type DimensionsClientByExternalCloudProviderTypeResponse struct { DimensionsListResult @@ -71,12 +138,22 @@ type ExportsClientListResponse struct { // ForecastClientExternalCloudProviderUsageResponse contains the response from method ForecastClient.ExternalCloudProviderUsage. type ForecastClientExternalCloudProviderUsageResponse struct { - QueryResult + ForecastResult } // ForecastClientUsageResponse contains the response from method ForecastClient.Usage. type ForecastClientUsageResponse struct { - QueryResult + ForecastResult +} + +// GenerateCostDetailsReportClientCreateOperationResponse contains the response from method GenerateCostDetailsReportClient.BeginCreateOperation. +type GenerateCostDetailsReportClientCreateOperationResponse struct { + CostDetailsOperationResults +} + +// GenerateCostDetailsReportClientGetOperationResultsResponse contains the response from method GenerateCostDetailsReportClient.BeginGetOperationResults. +type GenerateCostDetailsReportClientGetOperationResultsResponse struct { + CostDetailsOperationResults } // GenerateDetailedCostReportClientCreateOperationResponse contains the response from method GenerateDetailedCostReportClient.BeginCreateOperation. @@ -84,7 +161,7 @@ type GenerateDetailedCostReportClientCreateOperationResponse struct { GenerateDetailedCostReportOperationResult } -// GenerateDetailedCostReportOperationResultsClientGetResponse contains the response from method GenerateDetailedCostReportOperationResultsClient.Get. +// GenerateDetailedCostReportOperationResultsClientGetResponse contains the response from method GenerateDetailedCostReportOperationResultsClient.BeginGet. type GenerateDetailedCostReportOperationResultsClientGetResponse struct { GenerateDetailedCostReportOperationResult } @@ -109,6 +186,16 @@ type OperationsClientListResponse struct { OperationListResult } +// PriceSheetClientDownloadByBillingProfileResponse contains the response from method PriceSheetClient.BeginDownloadByBillingProfile. +type PriceSheetClientDownloadByBillingProfileResponse struct { + DownloadURL +} + +// PriceSheetClientDownloadResponse contains the response from method PriceSheetClient.BeginDownload. +type PriceSheetClientDownloadResponse struct { + DownloadURL +} + // QueryClientUsageByExternalCloudProviderTypeResponse contains the response from method QueryClient.UsageByExternalCloudProviderType. type QueryClientUsageByExternalCloudProviderTypeResponse struct { QueryResult @@ -119,6 +206,86 @@ type QueryClientUsageResponse struct { QueryResult } +// ReservationOrderScopeClientGenerateBenefitUtilizationSummariesReportResponse contains the response from method ReservationOrderScopeClient.BeginGenerateBenefitUtilizationSummariesReport. +type ReservationOrderScopeClientGenerateBenefitUtilizationSummariesReportResponse struct { + BenefitUtilizationSummariesOperationStatus +} + +// ReservationScopeClientGenerateBenefitUtilizationSummariesReportResponse contains the response from method ReservationScopeClient.BeginGenerateBenefitUtilizationSummariesReport. +type ReservationScopeClientGenerateBenefitUtilizationSummariesReportResponse struct { + BenefitUtilizationSummariesOperationStatus +} + +// SavingsPlanOrderScopeClientGenerateBenefitUtilizationSummariesReportResponse contains the response from method SavingsPlanOrderScopeClient.BeginGenerateBenefitUtilizationSummariesReport. +type SavingsPlanOrderScopeClientGenerateBenefitUtilizationSummariesReportResponse struct { + BenefitUtilizationSummariesOperationStatus +} + +// SavingsPlanScopeClientGenerateBenefitUtilizationSummariesReportAsyncResponse contains the response from method SavingsPlanScopeClient.BeginGenerateBenefitUtilizationSummariesReportAsync. +type SavingsPlanScopeClientGenerateBenefitUtilizationSummariesReportAsyncResponse struct { + BenefitUtilizationSummariesOperationStatus +} + +// ScheduledActionsClientCheckNameAvailabilityByScopeResponse contains the response from method ScheduledActionsClient.CheckNameAvailabilityByScope. +type ScheduledActionsClientCheckNameAvailabilityByScopeResponse struct { + CheckNameAvailabilityResponse +} + +// ScheduledActionsClientCheckNameAvailabilityResponse contains the response from method ScheduledActionsClient.CheckNameAvailability. +type ScheduledActionsClientCheckNameAvailabilityResponse struct { + CheckNameAvailabilityResponse +} + +// ScheduledActionsClientCreateOrUpdateByScopeResponse contains the response from method ScheduledActionsClient.CreateOrUpdateByScope. +type ScheduledActionsClientCreateOrUpdateByScopeResponse struct { + ScheduledAction +} + +// ScheduledActionsClientCreateOrUpdateResponse contains the response from method ScheduledActionsClient.CreateOrUpdate. +type ScheduledActionsClientCreateOrUpdateResponse struct { + ScheduledAction +} + +// ScheduledActionsClientDeleteByScopeResponse contains the response from method ScheduledActionsClient.DeleteByScope. +type ScheduledActionsClientDeleteByScopeResponse struct { + // placeholder for future response values +} + +// ScheduledActionsClientDeleteResponse contains the response from method ScheduledActionsClient.Delete. +type ScheduledActionsClientDeleteResponse struct { + // placeholder for future response values +} + +// ScheduledActionsClientGetByScopeResponse contains the response from method ScheduledActionsClient.GetByScope. +type ScheduledActionsClientGetByScopeResponse struct { + ScheduledAction +} + +// ScheduledActionsClientGetResponse contains the response from method ScheduledActionsClient.Get. +type ScheduledActionsClientGetResponse struct { + ScheduledAction +} + +// ScheduledActionsClientListByScopeResponse contains the response from method ScheduledActionsClient.NewListByScopePager. +type ScheduledActionsClientListByScopeResponse struct { + ScheduledActionListResult +} + +// ScheduledActionsClientListResponse contains the response from method ScheduledActionsClient.NewListPager. +type ScheduledActionsClientListResponse struct { + ScheduledActionListResult +} + +// ScheduledActionsClientRunByScopeResponse contains the response from method ScheduledActionsClient.RunByScope. +type ScheduledActionsClientRunByScopeResponse struct { + // placeholder for future response values +} + +// ScheduledActionsClientRunResponse contains the response from method ScheduledActionsClient.Run. +type ScheduledActionsClientRunResponse struct { + // placeholder for future response values +} + // ViewsClientCreateOrUpdateByScopeResponse contains the response from method ViewsClient.CreateOrUpdateByScope. type ViewsClientCreateOrUpdateByScopeResponse struct { View diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/savingsplanorderscope_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/savingsplanorderscope_client.go new file mode 100644 index 000000000000..f32e62e59529 --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/savingsplanorderscope_client.go @@ -0,0 +1,103 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcostmanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SavingsPlanOrderScopeClient contains the methods for the SavingsPlanOrderScope group. +// Don't use this type directly, use NewSavingsPlanOrderScopeClient() instead. +type SavingsPlanOrderScopeClient struct { + internal *arm.Client +} + +// NewSavingsPlanOrderScopeClient creates a new instance of SavingsPlanOrderScopeClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSavingsPlanOrderScopeClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SavingsPlanOrderScopeClient, error) { + cl, err := arm.NewClient(moduleName+".SavingsPlanOrderScopeClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SavingsPlanOrderScopeClient{ + internal: cl, + } + return client, nil +} + +// BeginGenerateBenefitUtilizationSummariesReport - Triggers generation of a benefit utilization summaries report for the +// provided savings plan order. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - savingsPlanOrderID - Savings plan order ID. +// - benefitUtilizationSummariesRequest - Async Benefit Utilization Summary report to be created. +// - options - SavingsPlanOrderScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions contains the optional parameters +// for the SavingsPlanOrderScopeClient.BeginGenerateBenefitUtilizationSummariesReport method. +func (client *SavingsPlanOrderScopeClient) BeginGenerateBenefitUtilizationSummariesReport(ctx context.Context, savingsPlanOrderID string, benefitUtilizationSummariesRequest BenefitUtilizationSummariesRequest, options *SavingsPlanOrderScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions) (*runtime.Poller[SavingsPlanOrderScopeClientGenerateBenefitUtilizationSummariesReportResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.generateBenefitUtilizationSummariesReport(ctx, savingsPlanOrderID, benefitUtilizationSummariesRequest, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SavingsPlanOrderScopeClientGenerateBenefitUtilizationSummariesReportResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[SavingsPlanOrderScopeClientGenerateBenefitUtilizationSummariesReportResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// GenerateBenefitUtilizationSummariesReport - Triggers generation of a benefit utilization summaries report for the provided +// savings plan order. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +func (client *SavingsPlanOrderScopeClient) generateBenefitUtilizationSummariesReport(ctx context.Context, savingsPlanOrderID string, benefitUtilizationSummariesRequest BenefitUtilizationSummariesRequest, options *SavingsPlanOrderScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions) (*http.Response, error) { + req, err := client.generateBenefitUtilizationSummariesReportCreateRequest(ctx, savingsPlanOrderID, benefitUtilizationSummariesRequest, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// generateBenefitUtilizationSummariesReportCreateRequest creates the GenerateBenefitUtilizationSummariesReport request. +func (client *SavingsPlanOrderScopeClient) generateBenefitUtilizationSummariesReportCreateRequest(ctx context.Context, savingsPlanOrderID string, benefitUtilizationSummariesRequest BenefitUtilizationSummariesRequest, options *SavingsPlanOrderScopeClientBeginGenerateBenefitUtilizationSummariesReportOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + if savingsPlanOrderID == "" { + return nil, errors.New("parameter savingsPlanOrderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{savingsPlanOrderId}", url.PathEscape(savingsPlanOrderID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, benefitUtilizationSummariesRequest) +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/savingsplanscope_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/savingsplanscope_client.go new file mode 100644 index 000000000000..c2ea07bdf096 --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/savingsplanscope_client.go @@ -0,0 +1,108 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcostmanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SavingsPlanScopeClient contains the methods for the SavingsPlanScope group. +// Don't use this type directly, use NewSavingsPlanScopeClient() instead. +type SavingsPlanScopeClient struct { + internal *arm.Client +} + +// NewSavingsPlanScopeClient creates a new instance of SavingsPlanScopeClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSavingsPlanScopeClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SavingsPlanScopeClient, error) { + cl, err := arm.NewClient(moduleName+".SavingsPlanScopeClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SavingsPlanScopeClient{ + internal: cl, + } + return client, nil +} + +// BeginGenerateBenefitUtilizationSummariesReportAsync - Triggers generation of a benefit utilization summaries report for +// the provided savings plan. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - savingsPlanOrderID - Savings plan order ID. +// - savingsPlanID - Savings plan ID. +// - benefitUtilizationSummariesRequest - Async Benefit Utilization Summary report to be created. +// - options - SavingsPlanScopeClientBeginGenerateBenefitUtilizationSummariesReportAsyncOptions contains the optional parameters +// for the SavingsPlanScopeClient.BeginGenerateBenefitUtilizationSummariesReportAsync method. +func (client *SavingsPlanScopeClient) BeginGenerateBenefitUtilizationSummariesReportAsync(ctx context.Context, savingsPlanOrderID string, savingsPlanID string, benefitUtilizationSummariesRequest BenefitUtilizationSummariesRequest, options *SavingsPlanScopeClientBeginGenerateBenefitUtilizationSummariesReportAsyncOptions) (*runtime.Poller[SavingsPlanScopeClientGenerateBenefitUtilizationSummariesReportAsyncResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.generateBenefitUtilizationSummariesReportAsync(ctx, savingsPlanOrderID, savingsPlanID, benefitUtilizationSummariesRequest, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SavingsPlanScopeClientGenerateBenefitUtilizationSummariesReportAsyncResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[SavingsPlanScopeClientGenerateBenefitUtilizationSummariesReportAsyncResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// GenerateBenefitUtilizationSummariesReportAsync - Triggers generation of a benefit utilization summaries report for the +// provided savings plan. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +func (client *SavingsPlanScopeClient) generateBenefitUtilizationSummariesReportAsync(ctx context.Context, savingsPlanOrderID string, savingsPlanID string, benefitUtilizationSummariesRequest BenefitUtilizationSummariesRequest, options *SavingsPlanScopeClientBeginGenerateBenefitUtilizationSummariesReportAsyncOptions) (*http.Response, error) { + req, err := client.generateBenefitUtilizationSummariesReportAsyncCreateRequest(ctx, savingsPlanOrderID, savingsPlanID, benefitUtilizationSummariesRequest, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// generateBenefitUtilizationSummariesReportAsyncCreateRequest creates the GenerateBenefitUtilizationSummariesReportAsync request. +func (client *SavingsPlanScopeClient) generateBenefitUtilizationSummariesReportAsyncCreateRequest(ctx context.Context, savingsPlanOrderID string, savingsPlanID string, benefitUtilizationSummariesRequest BenefitUtilizationSummariesRequest, options *SavingsPlanScopeClientBeginGenerateBenefitUtilizationSummariesReportAsyncOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + if savingsPlanOrderID == "" { + return nil, errors.New("parameter savingsPlanOrderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{savingsPlanOrderId}", url.PathEscape(savingsPlanOrderID)) + if savingsPlanID == "" { + return nil, errors.New("parameter savingsPlanID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{savingsPlanId}", url.PathEscape(savingsPlanID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, benefitUtilizationSummariesRequest) +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/scheduledactions_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/scheduledactions_client.go new file mode 100644 index 000000000000..b435271d3c3f --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/scheduledactions_client.go @@ -0,0 +1,720 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcostmanagement + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ScheduledActionsClient contains the methods for the ScheduledActions group. +// Don't use this type directly, use NewScheduledActionsClient() instead. +type ScheduledActionsClient struct { + internal *arm.Client +} + +// NewScheduledActionsClient creates a new instance of ScheduledActionsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewScheduledActionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ScheduledActionsClient, error) { + cl, err := arm.NewClient(moduleName+".ScheduledActionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScheduledActionsClient{ + internal: cl, + } + return client, nil +} + +// CheckNameAvailability - Checks availability and correctness of the name for a scheduled action. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - checkNameAvailabilityRequest - Scheduled action to be created or updated. +// - options - ScheduledActionsClientCheckNameAvailabilityOptions contains the optional parameters for the ScheduledActionsClient.CheckNameAvailability +// method. +func (client *ScheduledActionsClient) CheckNameAvailability(ctx context.Context, checkNameAvailabilityRequest CheckNameAvailabilityRequest, options *ScheduledActionsClientCheckNameAvailabilityOptions) (ScheduledActionsClientCheckNameAvailabilityResponse, error) { + req, err := client.checkNameAvailabilityCreateRequest(ctx, checkNameAvailabilityRequest, options) + if err != nil { + return ScheduledActionsClientCheckNameAvailabilityResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientCheckNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScheduledActionsClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) + } + return client.checkNameAvailabilityHandleResponse(resp) +} + +// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. +func (client *ScheduledActionsClient) checkNameAvailabilityCreateRequest(ctx context.Context, checkNameAvailabilityRequest CheckNameAvailabilityRequest, options *ScheduledActionsClientCheckNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.CostManagement/checkNameAvailability" + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, checkNameAvailabilityRequest) +} + +// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. +func (client *ScheduledActionsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (ScheduledActionsClientCheckNameAvailabilityResponse, error) { + result := ScheduledActionsClientCheckNameAvailabilityResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResponse); err != nil { + return ScheduledActionsClientCheckNameAvailabilityResponse{}, err + } + return result, nil +} + +// CheckNameAvailabilityByScope - Checks availability and correctness of the name for a scheduled action within the given +// scope. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - scope - The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription +// scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for +// resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection +// scope, +// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account +// scope and +// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. +// Note: Insight Alerts are only available on subscription scope. +// - checkNameAvailabilityRequest - Scheduled action to be created or updated. +// - options - ScheduledActionsClientCheckNameAvailabilityByScopeOptions contains the optional parameters for the ScheduledActionsClient.CheckNameAvailabilityByScope +// method. +func (client *ScheduledActionsClient) CheckNameAvailabilityByScope(ctx context.Context, scope string, checkNameAvailabilityRequest CheckNameAvailabilityRequest, options *ScheduledActionsClientCheckNameAvailabilityByScopeOptions) (ScheduledActionsClientCheckNameAvailabilityByScopeResponse, error) { + req, err := client.checkNameAvailabilityByScopeCreateRequest(ctx, scope, checkNameAvailabilityRequest, options) + if err != nil { + return ScheduledActionsClientCheckNameAvailabilityByScopeResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientCheckNameAvailabilityByScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScheduledActionsClientCheckNameAvailabilityByScopeResponse{}, runtime.NewResponseError(resp) + } + return client.checkNameAvailabilityByScopeHandleResponse(resp) +} + +// checkNameAvailabilityByScopeCreateRequest creates the CheckNameAvailabilityByScope request. +func (client *ScheduledActionsClient) checkNameAvailabilityByScopeCreateRequest(ctx context.Context, scope string, checkNameAvailabilityRequest CheckNameAvailabilityRequest, options *ScheduledActionsClientCheckNameAvailabilityByScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.CostManagement/checkNameAvailability" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, checkNameAvailabilityRequest) +} + +// checkNameAvailabilityByScopeHandleResponse handles the CheckNameAvailabilityByScope response. +func (client *ScheduledActionsClient) checkNameAvailabilityByScopeHandleResponse(resp *http.Response) (ScheduledActionsClientCheckNameAvailabilityByScopeResponse, error) { + result := ScheduledActionsClientCheckNameAvailabilityByScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResponse); err != nil { + return ScheduledActionsClientCheckNameAvailabilityByScopeResponse{}, err + } + return result, nil +} + +// CreateOrUpdate - Create or update a private scheduled action. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - name - Scheduled action name. +// - scheduledAction - Scheduled action to be created or updated. +// - options - ScheduledActionsClientCreateOrUpdateOptions contains the optional parameters for the ScheduledActionsClient.CreateOrUpdate +// method. +func (client *ScheduledActionsClient) CreateOrUpdate(ctx context.Context, name string, scheduledAction ScheduledAction, options *ScheduledActionsClientCreateOrUpdateOptions) (ScheduledActionsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, name, scheduledAction, options) + if err != nil { + return ScheduledActionsClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return ScheduledActionsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ScheduledActionsClient) createOrUpdateCreateRequest(ctx context.Context, name string, scheduledAction ScheduledAction, options *ScheduledActionsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.CostManagement/scheduledActions/{name}" + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, scheduledAction) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ScheduledActionsClient) createOrUpdateHandleResponse(resp *http.Response) (ScheduledActionsClientCreateOrUpdateResponse, error) { + result := ScheduledActionsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ScheduledAction); err != nil { + return ScheduledActionsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// CreateOrUpdateByScope - Create or update a shared scheduled action within the given scope. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - scope - The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription +// scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for +// resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection +// scope, +// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account +// scope and +// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. +// Note: Insight Alerts are only available on subscription scope. +// - name - Scheduled action name. +// - scheduledAction - Scheduled action to be created or updated. +// - options - ScheduledActionsClientCreateOrUpdateByScopeOptions contains the optional parameters for the ScheduledActionsClient.CreateOrUpdateByScope +// method. +func (client *ScheduledActionsClient) CreateOrUpdateByScope(ctx context.Context, scope string, name string, scheduledAction ScheduledAction, options *ScheduledActionsClientCreateOrUpdateByScopeOptions) (ScheduledActionsClientCreateOrUpdateByScopeResponse, error) { + req, err := client.createOrUpdateByScopeCreateRequest(ctx, scope, name, scheduledAction, options) + if err != nil { + return ScheduledActionsClientCreateOrUpdateByScopeResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientCreateOrUpdateByScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return ScheduledActionsClientCreateOrUpdateByScopeResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateByScopeHandleResponse(resp) +} + +// createOrUpdateByScopeCreateRequest creates the CreateOrUpdateByScope request. +func (client *ScheduledActionsClient) createOrUpdateByScopeCreateRequest(ctx context.Context, scope string, name string, scheduledAction ScheduledAction, options *ScheduledActionsClientCreateOrUpdateByScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, scheduledAction) +} + +// createOrUpdateByScopeHandleResponse handles the CreateOrUpdateByScope response. +func (client *ScheduledActionsClient) createOrUpdateByScopeHandleResponse(resp *http.Response) (ScheduledActionsClientCreateOrUpdateByScopeResponse, error) { + result := ScheduledActionsClientCreateOrUpdateByScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ScheduledAction); err != nil { + return ScheduledActionsClientCreateOrUpdateByScopeResponse{}, err + } + return result, nil +} + +// Delete - Delete a private scheduled action. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - name - Scheduled action name. +// - options - ScheduledActionsClientDeleteOptions contains the optional parameters for the ScheduledActionsClient.Delete method. +func (client *ScheduledActionsClient) Delete(ctx context.Context, name string, options *ScheduledActionsClientDeleteOptions) (ScheduledActionsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, name, options) + if err != nil { + return ScheduledActionsClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ScheduledActionsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return ScheduledActionsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ScheduledActionsClient) deleteCreateRequest(ctx context.Context, name string, options *ScheduledActionsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.CostManagement/scheduledActions/{name}" + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// DeleteByScope - Delete a scheduled action within the given scope. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - scope - The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription +// scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for +// resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection +// scope, +// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account +// scope and +// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. +// Note: Insight Alerts are only available on subscription scope. +// - name - Scheduled action name. +// - options - ScheduledActionsClientDeleteByScopeOptions contains the optional parameters for the ScheduledActionsClient.DeleteByScope +// method. +func (client *ScheduledActionsClient) DeleteByScope(ctx context.Context, scope string, name string, options *ScheduledActionsClientDeleteByScopeOptions) (ScheduledActionsClientDeleteByScopeResponse, error) { + req, err := client.deleteByScopeCreateRequest(ctx, scope, name, options) + if err != nil { + return ScheduledActionsClientDeleteByScopeResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientDeleteByScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ScheduledActionsClientDeleteByScopeResponse{}, runtime.NewResponseError(resp) + } + return ScheduledActionsClientDeleteByScopeResponse{}, nil +} + +// deleteByScopeCreateRequest creates the DeleteByScope request. +func (client *ScheduledActionsClient) deleteByScopeCreateRequest(ctx context.Context, scope string, name string, options *ScheduledActionsClientDeleteByScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the private scheduled action by name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - name - Scheduled action name. +// - options - ScheduledActionsClientGetOptions contains the optional parameters for the ScheduledActionsClient.Get method. +func (client *ScheduledActionsClient) Get(ctx context.Context, name string, options *ScheduledActionsClientGetOptions) (ScheduledActionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, name, options) + if err != nil { + return ScheduledActionsClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScheduledActionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ScheduledActionsClient) getCreateRequest(ctx context.Context, name string, options *ScheduledActionsClientGetOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.CostManagement/scheduledActions/{name}" + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ScheduledActionsClient) getHandleResponse(resp *http.Response) (ScheduledActionsClientGetResponse, error) { + result := ScheduledActionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ScheduledAction); err != nil { + return ScheduledActionsClientGetResponse{}, err + } + return result, nil +} + +// GetByScope - Get the shared scheduled action from the given scope by name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - scope - The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription +// scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for +// resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection +// scope, +// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account +// scope and +// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. +// Note: Insight Alerts are only available on subscription scope. +// - name - Scheduled action name. +// - options - ScheduledActionsClientGetByScopeOptions contains the optional parameters for the ScheduledActionsClient.GetByScope +// method. +func (client *ScheduledActionsClient) GetByScope(ctx context.Context, scope string, name string, options *ScheduledActionsClientGetByScopeOptions) (ScheduledActionsClientGetByScopeResponse, error) { + req, err := client.getByScopeCreateRequest(ctx, scope, name, options) + if err != nil { + return ScheduledActionsClientGetByScopeResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientGetByScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScheduledActionsClientGetByScopeResponse{}, runtime.NewResponseError(resp) + } + return client.getByScopeHandleResponse(resp) +} + +// getByScopeCreateRequest creates the GetByScope request. +func (client *ScheduledActionsClient) getByScopeCreateRequest(ctx context.Context, scope string, name string, options *ScheduledActionsClientGetByScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByScopeHandleResponse handles the GetByScope response. +func (client *ScheduledActionsClient) getByScopeHandleResponse(resp *http.Response) (ScheduledActionsClientGetByScopeResponse, error) { + result := ScheduledActionsClientGetByScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ScheduledAction); err != nil { + return ScheduledActionsClientGetByScopeResponse{}, err + } + return result, nil +} + +// NewListPager - List all private scheduled actions. +// +// Generated from API version 2023-03-01 +// - options - ScheduledActionsClientListOptions contains the optional parameters for the ScheduledActionsClient.NewListPager +// method. +func (client *ScheduledActionsClient) NewListPager(options *ScheduledActionsClientListOptions) *runtime.Pager[ScheduledActionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ScheduledActionsClientListResponse]{ + More: func(page ScheduledActionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ScheduledActionsClientListResponse) (ScheduledActionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ScheduledActionsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScheduledActionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ScheduledActionsClient) listCreateRequest(ctx context.Context, options *ScheduledActionsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.CostManagement/scheduledActions" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ScheduledActionsClient) listHandleResponse(resp *http.Response) (ScheduledActionsClientListResponse, error) { + result := ScheduledActionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ScheduledActionListResult); err != nil { + return ScheduledActionsClientListResponse{}, err + } + return result, nil +} + +// NewListByScopePager - List all shared scheduled actions within the given scope. +// +// Generated from API version 2023-03-01 +// - scope - The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription +// scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for +// resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection +// scope, +// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account +// scope and +// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. +// Note: Insight Alerts are only available on subscription scope. +// - options - ScheduledActionsClientListByScopeOptions contains the optional parameters for the ScheduledActionsClient.NewListByScopePager +// method. +func (client *ScheduledActionsClient) NewListByScopePager(scope string, options *ScheduledActionsClientListByScopeOptions) *runtime.Pager[ScheduledActionsClientListByScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[ScheduledActionsClientListByScopeResponse]{ + More: func(page ScheduledActionsClientListByScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ScheduledActionsClientListByScopeResponse) (ScheduledActionsClientListByScopeResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByScopeCreateRequest(ctx, scope, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ScheduledActionsClientListByScopeResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientListByScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScheduledActionsClientListByScopeResponse{}, runtime.NewResponseError(resp) + } + return client.listByScopeHandleResponse(resp) + }, + }) +} + +// listByScopeCreateRequest creates the ListByScope request. +func (client *ScheduledActionsClient) listByScopeCreateRequest(ctx context.Context, scope string, options *ScheduledActionsClientListByScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.CostManagement/scheduledActions" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByScopeHandleResponse handles the ListByScope response. +func (client *ScheduledActionsClient) listByScopeHandleResponse(resp *http.Response) (ScheduledActionsClientListByScopeResponse, error) { + result := ScheduledActionsClientListByScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ScheduledActionListResult); err != nil { + return ScheduledActionsClientListByScopeResponse{}, err + } + return result, nil +} + +// Run - Processes a private scheduled action. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - name - Scheduled action name. +// - options - ScheduledActionsClientRunOptions contains the optional parameters for the ScheduledActionsClient.Run method. +func (client *ScheduledActionsClient) Run(ctx context.Context, name string, options *ScheduledActionsClientRunOptions) (ScheduledActionsClientRunResponse, error) { + req, err := client.runCreateRequest(ctx, name, options) + if err != nil { + return ScheduledActionsClientRunResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientRunResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScheduledActionsClientRunResponse{}, runtime.NewResponseError(resp) + } + return ScheduledActionsClientRunResponse{}, nil +} + +// runCreateRequest creates the Run request. +func (client *ScheduledActionsClient) runCreateRequest(ctx context.Context, name string, options *ScheduledActionsClientRunOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.CostManagement/scheduledActions/{name}/execute" + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// RunByScope - Runs a shared scheduled action within the given scope. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01 +// - scope - The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription +// scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for +// resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection +// scope, +// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account +// scope and +// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. +// Note: Insight Alerts are only available on subscription scope. +// - name - Scheduled action name. +// - options - ScheduledActionsClientRunByScopeOptions contains the optional parameters for the ScheduledActionsClient.RunByScope +// method. +func (client *ScheduledActionsClient) RunByScope(ctx context.Context, scope string, name string, options *ScheduledActionsClientRunByScopeOptions) (ScheduledActionsClientRunByScopeResponse, error) { + req, err := client.runByScopeCreateRequest(ctx, scope, name, options) + if err != nil { + return ScheduledActionsClientRunByScopeResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientRunByScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScheduledActionsClientRunByScopeResponse{}, runtime.NewResponseError(resp) + } + return ScheduledActionsClientRunByScopeResponse{}, nil +} + +// runByScopeCreateRequest creates the RunByScope request. +func (client *ScheduledActionsClient) runByScopeCreateRequest(ctx context.Context, scope string, name string, options *ScheduledActionsClientRunByScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}/execute" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/views_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/views_client.go index b003651a446f..a4736c705ab2 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/views_client.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/views_client.go @@ -46,7 +46,7 @@ func NewViewsClient(credential azcore.TokenCredential, options *arm.ClientOption // require eTag. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - viewName - View name // - parameters - Parameters supplied to the CreateOrUpdate View operation. // - options - ViewsClientCreateOrUpdateOptions contains the optional parameters for the ViewsClient.CreateOrUpdate method. @@ -77,7 +77,7 @@ func (client *ViewsClient) createOrUpdateCreateRequest(ctx context.Context, view return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -97,7 +97,7 @@ func (client *ViewsClient) createOrUpdateHandleResponse(resp *http.Response) (Vi // require eTag. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - scope - The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, // 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup // scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' @@ -146,7 +146,7 @@ func (client *ViewsClient) createOrUpdateByScopeCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -164,7 +164,7 @@ func (client *ViewsClient) createOrUpdateByScopeHandleResponse(resp *http.Respon // Delete - The operation to delete a view. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - viewName - View name // - options - ViewsClientDeleteOptions contains the optional parameters for the ViewsClient.Delete method. func (client *ViewsClient) Delete(ctx context.Context, viewName string, options *ViewsClientDeleteOptions) (ViewsClientDeleteResponse, error) { @@ -194,7 +194,7 @@ func (client *ViewsClient) deleteCreateRequest(ctx context.Context, viewName str return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -203,7 +203,7 @@ func (client *ViewsClient) deleteCreateRequest(ctx context.Context, viewName str // DeleteByScope - The operation to delete a view. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - scope - The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, // 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup // scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' @@ -250,7 +250,7 @@ func (client *ViewsClient) deleteByScopeCreateRequest(ctx context.Context, scope return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -259,7 +259,7 @@ func (client *ViewsClient) deleteByScopeCreateRequest(ctx context.Context, scope // Get - Gets the view by view name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - viewName - View name // - options - ViewsClientGetOptions contains the optional parameters for the ViewsClient.Get method. func (client *ViewsClient) Get(ctx context.Context, viewName string, options *ViewsClientGetOptions) (ViewsClientGetResponse, error) { @@ -289,7 +289,7 @@ func (client *ViewsClient) getCreateRequest(ctx context.Context, viewName string return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -307,7 +307,7 @@ func (client *ViewsClient) getHandleResponse(resp *http.Response) (ViewsClientGe // GetByScope - Gets the view for the defined scope by view name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - scope - The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, // 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup // scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' @@ -354,7 +354,7 @@ func (client *ViewsClient) getByScopeCreateRequest(ctx context.Context, scope st return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -371,7 +371,7 @@ func (client *ViewsClient) getByScopeHandleResponse(resp *http.Response) (ViewsC // NewListPager - Lists all views by tenant and object. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - options - ViewsClientListOptions contains the optional parameters for the ViewsClient.NewListPager method. func (client *ViewsClient) NewListPager(options *ViewsClientListOptions) *runtime.Pager[ViewsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ViewsClientListResponse]{ @@ -409,7 +409,7 @@ func (client *ViewsClient) listCreateRequest(ctx context.Context, options *Views return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -426,7 +426,7 @@ func (client *ViewsClient) listHandleResponse(resp *http.Response) (ViewsClientL // NewListByScopePager - Lists all views at the given scope. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-03-01 // - scope - The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, // 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup // scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' @@ -481,7 +481,7 @@ func (client *ViewsClient) listByScopeCreateRequest(ctx context.Context, scope s return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/views_client_example_test.go b/sdk/resourcemanager/costmanagement/armcostmanagement/views_client_example_test.go deleted file mode 100644 index 7f4fff679009..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/views_client_example_test.go +++ /dev/null @@ -1,737 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcostmanagement_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/PrivateViewList.json -func ExampleViewsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewViewsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ViewListResult = armcostmanagement.ViewListResult{ - // Value: []*armcostmanagement.View{ - // { - // Name: to.Ptr("swaggerExample"), - // Type: to.Ptr("Microsoft.CostManagement/Views"), - // ETag: to.Ptr("\"1d4ff9fe66f1d10\""), - // ID: to.Ptr("/providers/Microsoft.CostManagement/views/swaggerExample"), - // Properties: &armcostmanagement.ViewProperties{ - // Accumulated: to.Ptr(armcostmanagement.AccumulatedTypeTrue), - // Chart: to.Ptr(armcostmanagement.ChartTypeTable), - // DisplayName: to.Ptr("swagger Example"), - // Kpis: []*armcostmanagement.KpiProperties{ - // { - // Type: to.Ptr(armcostmanagement.KpiTypeForecast), - // Enabled: to.Ptr(true), - // }, - // { - // Type: to.Ptr(armcostmanagement.KpiTypeBudget), - // Enabled: to.Ptr(true), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo"), - // }}, - // Metric: to.Ptr(armcostmanagement.MetricTypeActualCost), - // Pivots: []*armcostmanagement.PivotProperties{ - // { - // Name: to.Ptr("ServiceName"), - // Type: to.Ptr(armcostmanagement.PivotTypeDimension), - // }, - // { - // Name: to.Ptr("MeterCategory"), - // Type: to.Ptr(armcostmanagement.PivotTypeDimension), - // }, - // { - // Name: to.Ptr("swaggerTagKey"), - // Type: to.Ptr(armcostmanagement.PivotTypeTagKey), - // }}, - // Query: &armcostmanagement.ReportConfigDefinition{ - // Type: to.Ptr(armcostmanagement.ReportTypeUsage), - // DataSet: &armcostmanagement.ReportConfigDataset{ - // Aggregation: map[string]*armcostmanagement.ReportConfigAggregation{ - // "totalCost": &armcostmanagement.ReportConfigAggregation{ - // Name: to.Ptr("PreTaxCost"), - // Function: to.Ptr(armcostmanagement.FunctionTypeSum), - // }, - // }, - // Granularity: to.Ptr(armcostmanagement.ReportGranularityTypeDaily), - // Grouping: []*armcostmanagement.ReportConfigGrouping{ - // }, - // Sorting: []*armcostmanagement.ReportConfigSorting{ - // { - // Name: to.Ptr("UsageDate"), - // Direction: to.Ptr(armcostmanagement.ReportConfigSortingTypeAscending), - // }}, - // }, - // Timeframe: to.Ptr(armcostmanagement.ReportTimeframeTypeMonthToDate), - // }, - // Scope: to.Ptr(""), - // }, - // }, - // { - // Name: to.Ptr("swaggerExample2"), - // Type: to.Ptr("Microsoft.CostManagement/Views"), - // ETag: to.Ptr("\"1d4ffa5a9c2430c\""), - // ID: to.Ptr("/providers/Microsoft.CostManagement/views/swaggerExample2"), - // Properties: &armcostmanagement.ViewProperties{ - // Accumulated: to.Ptr(armcostmanagement.AccumulatedTypeTrue), - // Chart: to.Ptr(armcostmanagement.ChartTypeGroupedColumn), - // DisplayName: to.Ptr("swagger Example 2"), - // Kpis: []*armcostmanagement.KpiProperties{ - // { - // Type: to.Ptr(armcostmanagement.KpiTypeForecast), - // Enabled: to.Ptr(true), - // }, - // { - // Type: to.Ptr(armcostmanagement.KpiTypeBudget), - // Enabled: to.Ptr(true), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo"), - // }}, - // Metric: to.Ptr(armcostmanagement.MetricTypeActualCost), - // Pivots: []*armcostmanagement.PivotProperties{ - // { - // Name: to.Ptr("ServiceName"), - // Type: to.Ptr(armcostmanagement.PivotTypeDimension), - // }, - // { - // Name: to.Ptr("MeterCategory"), - // Type: to.Ptr(armcostmanagement.PivotTypeDimension), - // }, - // { - // Name: to.Ptr("swaggerTagKey"), - // Type: to.Ptr(armcostmanagement.PivotTypeTagKey), - // }}, - // Query: &armcostmanagement.ReportConfigDefinition{ - // Type: to.Ptr(armcostmanagement.ReportTypeUsage), - // DataSet: &armcostmanagement.ReportConfigDataset{ - // Aggregation: map[string]*armcostmanagement.ReportConfigAggregation{ - // "totalCost": &armcostmanagement.ReportConfigAggregation{ - // Name: to.Ptr("PreTaxCost"), - // Function: to.Ptr(armcostmanagement.FunctionTypeSum), - // }, - // }, - // Granularity: to.Ptr(armcostmanagement.ReportGranularityTypeDaily), - // Grouping: []*armcostmanagement.ReportConfigGrouping{ - // }, - // Sorting: []*armcostmanagement.ReportConfigSorting{ - // { - // Name: to.Ptr("UsageDate"), - // Direction: to.Ptr(armcostmanagement.ReportConfigSortingTypeAscending), - // }}, - // }, - // Timeframe: to.Ptr(armcostmanagement.ReportTimeframeType("LastMonthToDate")), - // }, - // Scope: to.Ptr(""), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ViewListByResourceGroup.json -func ExampleViewsClient_NewListByScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewViewsClient().NewListByScopePager("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ViewListResult = armcostmanagement.ViewListResult{ - // Value: []*armcostmanagement.View{ - // { - // Name: to.Ptr("swaggerExample"), - // Type: to.Ptr("Microsoft.CostManagement/Views"), - // ETag: to.Ptr("\"1d4ff9fe66f1d10\""), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/views/swaggerExample"), - // Properties: &armcostmanagement.ViewProperties{ - // Accumulated: to.Ptr(armcostmanagement.AccumulatedTypeTrue), - // Chart: to.Ptr(armcostmanagement.ChartTypeTable), - // DisplayName: to.Ptr("swagger Example"), - // Kpis: []*armcostmanagement.KpiProperties{ - // { - // Type: to.Ptr(armcostmanagement.KpiTypeForecast), - // Enabled: to.Ptr(true), - // }, - // { - // Type: to.Ptr(armcostmanagement.KpiTypeBudget), - // Enabled: to.Ptr(true), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo"), - // }}, - // Metric: to.Ptr(armcostmanagement.MetricTypeActualCost), - // Pivots: []*armcostmanagement.PivotProperties{ - // { - // Name: to.Ptr("ServiceName"), - // Type: to.Ptr(armcostmanagement.PivotTypeDimension), - // }, - // { - // Name: to.Ptr("MeterCategory"), - // Type: to.Ptr(armcostmanagement.PivotTypeDimension), - // }, - // { - // Name: to.Ptr("swaggerTagKey"), - // Type: to.Ptr(armcostmanagement.PivotTypeTagKey), - // }}, - // Query: &armcostmanagement.ReportConfigDefinition{ - // Type: to.Ptr(armcostmanagement.ReportTypeUsage), - // DataSet: &armcostmanagement.ReportConfigDataset{ - // Aggregation: map[string]*armcostmanagement.ReportConfigAggregation{ - // "totalCost": &armcostmanagement.ReportConfigAggregation{ - // Name: to.Ptr("PreTaxCost"), - // Function: to.Ptr(armcostmanagement.FunctionTypeSum), - // }, - // }, - // Granularity: to.Ptr(armcostmanagement.ReportGranularityTypeDaily), - // Grouping: []*armcostmanagement.ReportConfigGrouping{ - // }, - // Sorting: []*armcostmanagement.ReportConfigSorting{ - // { - // Name: to.Ptr("UsageDate"), - // Direction: to.Ptr(armcostmanagement.ReportConfigSortingTypeAscending), - // }}, - // }, - // Timeframe: to.Ptr(armcostmanagement.ReportTimeframeTypeMonthToDate), - // }, - // Scope: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"), - // }, - // }, - // { - // Name: to.Ptr("swaggerExample2"), - // Type: to.Ptr("Microsoft.CostManagement/Views"), - // ETag: to.Ptr("\"1d4ffa5a9c2430c\""), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/views/swaggerExample2"), - // Properties: &armcostmanagement.ViewProperties{ - // Accumulated: to.Ptr(armcostmanagement.AccumulatedTypeTrue), - // Chart: to.Ptr(armcostmanagement.ChartTypeGroupedColumn), - // DisplayName: to.Ptr("swagger Example 2"), - // Kpis: []*armcostmanagement.KpiProperties{ - // { - // Type: to.Ptr(armcostmanagement.KpiTypeForecast), - // Enabled: to.Ptr(true), - // }, - // { - // Type: to.Ptr(armcostmanagement.KpiTypeBudget), - // Enabled: to.Ptr(true), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo"), - // }}, - // Metric: to.Ptr(armcostmanagement.MetricTypeActualCost), - // Pivots: []*armcostmanagement.PivotProperties{ - // { - // Name: to.Ptr("ServiceName"), - // Type: to.Ptr(armcostmanagement.PivotTypeDimension), - // }, - // { - // Name: to.Ptr("MeterCategory"), - // Type: to.Ptr(armcostmanagement.PivotTypeDimension), - // }, - // { - // Name: to.Ptr("swaggerTagKey"), - // Type: to.Ptr(armcostmanagement.PivotTypeTagKey), - // }}, - // Query: &armcostmanagement.ReportConfigDefinition{ - // Type: to.Ptr(armcostmanagement.ReportTypeUsage), - // DataSet: &armcostmanagement.ReportConfigDataset{ - // Aggregation: map[string]*armcostmanagement.ReportConfigAggregation{ - // "totalCost": &armcostmanagement.ReportConfigAggregation{ - // Name: to.Ptr("PreTaxCost"), - // Function: to.Ptr(armcostmanagement.FunctionTypeSum), - // }, - // }, - // Granularity: to.Ptr(armcostmanagement.ReportGranularityTypeDaily), - // Grouping: []*armcostmanagement.ReportConfigGrouping{ - // }, - // Sorting: []*armcostmanagement.ReportConfigSorting{ - // { - // Name: to.Ptr("UsageDate"), - // Direction: to.Ptr(armcostmanagement.ReportConfigSortingTypeAscending), - // }}, - // }, - // Timeframe: to.Ptr(armcostmanagement.ReportTimeframeType("LastMonthToDate")), - // }, - // Scope: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/PrivateView.json -func ExampleViewsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewViewsClient().Get(ctx, "swaggerExample", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.View = armcostmanagement.View{ - // Name: to.Ptr("swaggerExample"), - // Type: to.Ptr("Microsoft.CostManagement/Views"), - // ETag: to.Ptr("\"1d4ff9fe66f1d10\""), - // ID: to.Ptr("/providers/Microsoft.CostManagement/views/swaggerExample"), - // Properties: &armcostmanagement.ViewProperties{ - // Accumulated: to.Ptr(armcostmanagement.AccumulatedTypeTrue), - // Chart: to.Ptr(armcostmanagement.ChartTypeTable), - // DisplayName: to.Ptr("swagger Example"), - // Kpis: []*armcostmanagement.KpiProperties{ - // { - // Type: to.Ptr(armcostmanagement.KpiTypeForecast), - // Enabled: to.Ptr(true), - // }, - // { - // Type: to.Ptr(armcostmanagement.KpiTypeBudget), - // Enabled: to.Ptr(true), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo"), - // }}, - // Metric: to.Ptr(armcostmanagement.MetricTypeActualCost), - // Pivots: []*armcostmanagement.PivotProperties{ - // { - // Name: to.Ptr("ServiceName"), - // Type: to.Ptr(armcostmanagement.PivotTypeDimension), - // }, - // { - // Name: to.Ptr("MeterCategory"), - // Type: to.Ptr(armcostmanagement.PivotTypeDimension), - // }, - // { - // Name: to.Ptr("swaggerTagKey"), - // Type: to.Ptr(armcostmanagement.PivotTypeTagKey), - // }}, - // Query: &armcostmanagement.ReportConfigDefinition{ - // Type: to.Ptr(armcostmanagement.ReportTypeUsage), - // DataSet: &armcostmanagement.ReportConfigDataset{ - // Aggregation: map[string]*armcostmanagement.ReportConfigAggregation{ - // "totalCost": &armcostmanagement.ReportConfigAggregation{ - // Name: to.Ptr("PreTaxCost"), - // Function: to.Ptr(armcostmanagement.FunctionTypeSum), - // }, - // }, - // Granularity: to.Ptr(armcostmanagement.ReportGranularityTypeDaily), - // Grouping: []*armcostmanagement.ReportConfigGrouping{ - // }, - // Sorting: []*armcostmanagement.ReportConfigSorting{ - // { - // Name: to.Ptr("UsageDate"), - // Direction: to.Ptr(armcostmanagement.ReportConfigSortingTypeAscending), - // }}, - // }, - // Timeframe: to.Ptr(armcostmanagement.ReportTimeframeTypeMonthToDate), - // }, - // Scope: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/PrivateViewCreateOrUpdate.json -func ExampleViewsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewViewsClient().CreateOrUpdate(ctx, "swaggerExample", armcostmanagement.View{ - ETag: to.Ptr("\"1d4ff9fe66f1d10\""), - Properties: &armcostmanagement.ViewProperties{ - Accumulated: to.Ptr(armcostmanagement.AccumulatedTypeTrue), - Chart: to.Ptr(armcostmanagement.ChartTypeTable), - DisplayName: to.Ptr("swagger Example"), - Kpis: []*armcostmanagement.KpiProperties{ - { - Type: to.Ptr(armcostmanagement.KpiTypeForecast), - Enabled: to.Ptr(true), - }, - { - Type: to.Ptr(armcostmanagement.KpiTypeBudget), - Enabled: to.Ptr(true), - ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo"), - }}, - Metric: to.Ptr(armcostmanagement.MetricTypeActualCost), - Pivots: []*armcostmanagement.PivotProperties{ - { - Name: to.Ptr("ServiceName"), - Type: to.Ptr(armcostmanagement.PivotTypeDimension), - }, - { - Name: to.Ptr("MeterCategory"), - Type: to.Ptr(armcostmanagement.PivotTypeDimension), - }, - { - Name: to.Ptr("swaggerTagKey"), - Type: to.Ptr(armcostmanagement.PivotTypeTagKey), - }}, - Query: &armcostmanagement.ReportConfigDefinition{ - Type: to.Ptr(armcostmanagement.ReportTypeUsage), - DataSet: &armcostmanagement.ReportConfigDataset{ - Aggregation: map[string]*armcostmanagement.ReportConfigAggregation{ - "totalCost": { - Name: to.Ptr("PreTaxCost"), - Function: to.Ptr(armcostmanagement.FunctionTypeSum), - }, - }, - Granularity: to.Ptr(armcostmanagement.ReportGranularityTypeDaily), - Grouping: []*armcostmanagement.ReportConfigGrouping{}, - Sorting: []*armcostmanagement.ReportConfigSorting{ - { - Name: to.Ptr("UsageDate"), - Direction: to.Ptr(armcostmanagement.ReportConfigSortingTypeAscending), - }}, - }, - Timeframe: to.Ptr(armcostmanagement.ReportTimeframeTypeMonthToDate), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.View = armcostmanagement.View{ - // Name: to.Ptr("swaggerExample"), - // Type: to.Ptr("Microsoft.CostManagement/Views"), - // ETag: to.Ptr("\"1d4ffa5a9c2430c\""), - // ID: to.Ptr("/providers/Microsoft.CostManagement/views/swaggerExample"), - // Properties: &armcostmanagement.ViewProperties{ - // Accumulated: to.Ptr(armcostmanagement.AccumulatedTypeTrue), - // Chart: to.Ptr(armcostmanagement.ChartTypeTable), - // DisplayName: to.Ptr("swagger Example"), - // Kpis: []*armcostmanagement.KpiProperties{ - // { - // Type: to.Ptr(armcostmanagement.KpiTypeForecast), - // Enabled: to.Ptr(true), - // }, - // { - // Type: to.Ptr(armcostmanagement.KpiTypeBudget), - // Enabled: to.Ptr(true), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo"), - // }}, - // Metric: to.Ptr(armcostmanagement.MetricTypeActualCost), - // Pivots: []*armcostmanagement.PivotProperties{ - // { - // Name: to.Ptr("ServiceName"), - // Type: to.Ptr(armcostmanagement.PivotTypeDimension), - // }, - // { - // Name: to.Ptr("MeterCategory"), - // Type: to.Ptr(armcostmanagement.PivotTypeDimension), - // }, - // { - // Name: to.Ptr("swaggerTagKey"), - // Type: to.Ptr(armcostmanagement.PivotTypeTagKey), - // }}, - // Query: &armcostmanagement.ReportConfigDefinition{ - // Type: to.Ptr(armcostmanagement.ReportTypeUsage), - // DataSet: &armcostmanagement.ReportConfigDataset{ - // Aggregation: map[string]*armcostmanagement.ReportConfigAggregation{ - // "totalCost": &armcostmanagement.ReportConfigAggregation{ - // Name: to.Ptr("PreTaxCost"), - // Function: to.Ptr(armcostmanagement.FunctionTypeSum), - // }, - // }, - // Granularity: to.Ptr(armcostmanagement.ReportGranularityTypeDaily), - // Grouping: []*armcostmanagement.ReportConfigGrouping{ - // }, - // Sorting: []*armcostmanagement.ReportConfigSorting{ - // { - // Name: to.Ptr("UsageDate"), - // Direction: to.Ptr(armcostmanagement.ReportConfigSortingTypeAscending), - // }}, - // }, - // Timeframe: to.Ptr(armcostmanagement.ReportTimeframeTypeMonthToDate), - // }, - // Scope: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/PrivateViewDelete.json -func ExampleViewsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewViewsClient().Delete(ctx, "TestView", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ViewByResourceGroup.json -func ExampleViewsClient_GetByScope() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewViewsClient().GetByScope(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", "swaggerExample", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.View = armcostmanagement.View{ - // Name: to.Ptr("swaggerExample"), - // Type: to.Ptr("Microsoft.CostManagement/Views"), - // ETag: to.Ptr("\"1d4ff9fe66f1d10\""), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/views/swaggerExample"), - // Properties: &armcostmanagement.ViewProperties{ - // Accumulated: to.Ptr(armcostmanagement.AccumulatedTypeTrue), - // Chart: to.Ptr(armcostmanagement.ChartTypeTable), - // DisplayName: to.Ptr("swagger Example"), - // Kpis: []*armcostmanagement.KpiProperties{ - // { - // Type: to.Ptr(armcostmanagement.KpiTypeForecast), - // Enabled: to.Ptr(true), - // }, - // { - // Type: to.Ptr(armcostmanagement.KpiTypeBudget), - // Enabled: to.Ptr(true), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo"), - // }}, - // Metric: to.Ptr(armcostmanagement.MetricTypeActualCost), - // Pivots: []*armcostmanagement.PivotProperties{ - // { - // Name: to.Ptr("ServiceName"), - // Type: to.Ptr(armcostmanagement.PivotTypeDimension), - // }, - // { - // Name: to.Ptr("MeterCategory"), - // Type: to.Ptr(armcostmanagement.PivotTypeDimension), - // }, - // { - // Name: to.Ptr("swaggerTagKey"), - // Type: to.Ptr(armcostmanagement.PivotTypeTagKey), - // }}, - // Query: &armcostmanagement.ReportConfigDefinition{ - // Type: to.Ptr(armcostmanagement.ReportTypeUsage), - // DataSet: &armcostmanagement.ReportConfigDataset{ - // Aggregation: map[string]*armcostmanagement.ReportConfigAggregation{ - // "totalCost": &armcostmanagement.ReportConfigAggregation{ - // Name: to.Ptr("PreTaxCost"), - // Function: to.Ptr(armcostmanagement.FunctionTypeSum), - // }, - // }, - // Granularity: to.Ptr(armcostmanagement.ReportGranularityTypeDaily), - // Grouping: []*armcostmanagement.ReportConfigGrouping{ - // }, - // Sorting: []*armcostmanagement.ReportConfigSorting{ - // { - // Name: to.Ptr("UsageDate"), - // Direction: to.Ptr(armcostmanagement.ReportConfigSortingTypeAscending), - // }}, - // }, - // Timeframe: to.Ptr(armcostmanagement.ReportTimeframeTypeMonthToDate), - // }, - // Scope: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ViewCreateOrUpdateByResourceGroup.json -func ExampleViewsClient_CreateOrUpdateByScope() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewViewsClient().CreateOrUpdateByScope(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", "swaggerExample", armcostmanagement.View{ - ETag: to.Ptr("\"1d4ff9fe66f1d10\""), - Properties: &armcostmanagement.ViewProperties{ - Accumulated: to.Ptr(armcostmanagement.AccumulatedTypeTrue), - Chart: to.Ptr(armcostmanagement.ChartTypeTable), - DisplayName: to.Ptr("swagger Example"), - Kpis: []*armcostmanagement.KpiProperties{ - { - Type: to.Ptr(armcostmanagement.KpiTypeForecast), - Enabled: to.Ptr(true), - }, - { - Type: to.Ptr(armcostmanagement.KpiTypeBudget), - Enabled: to.Ptr(true), - ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo"), - }}, - Metric: to.Ptr(armcostmanagement.MetricTypeActualCost), - Pivots: []*armcostmanagement.PivotProperties{ - { - Name: to.Ptr("ServiceName"), - Type: to.Ptr(armcostmanagement.PivotTypeDimension), - }, - { - Name: to.Ptr("MeterCategory"), - Type: to.Ptr(armcostmanagement.PivotTypeDimension), - }, - { - Name: to.Ptr("swaggerTagKey"), - Type: to.Ptr(armcostmanagement.PivotTypeTagKey), - }}, - Query: &armcostmanagement.ReportConfigDefinition{ - Type: to.Ptr(armcostmanagement.ReportTypeUsage), - DataSet: &armcostmanagement.ReportConfigDataset{ - Aggregation: map[string]*armcostmanagement.ReportConfigAggregation{ - "totalCost": { - Name: to.Ptr("PreTaxCost"), - Function: to.Ptr(armcostmanagement.FunctionTypeSum), - }, - }, - Granularity: to.Ptr(armcostmanagement.ReportGranularityTypeDaily), - Grouping: []*armcostmanagement.ReportConfigGrouping{}, - Sorting: []*armcostmanagement.ReportConfigSorting{ - { - Name: to.Ptr("UsageDate"), - Direction: to.Ptr(armcostmanagement.ReportConfigSortingTypeAscending), - }}, - }, - Timeframe: to.Ptr(armcostmanagement.ReportTimeframeTypeMonthToDate), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.View = armcostmanagement.View{ - // Name: to.Ptr("swaggerExample"), - // Type: to.Ptr("Microsoft.CostManagement/Views"), - // ETag: to.Ptr("\"1d4ffa5a9c2430c\""), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/views/swaggerExample"), - // Properties: &armcostmanagement.ViewProperties{ - // Accumulated: to.Ptr(armcostmanagement.AccumulatedTypeTrue), - // Chart: to.Ptr(armcostmanagement.ChartTypeTable), - // DisplayName: to.Ptr("swagger Example"), - // Kpis: []*armcostmanagement.KpiProperties{ - // { - // Type: to.Ptr(armcostmanagement.KpiTypeForecast), - // Enabled: to.Ptr(true), - // }, - // { - // Type: to.Ptr(armcostmanagement.KpiTypeBudget), - // Enabled: to.Ptr(true), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo"), - // }}, - // Metric: to.Ptr(armcostmanagement.MetricTypeActualCost), - // Pivots: []*armcostmanagement.PivotProperties{ - // { - // Name: to.Ptr("ServiceName"), - // Type: to.Ptr(armcostmanagement.PivotTypeDimension), - // }, - // { - // Name: to.Ptr("MeterCategory"), - // Type: to.Ptr(armcostmanagement.PivotTypeDimension), - // }, - // { - // Name: to.Ptr("swaggerTagKey"), - // Type: to.Ptr(armcostmanagement.PivotTypeTagKey), - // }}, - // Query: &armcostmanagement.ReportConfigDefinition{ - // Type: to.Ptr(armcostmanagement.ReportTypeUsage), - // DataSet: &armcostmanagement.ReportConfigDataset{ - // Aggregation: map[string]*armcostmanagement.ReportConfigAggregation{ - // "totalCost": &armcostmanagement.ReportConfigAggregation{ - // Name: to.Ptr("PreTaxCost"), - // Function: to.Ptr(armcostmanagement.FunctionTypeSum), - // }, - // }, - // Granularity: to.Ptr(armcostmanagement.ReportGranularityTypeDaily), - // Grouping: []*armcostmanagement.ReportConfigGrouping{ - // }, - // Sorting: []*armcostmanagement.ReportConfigSorting{ - // { - // Name: to.Ptr("UsageDate"), - // Direction: to.Ptr(armcostmanagement.ReportConfigSortingTypeAscending), - // }}, - // }, - // Timeframe: to.Ptr(armcostmanagement.ReportTimeframeTypeMonthToDate), - // }, - // Scope: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ViewDeleteByResourceGroup.json -func ExampleViewsClient_DeleteByScope() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcostmanagement.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewViewsClient().DeleteByScope(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", "TestView", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -}