diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/CHANGELOG.md b/sdk/resourcemanager/costmanagement/armcostmanagement/CHANGELOG.md index 3bce11468810..97b70f2e9409 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/CHANGELOG.md +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/CHANGELOG.md @@ -1,5 +1,184 @@ # Release History +## 2.0.0-beta.1 (2023-03-28) +### 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` +- Const `QueryColumnTypeTag` from type alias `QueryColumnType` has been removed +- Type alias `ForecastTimeframeType` has been removed +- Type alias `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` of struct `Resource` has been removed +- Field `Location` of struct `Resource` has been removed +- Field `SKU` of struct `Resource` has been removed +- Field `Tags` of struct `Resource` has been removed + +### Features Added + +- 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 `BudgetNotificationOperatorType` with values `BudgetNotificationOperatorTypeEqualTo`, `BudgetNotificationOperatorTypeGreaterThan`, `BudgetNotificationOperatorTypeGreaterThanOrEqualTo`, `BudgetNotificationOperatorTypeLessThan` +- New enum type `BudgetOperatorType` with values `BudgetOperatorTypeIn` +- New enum type `CategoryType` with values `CategoryTypeCost`, `CategoryTypeReservationUtilization` +- 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 `CultureCode` with values `CultureCodeCsCz`, `CultureCodeDaDk`, `CultureCodeDeDe`, `CultureCodeEnGb`, `CultureCodeEnUs`, `CultureCodeEsEs`, `CultureCodeFrFr`, `CultureCodeHuHu`, `CultureCodeItIt`, `CultureCodeJaJp`, `CultureCodeKoKr`, `CultureCodeNbNo`, `CultureCodeNlNl`, `CultureCodePlPl`, `CultureCodePtBr`, `CultureCodePtPt`, `CultureCodeRuRu`, `CultureCodeSvSe`, `CultureCodeTrTr`, `CultureCodeZhCn`, `CultureCodeZhTw` +- 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 `Frequency` with values `FrequencyDaily`, `FrequencyMonthly`, `FrequencyWeekly` +- 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 `ThresholdType` with values `ThresholdTypeActual`, `ThresholdTypeForecasted` +- New enum type `TimeGrainType` with values `TimeGrainTypeAnnually`, `TimeGrainTypeBillingAnnual`, `TimeGrainTypeBillingMonth`, `TimeGrainTypeBillingQuarter`, `TimeGrainTypeLast30Days`, `TimeGrainTypeLast7Days`, `TimeGrainTypeMonthly`, `TimeGrainTypeQuarterly` +- 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 `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 `NewBudgetsClient(*string, azcore.TokenCredential, *arm.ClientOptions) (*BudgetsClient, error)` +- New function `*BudgetsClient.CreateOrUpdate(context.Context, string, string, Budget, *BudgetsClientCreateOrUpdateOptions) (BudgetsClientCreateOrUpdateResponse, error)` +- New function `*BudgetsClient.Delete(context.Context, string, string, *BudgetsClientDeleteOptions) (BudgetsClientDeleteResponse, error)` +- New function `*BudgetsClient.Get(context.Context, string, string, *BudgetsClientGetOptions) (BudgetsClientGetResponse, error)` +- New function `*BudgetsClient.NewListPager(string, *BudgetsClientListOptions) *runtime.Pager[BudgetsClientListResponse]` +- New function `NewClientFactory(*string, *string, azcore.TokenCredential, *arm.ClientOptions) (*ClientFactory, error)` +- New function `*ClientFactory.NewAlertsClient() *AlertsClient` +- New function `*ClientFactory.NewBenefitRecommendationsClient() *BenefitRecommendationsClient` +- New function `*ClientFactory.NewBenefitUtilizationSummariesClient() *BenefitUtilizationSummariesClient` +- New function `*ClientFactory.NewBudgetsClient() *BudgetsClient` +- New function `*ClientFactory.NewDimensionsClient() *DimensionsClient` +- New function `*ClientFactory.NewExportsClient() *ExportsClient` +- New function `*ClientFactory.NewForecastClient() *ForecastClient` +- New function `*ClientFactory.NewGenerateCostDetailsReportClient() *GenerateCostDetailsReportClient` +- New function `*ClientFactory.NewGenerateDetailedCostReportClient() *GenerateDetailedCostReportClient` +- New function `*ClientFactory.NewGenerateDetailedCostReportOperationResultsClient() *GenerateDetailedCostReportOperationResultsClient` +- New function `*ClientFactory.NewGenerateDetailedCostReportOperationStatusClient() *GenerateDetailedCostReportOperationStatusClient` +- New function `*ClientFactory.NewGenerateReservationDetailsReportClient() *GenerateReservationDetailsReportClient` +- New function `*ClientFactory.NewOperationsClient() *OperationsClient` +- New function `*ClientFactory.NewPriceSheetClient() *PriceSheetClient` +- New function `*ClientFactory.NewQueryClient() *QueryClient` +- New function `*ClientFactory.NewScheduledActionsClient() *ScheduledActionsClient` +- New function `*ClientFactory.NewViewsClient() *ViewsClient` +- 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 `PossibleGrainValues() []Grain` +- 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 `*SavingsPlanUtilizationSummary.GetBenefitUtilizationSummary() *BenefitUtilizationSummary` +- New function `NewScheduledActionsClient(*string, 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 `BenefitRecommendationModel` +- New struct `BenefitRecommendationsListResult` +- New struct `BenefitResource` +- New struct `BenefitUtilizationSummariesListResult` +- New struct `BenefitUtilizationSummaryProperties` +- New struct `BlobInfo` +- New struct `Budget` +- New struct `BudgetComparisonExpression` +- New struct `BudgetFilter` +- New struct `BudgetFilterProperties` +- New struct `BudgetProperties` +- New struct `BudgetTimePeriod` +- New struct `BudgetsListResult` +- New struct `CheckNameAvailabilityRequest` +- New struct `CheckNameAvailabilityResponse` +- New struct `ClientFactory` +- New struct `CostDetailsOperationResults` +- New struct `CostDetailsTimePeriod` +- New struct `CurrentSpend` +- 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 `ForecastSpend` +- New struct `ForecastTimePeriod` +- New struct `GenerateCostDetailsReportErrorResponse` +- New struct `GenerateCostDetailsReportRequestDefinition` +- New struct `IncludedQuantityUtilizationSummary` +- New struct `IncludedQuantityUtilizationSummaryProperties` +- New struct `Notification` +- 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 `ActionType` in struct `Operation` +- New field `IsDataAction` in struct `Operation` +- New field `Origin` in struct `Operation` + + ## 1.0.0 (2022-05-18) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_alerts_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/alerts_client.go similarity index 60% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_alerts_client.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/alerts_client.go index dbf434140de9..21167787dc07 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_alerts_client.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/alerts_client.go @@ -5,6 +5,7 @@ // 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 @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,54 +24,46 @@ import ( // AlertsClient contains the methods for the Alerts group. // Don't use this type directly, use NewAlertsClient() instead. type AlertsClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewAlertsClient creates a new instance of AlertsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewAlertsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".AlertsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &AlertsClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // Dismiss - Dismisses the specified alert // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// scope - The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for -// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount -// scope, -// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// alertID - Alert ID -// parameters - Parameters supplied to the Dismiss Alert operation. -// options - AlertsClientDismissOptions contains the optional parameters for the AlertsClient.Dismiss method. +// +// Generated from API version 2023-04-01-preview +// - scope - The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription +// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for +// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount +// scope, +// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' +// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' +// for invoiceSection scope, and +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. +// - alertID - Alert ID +// - parameters - Parameters supplied to the Dismiss Alert operation. +// - options - AlertsClientDismissOptions contains the optional parameters for the AlertsClient.Dismiss method. func (client *AlertsClient) Dismiss(ctx context.Context, scope string, alertID string, parameters DismissAlertPayload, options *AlertsClientDismissOptions) (AlertsClientDismissResponse, error) { req, err := client.dismissCreateRequest(ctx, scope, alertID, parameters, options) if err != nil { return AlertsClientDismissResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AlertsClientDismissResponse{}, err } @@ -87,12 +78,12 @@ func (client *AlertsClient) dismissCreateRequest(ctx context.Context, scope stri urlPath := "/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}" urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) urlPath = strings.ReplaceAll(urlPath, "{alertId}", alertID) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -109,25 +100,26 @@ 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 -// scope - The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for -// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount -// scope, -// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// alertID - Alert ID -// options - AlertsClientGetOptions contains the optional parameters for the AlertsClient.Get method. +// +// Generated from API version 2023-04-01-preview +// - scope - The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription +// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for +// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount +// scope, +// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' +// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' +// for invoiceSection scope, and +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. +// - alertID - Alert ID +// - options - AlertsClientGetOptions contains the optional parameters for the AlertsClient.Get method. func (client *AlertsClient) Get(ctx context.Context, scope string, alertID string, options *AlertsClientGetOptions) (AlertsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, scope, alertID, options) if err != nil { return AlertsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AlertsClientGetResponse{}, err } @@ -142,12 +134,12 @@ func (client *AlertsClient) getCreateRequest(ctx context.Context, scope string, urlPath := "/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}" urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) urlPath = strings.ReplaceAll(urlPath, "{alertId}", alertID) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -164,24 +156,25 @@ 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 -// scope - The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for -// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount -// scope, -// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// options - AlertsClientListOptions contains the optional parameters for the AlertsClient.List method. +// +// Generated from API version 2023-04-01-preview +// - scope - The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription +// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for +// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount +// scope, +// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' +// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' +// for invoiceSection scope, and +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. +// - options - AlertsClientListOptions contains the optional parameters for the AlertsClient.List method. func (client *AlertsClient) List(ctx context.Context, scope string, options *AlertsClientListOptions) (AlertsClientListResponse, error) { req, err := client.listCreateRequest(ctx, scope, options) if err != nil { return AlertsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AlertsClientListResponse{}, err } @@ -195,12 +188,12 @@ func (client *AlertsClient) List(ctx context.Context, scope string, options *Ale func (client *AlertsClient) listCreateRequest(ctx context.Context, scope string, options *AlertsClientListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.CostManagement/alerts" urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -217,18 +210,19 @@ 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 -// externalCloudProviderType - The external cloud provider type associated with dimension/query operations. This includes -// 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. -// externalCloudProviderID - This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for -// consolidated account used with dimension/query operations. -// options - AlertsClientListExternalOptions contains the optional parameters for the AlertsClient.ListExternal method. +// +// Generated from API version 2023-04-01-preview +// - externalCloudProviderType - The external cloud provider type associated with dimension/query operations. This includes +// 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. +// - externalCloudProviderID - This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for +// consolidated account used with dimension/query operations. +// - options - AlertsClientListExternalOptions contains the optional parameters for the AlertsClient.ListExternal method. func (client *AlertsClient) ListExternal(ctx context.Context, externalCloudProviderType ExternalCloudProviderType, externalCloudProviderID string, options *AlertsClientListExternalOptions) (AlertsClientListExternalResponse, error) { req, err := client.listExternalCreateRequest(ctx, externalCloudProviderType, externalCloudProviderID, options) if err != nil { return AlertsClientListExternalResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AlertsClientListExternalResponse{}, err } @@ -249,12 +243,12 @@ func (client *AlertsClient) listExternalCreateRequest(ctx context.Context, exter return nil, errors.New("parameter externalCloudProviderID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{externalCloudProviderId}", url.PathEscape(externalCloudProviderID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/autorest.md b/sdk/resourcemanager/costmanagement/armcostmanagement/autorest.md index fb871c91e90d..417ba51a501e 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.0.0 +module-version: 2.0.0-beta.1 ``` \ 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..3f571c07f4f0 --- /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-04-01-preview +// - 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-04-01-preview") + 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..98791a2c491d --- /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-04-01-preview +// - 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-04-01-preview") + 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-04-01-preview +// - 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-04-01-preview") + 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-04-01-preview +// - 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-04-01-preview") + 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-04-01-preview +// - 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-04-01-preview") + 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/budgets_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/budgets_client.go new file mode 100644 index 000000000000..67b8955e9fe3 --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/budgets_client.go @@ -0,0 +1,421 @@ +//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" +) + +// BudgetsClient contains the methods for the Budgets group. +// Don't use this type directly, use NewBudgetsClient() instead. +type BudgetsClient struct { + internal *arm.Client + filter *string +} + +// NewBudgetsClient creates a new instance of BudgetsClient with the specified values. +// - filter - OData filter option. May be used to filter budgets by properties/category. The filter supports 'eq' only. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewBudgetsClient(filter *string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BudgetsClient, error) { + cl, err := arm.NewClient(moduleName+".BudgetsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BudgetsClient{ + filter: filter, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - The operation to create or update a budget. You can optionally provide an eTag if desired as a form of +// concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior +// to your put operation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-01-preview +// +// - scope - The scope associated with budget operations. +// Supported scopes for CategoryType: Cost +// Azure RBAC Scopes: +// +// - '/subscriptions/{subscriptionId}/' for subscription scope +// +// - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope +// +// - '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope +// +// EA (Enterprise Agreement) Scopes: +// +// - '/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 +// +// MCA (Modern Customer Agreement) Scopes: +// +// - '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope +// +// - '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile +// scope +// +// - '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' +// for invoiceSection scope +// +// - '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' for customer scope (CSP only) +// +// Supported scopes for CategoryType: ReservationUtilization +// +// EA (Enterprise Agreement) Scopes: +// +// - '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account Scope +// +// MCA (Modern Customer Agreement) Scopes: +// +// - '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile +// scope +// +// - budgetName - Budget Name. +// +// - parameters - Parameters supplied to the Create Budget operation. +// +// - options - BudgetsClientCreateOrUpdateOptions contains the optional parameters for the BudgetsClient.CreateOrUpdate method. +func (client *BudgetsClient) CreateOrUpdate(ctx context.Context, scope string, budgetName string, parameters Budget, options *BudgetsClientCreateOrUpdateOptions) (BudgetsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, scope, budgetName, parameters, options) + if err != nil { + return BudgetsClientCreateOrUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BudgetsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return BudgetsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *BudgetsClient) createOrUpdateCreateRequest(ctx context.Context, scope string, budgetName string, parameters Budget, options *BudgetsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.CostManagement/budgets/{budgetName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if budgetName == "" { + return nil, errors.New("parameter budgetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{budgetName}", url.PathEscape(budgetName)) + 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-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *BudgetsClient) createOrUpdateHandleResponse(resp *http.Response) (BudgetsClientCreateOrUpdateResponse, error) { + result := BudgetsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Budget); err != nil { + return BudgetsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - The operation to delete a budget. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-01-preview +// +// - scope - The scope associated with budget operations. +// Supported scopes for CategoryType: Cost +// Azure RBAC Scopes: +// +// - '/subscriptions/{subscriptionId}/' for subscription scope +// +// - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope +// +// - '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope +// +// EA (Enterprise Agreement) Scopes: +// +// - '/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 +// +// MCA (Modern Customer Agreement) Scopes: +// +// - '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope +// +// - '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile +// scope +// +// - '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' +// for invoiceSection scope +// +// - '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' for customer scope (CSP only) +// +// Supported scopes for CategoryType: ReservationUtilization +// +// EA (Enterprise Agreement) Scopes: +// +// - '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account Scope +// +// MCA (Modern Customer Agreement) Scopes: +// +// - '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile +// scope +// +// - budgetName - Budget Name. +// +// - options - BudgetsClientDeleteOptions contains the optional parameters for the BudgetsClient.Delete method. +func (client *BudgetsClient) Delete(ctx context.Context, scope string, budgetName string, options *BudgetsClientDeleteOptions) (BudgetsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, scope, budgetName, options) + if err != nil { + return BudgetsClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BudgetsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BudgetsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return BudgetsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *BudgetsClient) deleteCreateRequest(ctx context.Context, scope string, budgetName string, options *BudgetsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.CostManagement/budgets/{budgetName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if budgetName == "" { + return nil, errors.New("parameter budgetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{budgetName}", url.PathEscape(budgetName)) + 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-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the budget for the scope by budget name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-01-preview +// +// - scope - The scope associated with budget operations. +// Supported scopes for CategoryType: Cost +// Azure RBAC Scopes: +// +// - '/subscriptions/{subscriptionId}/' for subscription scope +// +// - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope +// +// - '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope +// +// EA (Enterprise Agreement) Scopes: +// +// - '/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 +// +// MCA (Modern Customer Agreement) Scopes: +// +// - '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope +// +// - '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile +// scope +// +// - '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' +// for invoiceSection scope +// +// - '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' for customer scope (CSP only) +// +// Supported scopes for CategoryType: ReservationUtilization +// +// EA (Enterprise Agreement) Scopes: +// +// - '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account Scope +// +// MCA (Modern Customer Agreement) Scopes: +// +// - '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile +// scope +// +// - budgetName - Budget Name. +// +// - options - BudgetsClientGetOptions contains the optional parameters for the BudgetsClient.Get method. +func (client *BudgetsClient) Get(ctx context.Context, scope string, budgetName string, options *BudgetsClientGetOptions) (BudgetsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, scope, budgetName, options) + if err != nil { + return BudgetsClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BudgetsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BudgetsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *BudgetsClient) getCreateRequest(ctx context.Context, scope string, budgetName string, options *BudgetsClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.CostManagement/budgets/{budgetName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if budgetName == "" { + return nil, errors.New("parameter budgetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{budgetName}", url.PathEscape(budgetName)) + 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-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *BudgetsClient) getHandleResponse(resp *http.Response) (BudgetsClientGetResponse, error) { + result := BudgetsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Budget); err != nil { + return BudgetsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all budgets for the defined scope. +// +// Generated from API version 2023-04-01-preview +// +// - scope - The scope associated with budget operations. +// Supported scopes for CategoryType: Cost +// Azure RBAC Scopes: +// +// - '/subscriptions/{subscriptionId}/' for subscription scope +// +// - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope +// +// - '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope +// +// EA (Enterprise Agreement) Scopes: +// +// - '/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 +// +// MCA (Modern Customer Agreement) Scopes: +// +// - '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope +// +// - '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile +// scope +// +// - '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' +// for invoiceSection scope +// +// - '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' for customer scope (CSP only) +// +// Supported scopes for CategoryType: ReservationUtilization +// +// EA (Enterprise Agreement) Scopes: +// +// - '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account Scope +// +// MCA (Modern Customer Agreement) Scopes: +// +// - '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile +// scope +// +// - options - BudgetsClientListOptions contains the optional parameters for the BudgetsClient.NewListPager method. +func (client *BudgetsClient) NewListPager(scope string, options *BudgetsClientListOptions) *runtime.Pager[BudgetsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[BudgetsClientListResponse]{ + More: func(page BudgetsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *BudgetsClientListResponse) (BudgetsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scope, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return BudgetsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BudgetsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BudgetsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *BudgetsClient) listCreateRequest(ctx context.Context, scope string, options *BudgetsClientListOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.CostManagement/budgets" + urlPath = strings.ReplaceAll(urlPath, "{scope}", 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-04-01-preview") + if client.filter != nil { + reqQP.Set("$filter", *client.filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *BudgetsClient) listHandleResponse(resp *http.Response) (BudgetsClientListResponse, error) { + result := BudgetsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BudgetsListResult); err != nil { + return BudgetsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/client_factory.go b/sdk/resourcemanager/costmanagement/armcostmanagement/client_factory.go new file mode 100644 index 000000000000..8b134505ddbd --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/client_factory.go @@ -0,0 +1,126 @@ +//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 ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + filter *string + ifMatch *string + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - filter - OData filter option. May be used to filter budgets by properties/category. The filter supports 'eq' only. +// - ifMatch - ETag of the Entity. Not required when creating an entity, but required when updating an entity. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(filter *string, ifMatch *string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + filter: filter, ifMatch: ifMatch, credential: credential, + options: options.Clone(), + }, 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) NewBudgetsClient() *BudgetsClient { + subClient, _ := NewBudgetsClient(c.filter, 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 +} + +func (c *ClientFactory) NewGenerateDetailedCostReportOperationResultsClient() *GenerateDetailedCostReportOperationResultsClient { + subClient, _ := NewGenerateDetailedCostReportOperationResultsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewGenerateDetailedCostReportOperationStatusClient() *GenerateDetailedCostReportOperationStatusClient { + subClient, _ := NewGenerateDetailedCostReportOperationStatusClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewViewsClient() *ViewsClient { + subClient, _ := NewViewsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAlertsClient() *AlertsClient { + subClient, _ := NewAlertsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewForecastClient() *ForecastClient { + subClient, _ := NewForecastClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewDimensionsClient() *DimensionsClient { + subClient, _ := NewDimensionsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewQueryClient() *QueryClient { + subClient, _ := NewQueryClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewGenerateReservationDetailsReportClient() *GenerateReservationDetailsReportClient { + subClient, _ := NewGenerateReservationDetailsReportClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPriceSheetClient() *PriceSheetClient { + subClient, _ := NewPriceSheetClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewScheduledActionsClient() *ScheduledActionsClient { + subClient, _ := NewScheduledActionsClient(c.ifMatch, c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/constants.go b/sdk/resourcemanager/costmanagement/armcostmanagement/constants.go new file mode 100644 index 000000000000..5c84baec1fa5 --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/constants.go @@ -0,0 +1,1344 @@ +//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 + +const ( + moduleName = "armcostmanagement" + moduleVersion = "v2.0.0-beta.1" +) + +// AccumulatedType - Show costs accumulated over time. +type AccumulatedType string + +const ( + AccumulatedTypeFalse AccumulatedType = "false" + AccumulatedTypeTrue AccumulatedType = "true" +) + +// PossibleAccumulatedTypeValues returns the possible values for the AccumulatedType const type. +func PossibleAccumulatedTypeValues() []AccumulatedType { + return []AccumulatedType{ + AccumulatedTypeFalse, + AccumulatedTypeTrue, + } +} + +// 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 + +const ( + AlertCategoryBilling AlertCategory = "Billing" + AlertCategoryCost AlertCategory = "Cost" + AlertCategorySystem AlertCategory = "System" + AlertCategoryUsage AlertCategory = "Usage" +) + +// PossibleAlertCategoryValues returns the possible values for the AlertCategory const type. +func PossibleAlertCategoryValues() []AlertCategory { + return []AlertCategory{ + AlertCategoryBilling, + AlertCategoryCost, + AlertCategorySystem, + AlertCategoryUsage, + } +} + +// AlertCriteria - Criteria that triggered alert +type AlertCriteria string + +const ( + AlertCriteriaCostThresholdExceeded AlertCriteria = "CostThresholdExceeded" + AlertCriteriaCreditThresholdApproaching AlertCriteria = "CreditThresholdApproaching" + AlertCriteriaCreditThresholdReached AlertCriteria = "CreditThresholdReached" + AlertCriteriaCrossCloudCollectionError AlertCriteria = "CrossCloudCollectionError" + AlertCriteriaCrossCloudNewDataAvailable AlertCriteria = "CrossCloudNewDataAvailable" + AlertCriteriaForecastCostThresholdExceeded AlertCriteria = "ForecastCostThresholdExceeded" + AlertCriteriaForecastUsageThresholdExceeded AlertCriteria = "ForecastUsageThresholdExceeded" + AlertCriteriaGeneralThresholdError AlertCriteria = "GeneralThresholdError" + AlertCriteriaInvoiceDueDateApproaching AlertCriteria = "InvoiceDueDateApproaching" + AlertCriteriaInvoiceDueDateReached AlertCriteria = "InvoiceDueDateReached" + AlertCriteriaMultiCurrency AlertCriteria = "MultiCurrency" + AlertCriteriaQuotaThresholdApproaching AlertCriteria = "QuotaThresholdApproaching" + AlertCriteriaQuotaThresholdReached AlertCriteria = "QuotaThresholdReached" + AlertCriteriaUsageThresholdExceeded AlertCriteria = "UsageThresholdExceeded" +) + +// PossibleAlertCriteriaValues returns the possible values for the AlertCriteria const type. +func PossibleAlertCriteriaValues() []AlertCriteria { + return []AlertCriteria{ + AlertCriteriaCostThresholdExceeded, + AlertCriteriaCreditThresholdApproaching, + AlertCriteriaCreditThresholdReached, + AlertCriteriaCrossCloudCollectionError, + AlertCriteriaCrossCloudNewDataAvailable, + AlertCriteriaForecastCostThresholdExceeded, + AlertCriteriaForecastUsageThresholdExceeded, + AlertCriteriaGeneralThresholdError, + AlertCriteriaInvoiceDueDateApproaching, + AlertCriteriaInvoiceDueDateReached, + AlertCriteriaMultiCurrency, + AlertCriteriaQuotaThresholdApproaching, + AlertCriteriaQuotaThresholdReached, + AlertCriteriaUsageThresholdExceeded, + } +} + +// AlertOperator - operator used to compare currentSpend with amount +type AlertOperator string + +const ( + AlertOperatorEqualTo AlertOperator = "EqualTo" + AlertOperatorGreaterThan AlertOperator = "GreaterThan" + AlertOperatorGreaterThanOrEqualTo AlertOperator = "GreaterThanOrEqualTo" + AlertOperatorLessThan AlertOperator = "LessThan" + AlertOperatorLessThanOrEqualTo AlertOperator = "LessThanOrEqualTo" + AlertOperatorNone AlertOperator = "None" +) + +// PossibleAlertOperatorValues returns the possible values for the AlertOperator const type. +func PossibleAlertOperatorValues() []AlertOperator { + return []AlertOperator{ + AlertOperatorEqualTo, + AlertOperatorGreaterThan, + AlertOperatorGreaterThanOrEqualTo, + AlertOperatorLessThan, + AlertOperatorLessThanOrEqualTo, + AlertOperatorNone, + } +} + +// AlertSource - Source of alert +type AlertSource string + +const ( + AlertSourcePreset AlertSource = "Preset" + AlertSourceUser AlertSource = "User" +) + +// PossibleAlertSourceValues returns the possible values for the AlertSource const type. +func PossibleAlertSourceValues() []AlertSource { + return []AlertSource{ + AlertSourcePreset, + AlertSourceUser, + } +} + +// AlertStatus - alert status +type AlertStatus string + +const ( + AlertStatusActive AlertStatus = "Active" + AlertStatusDismissed AlertStatus = "Dismissed" + AlertStatusNone AlertStatus = "None" + AlertStatusOverridden AlertStatus = "Overridden" + AlertStatusResolved AlertStatus = "Resolved" +) + +// PossibleAlertStatusValues returns the possible values for the AlertStatus const type. +func PossibleAlertStatusValues() []AlertStatus { + return []AlertStatus{ + AlertStatusActive, + AlertStatusDismissed, + AlertStatusNone, + AlertStatusOverridden, + AlertStatusResolved, + } +} + +// AlertTimeGrainType - Type of timegrain cadence +type AlertTimeGrainType string + +const ( + AlertTimeGrainTypeAnnually AlertTimeGrainType = "Annually" + AlertTimeGrainTypeBillingAnnual AlertTimeGrainType = "BillingAnnual" + AlertTimeGrainTypeBillingMonth AlertTimeGrainType = "BillingMonth" + AlertTimeGrainTypeBillingQuarter AlertTimeGrainType = "BillingQuarter" + AlertTimeGrainTypeMonthly AlertTimeGrainType = "Monthly" + AlertTimeGrainTypeNone AlertTimeGrainType = "None" + AlertTimeGrainTypeQuarterly AlertTimeGrainType = "Quarterly" +) + +// PossibleAlertTimeGrainTypeValues returns the possible values for the AlertTimeGrainType const type. +func PossibleAlertTimeGrainTypeValues() []AlertTimeGrainType { + return []AlertTimeGrainType{ + AlertTimeGrainTypeAnnually, + AlertTimeGrainTypeBillingAnnual, + AlertTimeGrainTypeBillingMonth, + AlertTimeGrainTypeBillingQuarter, + AlertTimeGrainTypeMonthly, + AlertTimeGrainTypeNone, + AlertTimeGrainTypeQuarterly, + } +} + +// AlertType - type of alert +type AlertType string + +const ( + AlertTypeBudget AlertType = "Budget" + AlertTypeBudgetForecast AlertType = "BudgetForecast" + AlertTypeCredit AlertType = "Credit" + AlertTypeGeneral AlertType = "General" + AlertTypeInvoice AlertType = "Invoice" + AlertTypeQuota AlertType = "Quota" + AlertTypeXCloud AlertType = "xCloud" +) + +// PossibleAlertTypeValues returns the possible values for the AlertType const type. +func PossibleAlertTypeValues() []AlertType { + return []AlertType{ + AlertTypeBudget, + AlertTypeBudgetForecast, + AlertTypeCredit, + AlertTypeGeneral, + AlertTypeInvoice, + AlertTypeQuota, + AlertTypeXCloud, + } +} + +// 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, + } +} + +// BudgetNotificationOperatorType - The comparison operator. +// Supported for CategoryType(s): Cost, ReservationUtilization. +// Supported operators for CategoryType: Cost +// * GreaterThan +// +// * GreaterThanOrEqualTo +// +// Supported operators for CategoryType: ReservationUtilization +// +// * LessThan +type BudgetNotificationOperatorType string + +const ( + // BudgetNotificationOperatorTypeEqualTo - Notification will be triggered if the evaluated cost is the same as threshold value. + // Note: It’s not recommended to use this OperatorType as there’s low chance of cost being exactly the same as threshold value, + // leading to missing of your alert. This OperatorType will be deprecated in future. + // Supported for CategoryType(s): Cost. + BudgetNotificationOperatorTypeEqualTo BudgetNotificationOperatorType = "EqualTo" + // BudgetNotificationOperatorTypeGreaterThan - Notification will be triggered if the evaluated cost is greater than the threshold + // value. Note: This is the recommended OperatorType while configuring Budget Alert. + // Supported for CategoryType(s): Cost. + BudgetNotificationOperatorTypeGreaterThan BudgetNotificationOperatorType = "GreaterThan" + // BudgetNotificationOperatorTypeGreaterThanOrEqualTo - Notification will be triggered if the evaluated cost is greater than + // or equal to the threshold value. + // Supported for CategoryType(s): Cost. + BudgetNotificationOperatorTypeGreaterThanOrEqualTo BudgetNotificationOperatorType = "GreaterThanOrEqualTo" + // BudgetNotificationOperatorTypeLessThan - Notification will be triggered if any Reservations in the scope of the Reservation + // Utilization Alert Rule have a utilization less than the threshold percentage. + // Supported for CategoryType(s): ReservationUtilization. + BudgetNotificationOperatorTypeLessThan BudgetNotificationOperatorType = "LessThan" +) + +// PossibleBudgetNotificationOperatorTypeValues returns the possible values for the BudgetNotificationOperatorType const type. +func PossibleBudgetNotificationOperatorTypeValues() []BudgetNotificationOperatorType { + return []BudgetNotificationOperatorType{ + BudgetNotificationOperatorTypeEqualTo, + BudgetNotificationOperatorTypeGreaterThan, + BudgetNotificationOperatorTypeGreaterThanOrEqualTo, + BudgetNotificationOperatorTypeLessThan, + } +} + +// BudgetOperatorType - The operator to use for comparison. +type BudgetOperatorType string + +const ( + BudgetOperatorTypeIn BudgetOperatorType = "In" +) + +// PossibleBudgetOperatorTypeValues returns the possible values for the BudgetOperatorType const type. +func PossibleBudgetOperatorTypeValues() []BudgetOperatorType { + return []BudgetOperatorType{ + BudgetOperatorTypeIn, + } +} + +// CategoryType - The category of the budget. +// * 'Cost' defines a Budget. +// * 'ReservationUtilization' defines a Reservation Utilization Alert Rule. +type CategoryType string + +const ( + // CategoryTypeCost - A Budget that evaluates monetary cost of Azure resources against an amount, and alerts based on a configured + // notification threshold. + CategoryTypeCost CategoryType = "Cost" + // CategoryTypeReservationUtilization - An Alert Rule that evaluates the utilization percentage of Azure Reservations, and + // alerts based on a configured notification threshold. + CategoryTypeReservationUtilization CategoryType = "ReservationUtilization" +) + +// PossibleCategoryTypeValues returns the possible values for the CategoryType const type. +func PossibleCategoryTypeValues() []CategoryType { + return []CategoryType{ + CategoryTypeCost, + CategoryTypeReservationUtilization, + } +} + +// ChartType - Chart type of the main view in Cost Analysis. Required. +type ChartType string + +const ( + ChartTypeArea ChartType = "Area" + ChartTypeGroupedColumn ChartType = "GroupedColumn" + ChartTypeLine ChartType = "Line" + ChartTypeStackedColumn ChartType = "StackedColumn" + ChartTypeTable ChartType = "Table" +) + +// PossibleChartTypeValues returns the possible values for the ChartType const type. +func PossibleChartTypeValues() []ChartType { + return []ChartType{ + ChartTypeArea, + ChartTypeGroupedColumn, + ChartTypeLine, + ChartTypeStackedColumn, + ChartTypeTable, + } +} + +// 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, + } +} + +// CultureCode - Language in which the recipient will receive the notification, +// Supported for CategoryType(s): Cost, ReservationUtilization. +type CultureCode string + +const ( + CultureCodeCsCz CultureCode = "cs-cz" + CultureCodeDaDk CultureCode = "da-dk" + CultureCodeDeDe CultureCode = "de-de" + CultureCodeEnGb CultureCode = "en-gb" + CultureCodeEnUs CultureCode = "en-us" + CultureCodeEsEs CultureCode = "es-es" + CultureCodeFrFr CultureCode = "fr-fr" + CultureCodeHuHu CultureCode = "hu-hu" + CultureCodeItIt CultureCode = "it-it" + CultureCodeJaJp CultureCode = "ja-jp" + CultureCodeKoKr CultureCode = "ko-kr" + CultureCodeNbNo CultureCode = "nb-no" + CultureCodeNlNl CultureCode = "nl-nl" + CultureCodePlPl CultureCode = "pl-pl" + CultureCodePtBr CultureCode = "pt-br" + CultureCodePtPt CultureCode = "pt-pt" + CultureCodeRuRu CultureCode = "ru-ru" + CultureCodeSvSe CultureCode = "sv-se" + CultureCodeTrTr CultureCode = "tr-tr" + CultureCodeZhCn CultureCode = "zh-cn" + CultureCodeZhTw CultureCode = "zh-tw" +) + +// PossibleCultureCodeValues returns the possible values for the CultureCode const type. +func PossibleCultureCodeValues() []CultureCode { + return []CultureCode{ + CultureCodeCsCz, + CultureCodeDaDk, + CultureCodeDeDe, + CultureCodeEnGb, + CultureCodeEnUs, + CultureCodeEsEs, + CultureCodeFrFr, + CultureCodeHuHu, + CultureCodeItIt, + CultureCodeJaJp, + CultureCodeKoKr, + CultureCodeNbNo, + CultureCodeNlNl, + CultureCodePlPl, + CultureCodePtBr, + CultureCodePtPt, + CultureCodeRuRu, + CultureCodeSvSe, + CultureCodeTrTr, + CultureCodeZhCn, + CultureCodeZhTw, + } +} + +// 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 ( + ExecutionStatusCompleted ExecutionStatus = "Completed" + ExecutionStatusDataNotAvailable ExecutionStatus = "DataNotAvailable" + ExecutionStatusFailed ExecutionStatus = "Failed" + ExecutionStatusInProgress ExecutionStatus = "InProgress" + ExecutionStatusNewDataNotAvailable ExecutionStatus = "NewDataNotAvailable" + ExecutionStatusQueued ExecutionStatus = "Queued" + ExecutionStatusTimeout ExecutionStatus = "Timeout" +) + +// PossibleExecutionStatusValues returns the possible values for the ExecutionStatus const type. +func PossibleExecutionStatusValues() []ExecutionStatus { + return []ExecutionStatus{ + ExecutionStatusCompleted, + ExecutionStatusDataNotAvailable, + ExecutionStatusFailed, + ExecutionStatusInProgress, + ExecutionStatusNewDataNotAvailable, + ExecutionStatusQueued, + ExecutionStatusTimeout, + } +} + +// ExecutionType - The type of the export run. +type ExecutionType string + +const ( + ExecutionTypeOnDemand ExecutionType = "OnDemand" + ExecutionTypeScheduled ExecutionType = "Scheduled" +) + +// PossibleExecutionTypeValues returns the possible values for the ExecutionType const type. +func PossibleExecutionTypeValues() []ExecutionType { + return []ExecutionType{ + ExecutionTypeOnDemand, + ExecutionTypeScheduled, + } +} + +// ExportType - The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that +// do not yet provide data for charges or amortization for service reservations. +type ExportType string + +const ( + ExportTypeActualCost ExportType = "ActualCost" + ExportTypeAmortizedCost ExportType = "AmortizedCost" + ExportTypeUsage ExportType = "Usage" +) + +// PossibleExportTypeValues returns the possible values for the ExportType const type. +func PossibleExportTypeValues() []ExportType { + return []ExportType{ + ExportTypeActualCost, + ExportTypeAmortizedCost, + ExportTypeUsage, + } +} + +type ExternalCloudProviderType string + +const ( + ExternalCloudProviderTypeExternalBillingAccounts ExternalCloudProviderType = "externalBillingAccounts" + ExternalCloudProviderTypeExternalSubscriptions ExternalCloudProviderType = "externalSubscriptions" +) + +// PossibleExternalCloudProviderTypeValues returns the possible values for the ExternalCloudProviderType const type. +func PossibleExternalCloudProviderTypeValues() []ExternalCloudProviderType { + return []ExternalCloudProviderType{ + ExternalCloudProviderTypeExternalBillingAccounts, + ExternalCloudProviderTypeExternalSubscriptions, + } +} + +// 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 ( + ForecastTimeframeCustom ForecastTimeframe = "Custom" +) + +// PossibleForecastTimeframeValues returns the possible values for the ForecastTimeframe const type. +func PossibleForecastTimeframeValues() []ForecastTimeframe { + return []ForecastTimeframe{ + ForecastTimeframeCustom, + } +} + +// ForecastType - The type of the forecast. +type ForecastType string + +const ( + ForecastTypeActualCost ForecastType = "ActualCost" + ForecastTypeAmortizedCost ForecastType = "AmortizedCost" + ForecastTypeUsage ForecastType = "Usage" +) + +// PossibleForecastTypeValues returns the possible values for the ForecastType const type. +func PossibleForecastTypeValues() []ForecastType { + return []ForecastType{ + ForecastTypeActualCost, + ForecastTypeAmortizedCost, + ForecastTypeUsage, + } +} + +// FormatType - The format of the export being delivered. Currently only 'Csv' is supported. +type FormatType string + +const ( + FormatTypeCSV FormatType = "Csv" +) + +// PossibleFormatTypeValues returns the possible values for the FormatType const type. +func PossibleFormatTypeValues() []FormatType { + return []FormatType{ + FormatTypeCSV, + } +} + +// Frequency - Frequency of a notification. Represents how long the notification will be silent after triggering an alert +// for a threshold breach. If not specified, the frequency will be set by default based on the +// timeGrain (Weekly when timeGrain: Last7Days, Monthly when timeGrain: Last30Days). +// Supported for CategoryType(s): ReservationUtilization. +type Frequency string + +const ( + // FrequencyDaily - After the threshold breaches and an Alert is fired, no further alerts will be sent until the next calendar + // day. + FrequencyDaily Frequency = "Daily" + // FrequencyMonthly - After the threshold breaches and an Alert is fired, no further alerts will be sent for 30 calendar days. + FrequencyMonthly Frequency = "Monthly" + // FrequencyWeekly - After the threshold breaches and an Alert is fired, no further alerts will be sent for 7 calendar days. + FrequencyWeekly Frequency = "Weekly" +) + +// PossibleFrequencyValues returns the possible values for the Frequency const type. +func PossibleFrequencyValues() []Frequency { + return []Frequency{ + FrequencyDaily, + FrequencyMonthly, + FrequencyWeekly, + } +} + +// 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 + +const ( + FunctionTypeSum FunctionType = "Sum" +) + +// PossibleFunctionTypeValues returns the possible values for the FunctionType const type. +func PossibleFunctionTypeValues() []FunctionType { + return []FunctionType{ + FunctionTypeSum, + } +} + +// GenerateDetailedCostReportMetricType - The type of the detailed report. By default ActualCost is provided +type GenerateDetailedCostReportMetricType string + +const ( + GenerateDetailedCostReportMetricTypeActualCost GenerateDetailedCostReportMetricType = "ActualCost" + GenerateDetailedCostReportMetricTypeAmortizedCost GenerateDetailedCostReportMetricType = "AmortizedCost" +) + +// PossibleGenerateDetailedCostReportMetricTypeValues returns the possible values for the GenerateDetailedCostReportMetricType const type. +func PossibleGenerateDetailedCostReportMetricTypeValues() []GenerateDetailedCostReportMetricType { + return []GenerateDetailedCostReportMetricType{ + GenerateDetailedCostReportMetricTypeActualCost, + GenerateDetailedCostReportMetricTypeAmortizedCost, + } +} + +// 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 + +const ( + GranularityTypeDaily GranularityType = "Daily" +) + +// PossibleGranularityTypeValues returns the possible values for the GranularityType const type. +func PossibleGranularityTypeValues() []GranularityType { + return []GranularityType{ + GranularityTypeDaily, + } +} + +// KpiType - KPI type (Forecast, Budget). +type KpiType string + +const ( + KpiTypeBudget KpiType = "Budget" + KpiTypeForecast KpiType = "Forecast" +) + +// PossibleKpiTypeValues returns the possible values for the KpiType const type. +func PossibleKpiTypeValues() []KpiType { + return []KpiType{ + KpiTypeBudget, + KpiTypeForecast, + } +} + +// 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 + +const ( + MetricTypeAHUB MetricType = "AHUB" + MetricTypeActualCost MetricType = "ActualCost" + MetricTypeAmortizedCost MetricType = "AmortizedCost" +) + +// PossibleMetricTypeValues returns the possible values for the MetricType const type. +func PossibleMetricTypeValues() []MetricType { + return []MetricType{ + MetricTypeAHUB, + MetricTypeActualCost, + MetricTypeAmortizedCost, + } +} + +// OperationStatusType - The status of the long running operation. +type OperationStatusType string + +const ( + OperationStatusTypeCompleted OperationStatusType = "Completed" + OperationStatusTypeFailed OperationStatusType = "Failed" + OperationStatusTypeRunning OperationStatusType = "Running" +) + +// PossibleOperationStatusTypeValues returns the possible values for the OperationStatusType const type. +func PossibleOperationStatusTypeValues() []OperationStatusType { + return []OperationStatusType{ + OperationStatusTypeCompleted, + OperationStatusTypeFailed, + OperationStatusTypeRunning, + } +} + +// OperatorType - The operator to use for comparison. +type OperatorType string + +const ( + OperatorTypeContains OperatorType = "Contains" + OperatorTypeIn OperatorType = "In" +) + +// PossibleOperatorTypeValues returns the possible values for the OperatorType const type. +func PossibleOperatorTypeValues() []OperatorType { + return []OperatorType{ + OperatorTypeContains, + OperatorTypeIn, + } +} + +// 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 + +const ( + PivotTypeDimension PivotType = "Dimension" + PivotTypeTagKey PivotType = "TagKey" +) + +// PossiblePivotTypeValues returns the possible values for the PivotType const type. +func PossiblePivotTypeValues() []PivotType { + return []PivotType{ + PivotTypeDimension, + PivotTypeTagKey, + } +} + +// QueryColumnType - The type of the column in the report. +type QueryColumnType string + +const ( + // QueryColumnTypeDimension - The dimension of cost data. + QueryColumnTypeDimension QueryColumnType = "Dimension" + // 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, + QueryColumnTypeTagKey, + } +} + +// QueryOperatorType - The operator to use for comparison. +type QueryOperatorType string + +const ( + QueryOperatorTypeIn QueryOperatorType = "In" +) + +// PossibleQueryOperatorTypeValues returns the possible values for the QueryOperatorType const type. +func PossibleQueryOperatorTypeValues() []QueryOperatorType { + return []QueryOperatorType{ + QueryOperatorTypeIn, + } +} + +// RecurrenceType - The schedule recurrence. +type RecurrenceType string + +const ( + RecurrenceTypeAnnually RecurrenceType = "Annually" + RecurrenceTypeDaily RecurrenceType = "Daily" + RecurrenceTypeMonthly RecurrenceType = "Monthly" + RecurrenceTypeWeekly RecurrenceType = "Weekly" +) + +// PossibleRecurrenceTypeValues returns the possible values for the RecurrenceType const type. +func PossibleRecurrenceTypeValues() []RecurrenceType { + return []RecurrenceType{ + RecurrenceTypeAnnually, + RecurrenceTypeDaily, + RecurrenceTypeMonthly, + RecurrenceTypeWeekly, + } +} + +// ReportConfigSortingType - Direction of sort. +type ReportConfigSortingType string + +const ( + ReportConfigSortingTypeAscending ReportConfigSortingType = "Ascending" + ReportConfigSortingTypeDescending ReportConfigSortingType = "Descending" +) + +// PossibleReportConfigSortingTypeValues returns the possible values for the ReportConfigSortingType const type. +func PossibleReportConfigSortingTypeValues() []ReportConfigSortingType { + return []ReportConfigSortingType{ + ReportConfigSortingTypeAscending, + ReportConfigSortingTypeDescending, + } +} + +// ReportGranularityType - The granularity of rows in the report. +type ReportGranularityType string + +const ( + ReportGranularityTypeDaily ReportGranularityType = "Daily" + ReportGranularityTypeMonthly ReportGranularityType = "Monthly" +) + +// PossibleReportGranularityTypeValues returns the possible values for the ReportGranularityType const type. +func PossibleReportGranularityTypeValues() []ReportGranularityType { + return []ReportGranularityType{ + ReportGranularityTypeDaily, + ReportGranularityTypeMonthly, + } +} + +// ReportOperationStatusType - The status of the long running operation. +type ReportOperationStatusType string + +const ( + ReportOperationStatusTypeCompleted ReportOperationStatusType = "Completed" + ReportOperationStatusTypeFailed ReportOperationStatusType = "Failed" + ReportOperationStatusTypeInProgress ReportOperationStatusType = "InProgress" + ReportOperationStatusTypeNoDataFound ReportOperationStatusType = "NoDataFound" + ReportOperationStatusTypeQueued ReportOperationStatusType = "Queued" + ReportOperationStatusTypeReadyToDownload ReportOperationStatusType = "ReadyToDownload" + ReportOperationStatusTypeTimedOut ReportOperationStatusType = "TimedOut" +) + +// PossibleReportOperationStatusTypeValues returns the possible values for the ReportOperationStatusType const type. +func PossibleReportOperationStatusTypeValues() []ReportOperationStatusType { + return []ReportOperationStatusType{ + ReportOperationStatusTypeCompleted, + ReportOperationStatusTypeFailed, + ReportOperationStatusTypeInProgress, + ReportOperationStatusTypeNoDataFound, + ReportOperationStatusTypeQueued, + ReportOperationStatusTypeReadyToDownload, + ReportOperationStatusTypeTimedOut, + } +} + +// ReportTimeframeType - The time frame for pulling data for the report. If custom, then a specific time period must be provided. +type ReportTimeframeType string + +const ( + ReportTimeframeTypeCustom ReportTimeframeType = "Custom" + ReportTimeframeTypeMonthToDate ReportTimeframeType = "MonthToDate" + ReportTimeframeTypeWeekToDate ReportTimeframeType = "WeekToDate" + ReportTimeframeTypeYearToDate ReportTimeframeType = "YearToDate" +) + +// PossibleReportTimeframeTypeValues returns the possible values for the ReportTimeframeType const type. +func PossibleReportTimeframeTypeValues() []ReportTimeframeType { + return []ReportTimeframeType{ + ReportTimeframeTypeCustom, + ReportTimeframeTypeMonthToDate, + ReportTimeframeTypeWeekToDate, + ReportTimeframeTypeYearToDate, + } +} + +// ReportType - The type of the report. Usage represents actual usage, forecast represents forecasted data and UsageAndForecast +// represents both usage and forecasted data. Actual usage and forecasted data can be +// differentiated based on dates. +type ReportType string + +const ( + ReportTypeUsage ReportType = "Usage" +) + +// PossibleReportTypeValues returns the possible values for the ReportType const type. +func PossibleReportTypeValues() []ReportType { + return []ReportType{ + ReportTypeUsage, + } +} + +// ReservationReportSchema - The CSV file from the reportUrl blob link consists of reservation usage data with the following +// schema at daily granularity +type ReservationReportSchema string + +const ( + ReservationReportSchemaInstanceFlexibilityGroup ReservationReportSchema = "InstanceFlexibilityGroup" + ReservationReportSchemaInstanceFlexibilityRatio ReservationReportSchema = "InstanceFlexibilityRatio" + ReservationReportSchemaInstanceID ReservationReportSchema = "InstanceId" + ReservationReportSchemaKind ReservationReportSchema = "Kind" + ReservationReportSchemaReservationID ReservationReportSchema = "ReservationId" + ReservationReportSchemaReservationOrderID ReservationReportSchema = "ReservationOrderId" + ReservationReportSchemaReservedHours ReservationReportSchema = "ReservedHours" + ReservationReportSchemaSKUName ReservationReportSchema = "SkuName" + ReservationReportSchemaTotalReservedQuantity ReservationReportSchema = "TotalReservedQuantity" + ReservationReportSchemaUsageDate ReservationReportSchema = "UsageDate" + ReservationReportSchemaUsedHours ReservationReportSchema = "UsedHours" +) + +// PossibleReservationReportSchemaValues returns the possible values for the ReservationReportSchema const type. +func PossibleReservationReportSchemaValues() []ReservationReportSchema { + return []ReservationReportSchema{ + ReservationReportSchemaInstanceFlexibilityGroup, + ReservationReportSchemaInstanceFlexibilityRatio, + ReservationReportSchemaInstanceID, + ReservationReportSchemaKind, + ReservationReportSchemaReservationID, + ReservationReportSchemaReservationOrderID, + ReservationReportSchemaReservedHours, + ReservationReportSchemaSKUName, + ReservationReportSchemaTotalReservedQuantity, + ReservationReportSchemaUsageDate, + ReservationReportSchemaUsedHours, + } +} + +// 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 + +const ( + StatusTypeActive StatusType = "Active" + StatusTypeInactive StatusType = "Inactive" +) + +// PossibleStatusTypeValues returns the possible values for the StatusType const type. +func PossibleStatusTypeValues() []StatusType { + return []StatusType{ + StatusTypeActive, + StatusTypeInactive, + } +} + +// 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, + } +} + +// ThresholdType - The type of threshold. +// Supported for CategoryType(s): Cost. +type ThresholdType string + +const ( + // ThresholdTypeActual - Actual costs budget alerts notify when the actual accrued cost exceeds the allocated budget. + ThresholdTypeActual ThresholdType = "Actual" + // ThresholdTypeForecasted - Forecasted costs budget alerts provide advanced notification that your spending trends are likely + // to exceed your allocated budget, as it relies on forecasted cost predictions. + ThresholdTypeForecasted ThresholdType = "Forecasted" +) + +// PossibleThresholdTypeValues returns the possible values for the ThresholdType const type. +func PossibleThresholdTypeValues() []ThresholdType { + return []ThresholdType{ + ThresholdTypeActual, + ThresholdTypeForecasted, + } +} + +// TimeGrainType - The time covered by a budget. Tracking of the amount will be reset based on the time grain. +// Supported for CategoryType(s): Cost, ReservationUtilization. +// Supported timeGrainTypes for CategoryType: Cost +// * Monthly +// +// * Quarterly +// +// * Annually +// +// * BillingMonth* +// +// * BillingQuarter* +// +// * BillingAnnual* +// +// *only supported for Web Direct customers. +// +// Supported timeGrainTypes for CategoryType: ReservationUtilization +// +// * Last7Days +// +// * Last30Days +// +// Required for CategoryType(s): Cost, ReservationUtilization. +type TimeGrainType string + +const ( + // TimeGrainTypeAnnually - The budget will track costs in the current calendar year against the amount. + // Supported for CategoryType: Cost only. + TimeGrainTypeAnnually TimeGrainType = "Annually" + // TimeGrainTypeBillingAnnual - The budget will track costs in the current billing year against the amount. + // Supported for CategoryType: Cost and Web Direct customers only. + TimeGrainTypeBillingAnnual TimeGrainType = "BillingAnnual" + // TimeGrainTypeBillingMonth - The budget will track costs in the current billing month against the amount. + // Supported for CategoryType: Cost and Web Direct customers only. + TimeGrainTypeBillingMonth TimeGrainType = "BillingMonth" + // TimeGrainTypeBillingQuarter - The budget will track costs in the current billing quarter against the amount. + // Supported for CategoryType: Cost and Web Direct customers only. + TimeGrainTypeBillingQuarter TimeGrainType = "BillingQuarter" + // TimeGrainTypeLast30Days - The Reservation Utilization Alert Rule will evaluate reservations based on their 30-Day utilization + // percentage. + // Supported for CategoryType: ReservationUtilization only. + TimeGrainTypeLast30Days TimeGrainType = "Last30Days" + // TimeGrainTypeLast7Days - The Reservation Utilization Alert Rule will evaluate reservations based on their 7-Day utilization + // percentage. + // Supported for CategoryType: ReservationUtilization only. + TimeGrainTypeLast7Days TimeGrainType = "Last7Days" + // TimeGrainTypeMonthly - The budget will track costs in the current calendar month against the amount. + // Supported for CategoryType: Cost only. + TimeGrainTypeMonthly TimeGrainType = "Monthly" + // TimeGrainTypeQuarterly - The budget will track costs in the current calendar quarter against the amount. + // Supported for CategoryType: Cost only. + TimeGrainTypeQuarterly TimeGrainType = "Quarterly" +) + +// PossibleTimeGrainTypeValues returns the possible values for the TimeGrainType const type. +func PossibleTimeGrainTypeValues() []TimeGrainType { + return []TimeGrainType{ + TimeGrainTypeAnnually, + TimeGrainTypeBillingAnnual, + TimeGrainTypeBillingMonth, + TimeGrainTypeBillingQuarter, + TimeGrainTypeLast30Days, + TimeGrainTypeLast7Days, + TimeGrainTypeMonthly, + TimeGrainTypeQuarterly, + } +} + +// TimeframeType - The time frame for pulling data for the export. If custom, then a specific time period must be provided. +type TimeframeType string + +const ( + TimeframeTypeBillingMonthToDate TimeframeType = "BillingMonthToDate" + TimeframeTypeCustom TimeframeType = "Custom" + TimeframeTypeMonthToDate TimeframeType = "MonthToDate" + TimeframeTypeTheLastBillingMonth TimeframeType = "TheLastBillingMonth" + TimeframeTypeTheLastMonth TimeframeType = "TheLastMonth" + TimeframeTypeWeekToDate TimeframeType = "WeekToDate" +) + +// PossibleTimeframeTypeValues returns the possible values for the TimeframeType const type. +func PossibleTimeframeTypeValues() []TimeframeType { + return []TimeframeType{ + TimeframeTypeBillingMonthToDate, + TimeframeTypeCustom, + TimeframeTypeMonthToDate, + TimeframeTypeTheLastBillingMonth, + TimeframeTypeTheLastMonth, + 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/zz_generated_dimensions_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/dimensions_client.go similarity index 70% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_dimensions_client.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/dimensions_client.go index 7e46848abf84..bae38d731055 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_dimensions_client.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/dimensions_client.go @@ -5,6 +5,7 @@ // 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 @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,41 +25,32 @@ import ( // DimensionsClient contains the methods for the Dimensions group. // Don't use this type directly, use NewDimensionsClient() instead. type DimensionsClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewDimensionsClient creates a new instance of DimensionsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewDimensionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*DimensionsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".DimensionsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &DimensionsClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // NewByExternalCloudProviderTypePager - Lists the dimensions by the external cloud provider type. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// externalCloudProviderType - The external cloud provider type associated with dimension/query operations. This includes -// 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. -// externalCloudProviderID - This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for -// consolidated account used with dimension/query operations. -// options - DimensionsClientByExternalCloudProviderTypeOptions contains the optional parameters for the DimensionsClient.ByExternalCloudProviderType -// method. +// +// Generated from API version 2023-04-01-preview +// - externalCloudProviderType - The external cloud provider type associated with dimension/query operations. This includes +// 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. +// - externalCloudProviderID - This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for +// consolidated account used with dimension/query operations. +// - options - DimensionsClientByExternalCloudProviderTypeOptions contains the optional parameters for the DimensionsClient.NewByExternalCloudProviderTypePager +// method. func (client *DimensionsClient) NewByExternalCloudProviderTypePager(externalCloudProviderType ExternalCloudProviderType, externalCloudProviderID string, options *DimensionsClientByExternalCloudProviderTypeOptions) *runtime.Pager[DimensionsClientByExternalCloudProviderTypeResponse] { return runtime.NewPager(runtime.PagingHandler[DimensionsClientByExternalCloudProviderTypeResponse]{ More: func(page DimensionsClientByExternalCloudProviderTypeResponse) bool { @@ -71,7 +61,7 @@ func (client *DimensionsClient) NewByExternalCloudProviderTypePager(externalClou if err != nil { return DimensionsClientByExternalCloudProviderTypeResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return DimensionsClientByExternalCloudProviderTypeResponse{}, err } @@ -94,12 +84,12 @@ func (client *DimensionsClient) byExternalCloudProviderTypeCreateRequest(ctx con return nil, errors.New("parameter externalCloudProviderID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{externalCloudProviderId}", url.PathEscape(externalCloudProviderID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -127,19 +117,19 @@ func (client *DimensionsClient) byExternalCloudProviderTypeHandleResponse(resp * } // NewListPager - Lists the dimensions by the defined scope. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// scope - The scope associated with dimension operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for -// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount -// scope, -// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// options - DimensionsClientListOptions contains the optional parameters for the DimensionsClient.List method. +// +// Generated from API version 2023-04-01-preview +// - scope - The scope associated with dimension operations. This includes '/subscriptions/{subscriptionId}/' for subscription +// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for +// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount +// scope, +// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' +// for billingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' +// for invoiceSection scope, and +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. +// - options - DimensionsClientListOptions contains the optional parameters for the DimensionsClient.NewListPager method. func (client *DimensionsClient) NewListPager(scope string, options *DimensionsClientListOptions) *runtime.Pager[DimensionsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[DimensionsClientListResponse]{ More: func(page DimensionsClientListResponse) bool { @@ -150,7 +140,7 @@ func (client *DimensionsClient) NewListPager(scope string, options *DimensionsCl if err != nil { return DimensionsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return DimensionsClientListResponse{}, err } @@ -166,12 +156,12 @@ func (client *DimensionsClient) NewListPager(scope string, options *DimensionsCl func (client *DimensionsClient) listCreateRequest(ctx context.Context, scope string, options *DimensionsClientListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.CostManagement/dimensions" urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_exports_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/exports_client.go similarity index 55% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_exports_client.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/exports_client.go index d830dd68ce7e..6ba1aa9abce5 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_exports_client.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/exports_client.go @@ -5,6 +5,7 @@ // 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 @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,28 +24,19 @@ import ( // ExportsClient contains the methods for the Exports group. // Don't use this type directly, use NewExportsClient() instead. type ExportsClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewExportsClient creates a new instance of ExportsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewExportsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ExportsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".ExportsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ExportsClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } @@ -55,26 +45,27 @@ func NewExportsClient(credential azcore.TokenCredential, options *arm.ClientOpti // You may obtain the latest eTag by performing a get operation. Create operation does not // require eTag. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for -// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount -// scope, -// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// exportName - Export Name. -// parameters - Parameters supplied to the CreateOrUpdate Export operation. -// options - ExportsClientCreateOrUpdateOptions contains the optional parameters for the ExportsClient.CreateOrUpdate method. +// +// Generated from API version 2023-04-01-preview +// - scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription +// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for +// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount +// scope, +// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' +// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' +// for invoiceSection scope, and +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. +// - exportName - Export Name. +// - parameters - Parameters supplied to the CreateOrUpdate Export operation. +// - options - ExportsClientCreateOrUpdateOptions contains the optional parameters for the ExportsClient.CreateOrUpdate method. func (client *ExportsClient) CreateOrUpdate(ctx context.Context, scope string, exportName string, parameters Export, options *ExportsClientCreateOrUpdateOptions) (ExportsClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, scope, exportName, parameters, options) if err != nil { return ExportsClientCreateOrUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ExportsClientCreateOrUpdateResponse{}, err } @@ -92,12 +83,12 @@ func (client *ExportsClient) createOrUpdateCreateRequest(ctx context.Context, sc return nil, errors.New("parameter exportName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{exportName}", url.PathEscape(exportName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + 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", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -114,25 +105,26 @@ 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 -// scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for -// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount -// scope, -// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// exportName - Export Name. -// options - ExportsClientDeleteOptions contains the optional parameters for the ExportsClient.Delete method. +// +// Generated from API version 2023-04-01-preview +// - scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription +// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for +// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount +// scope, +// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' +// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' +// for invoiceSection scope, and +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. +// - exportName - Export Name. +// - options - ExportsClientDeleteOptions contains the optional parameters for the ExportsClient.Delete method. func (client *ExportsClient) Delete(ctx context.Context, scope string, exportName string, options *ExportsClientDeleteOptions) (ExportsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, scope, exportName, options) if err != nil { return ExportsClientDeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ExportsClientDeleteResponse{}, err } @@ -150,38 +142,39 @@ func (client *ExportsClient) deleteCreateRequest(ctx context.Context, scope stri return nil, errors.New("parameter exportName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{exportName}", url.PathEscape(exportName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + 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", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") 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 -// scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for -// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount -// scope, -// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// exportName - Export Name. -// options - ExportsClientExecuteOptions contains the optional parameters for the ExportsClient.Execute method. +// +// Generated from API version 2023-04-01-preview +// - scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription +// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for +// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount +// scope, +// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' +// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' +// for invoiceSection scope, and +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. +// - exportName - Export Name. +// - options - ExportsClientExecuteOptions contains the optional parameters for the ExportsClient.Execute method. func (client *ExportsClient) Execute(ctx context.Context, scope string, exportName string, options *ExportsClientExecuteOptions) (ExportsClientExecuteResponse, error) { req, err := client.executeCreateRequest(ctx, scope, exportName, options) if err != nil { return ExportsClientExecuteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ExportsClientExecuteResponse{}, err } @@ -199,12 +192,12 @@ func (client *ExportsClient) executeCreateRequest(ctx context.Context, scope str return nil, errors.New("parameter exportName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{exportName}", url.PathEscape(exportName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + 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", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -212,25 +205,26 @@ 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 -// scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for -// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount -// scope, -// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// exportName - Export Name. -// options - ExportsClientGetOptions contains the optional parameters for the ExportsClient.Get method. +// +// Generated from API version 2023-04-01-preview +// - scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription +// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for +// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount +// scope, +// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' +// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' +// for invoiceSection scope, and +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. +// - exportName - Export Name. +// - options - ExportsClientGetOptions contains the optional parameters for the ExportsClient.Get method. func (client *ExportsClient) Get(ctx context.Context, scope string, exportName string, options *ExportsClientGetOptions) (ExportsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, scope, exportName, options) if err != nil { return ExportsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ExportsClientGetResponse{}, err } @@ -248,12 +242,12 @@ func (client *ExportsClient) getCreateRequest(ctx context.Context, scope string, return nil, errors.New("parameter exportName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{exportName}", url.PathEscape(exportName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -271,28 +265,29 @@ 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 -// scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for -// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount -// scope, -// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// exportName - Export Name. -// options - ExportsClientGetExecutionHistoryOptions contains the optional parameters for the ExportsClient.GetExecutionHistory -// method. +// +// Generated from API version 2023-04-01-preview +// - scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription +// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for +// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount +// scope, +// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' +// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' +// for invoiceSection scope, and +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. +// - exportName - Export Name. +// - options - ExportsClientGetExecutionHistoryOptions contains the optional parameters for the ExportsClient.GetExecutionHistory +// method. func (client *ExportsClient) GetExecutionHistory(ctx context.Context, scope string, exportName string, options *ExportsClientGetExecutionHistoryOptions) (ExportsClientGetExecutionHistoryResponse, error) { req, err := client.getExecutionHistoryCreateRequest(ctx, scope, exportName, options) if err != nil { return ExportsClientGetExecutionHistoryResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ExportsClientGetExecutionHistoryResponse{}, err } @@ -310,12 +305,12 @@ func (client *ExportsClient) getExecutionHistoryCreateRequest(ctx context.Contex return nil, errors.New("parameter exportName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{exportName}", url.PathEscape(exportName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -332,24 +327,25 @@ 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 -// scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for -// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount -// scope, -// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// options - ExportsClientListOptions contains the optional parameters for the ExportsClient.List method. +// +// Generated from API version 2023-04-01-preview +// - scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription +// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for +// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount +// scope, +// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' +// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' +// for invoiceSection scope, and +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. +// - options - ExportsClientListOptions contains the optional parameters for the ExportsClient.List method. func (client *ExportsClient) List(ctx context.Context, scope string, options *ExportsClientListOptions) (ExportsClientListResponse, error) { req, err := client.listCreateRequest(ctx, scope, options) if err != nil { return ExportsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ExportsClientListResponse{}, err } @@ -363,12 +359,12 @@ func (client *ExportsClient) List(ctx context.Context, scope string, options *Ex func (client *ExportsClient) listCreateRequest(ctx context.Context, scope string, options *ExportsClientListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.CostManagement/exports" urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_forecast_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/forecast_client.go similarity index 64% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_forecast_client.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/forecast_client.go index f55d42df15fb..52f231963d4b 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_forecast_client.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/forecast_client.go @@ -5,6 +5,7 @@ // 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 @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,48 +24,40 @@ import ( // ForecastClient contains the methods for the Forecast group. // Don't use this type directly, use NewForecastClient() instead. type ForecastClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewForecastClient creates a new instance of ForecastClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewForecastClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ForecastClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".ForecastClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ForecastClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // ExternalCloudProviderUsage - Lists the forecast charges for external cloud provider type defined. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// externalCloudProviderType - The external cloud provider type associated with dimension/query operations. This includes -// 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. -// externalCloudProviderID - This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for -// consolidated account used with dimension/query operations. -// parameters - Parameters supplied to the CreateOrUpdate Forecast Config operation. -// options - ForecastClientExternalCloudProviderUsageOptions contains the optional parameters for the ForecastClient.ExternalCloudProviderUsage -// method. +// +// Generated from API version 2023-04-01-preview +// - externalCloudProviderType - The external cloud provider type associated with dimension/query operations. This includes +// 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. +// - externalCloudProviderID - This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for +// consolidated account used with dimension/query operations. +// - parameters - Parameters supplied to the CreateOrUpdate Forecast Config operation. +// - options - ForecastClientExternalCloudProviderUsageOptions contains the optional parameters for the ForecastClient.ExternalCloudProviderUsage +// method. func (client *ForecastClient) ExternalCloudProviderUsage(ctx context.Context, externalCloudProviderType ExternalCloudProviderType, externalCloudProviderID string, parameters ForecastDefinition, options *ForecastClientExternalCloudProviderUsageOptions) (ForecastClientExternalCloudProviderUsageResponse, error) { req, err := client.externalCloudProviderUsageCreateRequest(ctx, externalCloudProviderType, externalCloudProviderID, parameters, options) if err != nil { return ForecastClientExternalCloudProviderUsageResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ForecastClientExternalCloudProviderUsageResponse{}, err } @@ -87,7 +78,7 @@ func (client *ForecastClient) externalCloudProviderUsageCreateRequest(ctx contex return nil, errors.New("parameter externalCloudProviderID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{externalCloudProviderId}", url.PathEscape(externalCloudProviderID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -95,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-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -104,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 @@ -112,25 +103,26 @@ 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 -// scope - The scope associated with forecast operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for -// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount -// scope, -// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// parameters - Parameters supplied to the CreateOrUpdate Forecast Config operation. -// options - ForecastClientUsageOptions contains the optional parameters for the ForecastClient.Usage method. +// +// Generated from API version 2023-04-01-preview +// - scope - The scope associated with forecast operations. This includes '/subscriptions/{subscriptionId}/' for subscription +// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for +// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount +// scope, +// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' +// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' +// for invoiceSection scope, and +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. +// - parameters - Parameters supplied to the CreateOrUpdate Forecast Config operation. +// - options - ForecastClientUsageOptions contains the optional parameters for the ForecastClient.Usage method. func (client *ForecastClient) Usage(ctx context.Context, scope string, parameters ForecastDefinition, options *ForecastClientUsageOptions) (ForecastClientUsageResponse, error) { req, err := client.usageCreateRequest(ctx, scope, parameters, options) if err != nil { return ForecastClientUsageResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ForecastClientUsageResponse{}, err } @@ -144,7 +136,7 @@ func (client *ForecastClient) Usage(ctx context.Context, scope string, parameter func (client *ForecastClient) usageCreateRequest(ctx context.Context, scope string, parameters ForecastDefinition, options *ForecastClientUsageOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.CostManagement/forecast" urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -152,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-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -161,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/generatecostdetailsreport_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/generatecostdetailsreport_client.go new file mode 100644 index 000000000000..8b7189318b24 --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/generatecostdetailsreport_client.go @@ -0,0 +1,180 @@ +//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. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-01-preview +// - 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. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-01-preview +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) { + 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-04-01-preview") + 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-04-01-preview +// - 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-04-01-preview +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-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreport_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreport_client.go similarity index 60% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreport_client.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreport_client.go index a5f4fa2be155..a7634275082d 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreport_client.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreport_client.go @@ -5,6 +5,7 @@ // 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 @@ -12,8 +13,6 @@ import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -23,80 +22,64 @@ import ( // GenerateDetailedCostReportClient contains the methods for the GenerateDetailedCostReport group. // Don't use this type directly, use NewGenerateDetailedCostReportClient() instead. type GenerateDetailedCostReportClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewGenerateDetailedCostReportClient creates a new instance of GenerateDetailedCostReportClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewGenerateDetailedCostReportClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GenerateDetailedCostReportClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".GenerateDetailedCostReportClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &GenerateDetailedCostReportClient{ - host: ep, - pl: pl, + internal: cl, } 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. -// parameters - Parameters supplied to the Create detailed cost report operation. -// options - GenerateDetailedCostReportClientBeginCreateOperationOptions contains the optional parameters for the GenerateDetailedCostReportClient.BeginCreateOperation -// method. +// +// Generated from API version 2023-04-01-preview +// - 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. func (client *GenerateDetailedCostReportClient) BeginCreateOperation(ctx context.Context, scope string, parameters GenerateDetailedCostReportDefinition, options *GenerateDetailedCostReportClientBeginCreateOperationOptions) (*runtime.Poller[GenerateDetailedCostReportClientCreateOperationResponse], 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.pl, &runtime.NewPollerOptions[GenerateDetailedCostReportClientCreateOperationResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GenerateDetailedCostReportClientCreateOperationResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return runtime.NewPollerFromResumeToken[GenerateDetailedCostReportClientCreateOperationResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[GenerateDetailedCostReportClientCreateOperationResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } -// 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-04-01-preview 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 { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -110,12 +93,12 @@ func (client *GenerateDetailedCostReportClient) createOperation(ctx context.Cont func (client *GenerateDetailedCostReportClient) createOperationCreateRequest(ctx context.Context, scope string, parameters GenerateDetailedCostReportDefinition, options *GenerateDetailedCostReportClientBeginCreateOperationOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport" urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + 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", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") 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/generatedetailedcostreportoperationresults_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreportoperationresults_client.go new file mode 100644 index 000000000000..aae5965f5546 --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreportoperationresults_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" +) + +// GenerateDetailedCostReportOperationResultsClient contains the methods for the GenerateDetailedCostReportOperationResults group. +// Don't use this type directly, use NewGenerateDetailedCostReportOperationResultsClient() instead. +type GenerateDetailedCostReportOperationResultsClient struct { + internal *arm.Client +} + +// NewGenerateDetailedCostReportOperationResultsClient creates a new instance of GenerateDetailedCostReportOperationResultsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewGenerateDetailedCostReportOperationResultsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GenerateDetailedCostReportOperationResultsClient, error) { + cl, err := arm.NewClient(moduleName+".GenerateDetailedCostReportOperationResultsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &GenerateDetailedCostReportOperationResultsClient{ + internal: cl, + } + return client, nil +} + +// 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 2023-04-01-preview +// - operationID - The target operation Id. +// - 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) 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-04-01-preview +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 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 +} + +// getCreateRequest creates the Get request. +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") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + urlPath = strings.ReplaceAll(urlPath, "{scope}", 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-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreportoperationstatus_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreportoperationstatus_client.go similarity index 65% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreportoperationstatus_client.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreportoperationstatus_client.go index a6e6d8cf7ec2..8c736915664f 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreportoperationstatus_client.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreportoperationstatus_client.go @@ -5,6 +5,7 @@ // 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 @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,28 +24,19 @@ import ( // GenerateDetailedCostReportOperationStatusClient contains the methods for the GenerateDetailedCostReportOperationStatus group. // Don't use this type directly, use NewGenerateDetailedCostReportOperationStatusClient() instead. type GenerateDetailedCostReportOperationStatusClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewGenerateDetailedCostReportOperationStatusClient creates a new instance of GenerateDetailedCostReportOperationStatusClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewGenerateDetailedCostReportOperationStatusClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GenerateDetailedCostReportOperationStatusClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".GenerateDetailedCostReportOperationStatusClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &GenerateDetailedCostReportOperationStatusClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } @@ -54,27 +44,19 @@ func NewGenerateDetailedCostReportOperationStatusClient(credential azcore.TokenC // Get - Get the status of the specified operation. This link is provided in the GenerateDetailedCostReport creation request // response header. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// operationID - The target operation Id. -// scope - The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for -// Billing Account scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount -// scope. Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for billingAccount -// scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile -// scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// options - GenerateDetailedCostReportOperationStatusClientGetOptions contains the optional parameters for the GenerateDetailedCostReportOperationStatusClient.Get -// method. +// +// Generated from API version 2023-04-01-preview +// - operationID - The target operation Id. +// - 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) { req, err := client.getCreateRequest(ctx, operationID, scope, options) if err != nil { return GenerateDetailedCostReportOperationStatusClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return GenerateDetailedCostReportOperationStatusClientGetResponse{}, err } @@ -92,12 +74,12 @@ func (client *GenerateDetailedCostReportOperationStatusClient) getCreateRequest( } urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatereservationdetailsreport_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/generatereservationdetailsreport_client.go similarity index 80% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatereservationdetailsreport_client.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/generatereservationdetailsreport_client.go index c7670ad08511..f65e7d6e9a52 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatereservationdetailsreport_client.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/generatereservationdetailsreport_client.go @@ -5,6 +5,7 @@ // 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 @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,28 +24,19 @@ import ( // GenerateReservationDetailsReportClient contains the methods for the GenerateReservationDetailsReport group. // Don't use this type directly, use NewGenerateReservationDetailsReportClient() instead. type GenerateReservationDetailsReportClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewGenerateReservationDetailsReportClient creates a new instance of GenerateReservationDetailsReportClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewGenerateReservationDetailsReportClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GenerateReservationDetailsReportClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".GenerateReservationDetailsReportClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &GenerateReservationDetailsReportClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } @@ -55,23 +45,24 @@ func NewGenerateReservationDetailsReportClient(credential azcore.TokenCredential // id. The Reservation usage details can be viewed only by certain enterprise roles. For more details // on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// billingAccountID - Enrollment ID (Legacy BillingAccount ID) -// startDate - Start Date -// endDate - End Date -// options - GenerateReservationDetailsReportClientBeginByBillingAccountIDOptions contains the optional parameters for the -// GenerateReservationDetailsReportClient.BeginByBillingAccountID method. +// +// Generated from API version 2023-04-01-preview +// - billingAccountID - Enrollment ID (Legacy BillingAccount ID) +// - startDate - Start Date +// - endDate - End Date +// - options - GenerateReservationDetailsReportClientBeginByBillingAccountIDOptions contains the optional parameters for the +// GenerateReservationDetailsReportClient.BeginByBillingAccountID method. func (client *GenerateReservationDetailsReportClient) BeginByBillingAccountID(ctx context.Context, billingAccountID string, startDate string, endDate string, options *GenerateReservationDetailsReportClientBeginByBillingAccountIDOptions) (*runtime.Poller[GenerateReservationDetailsReportClientByBillingAccountIDResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.byBillingAccountID(ctx, billingAccountID, startDate, endDate, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[GenerateReservationDetailsReportClientByBillingAccountIDResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GenerateReservationDetailsReportClientByBillingAccountIDResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return runtime.NewPollerFromResumeToken[GenerateReservationDetailsReportClientByBillingAccountIDResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[GenerateReservationDetailsReportClientByBillingAccountIDResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } @@ -79,13 +70,14 @@ func (client *GenerateReservationDetailsReportClient) BeginByBillingAccountID(ct // id. The Reservation usage details can be viewed only by certain enterprise roles. For more details // on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// +// Generated from API version 2023-04-01-preview 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 { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -102,14 +94,14 @@ func (client *GenerateReservationDetailsReportClient) byBillingAccountIDCreateRe 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.host, urlPath)) + 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("startDate", startDate) reqQP.Set("endDate", endDate) - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -119,24 +111,25 @@ func (client *GenerateReservationDetailsReportClient) byBillingAccountIDCreateRe // The Reservation usage details can be viewed by only certain enterprise roles by default. For more // details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// billingAccountID - BillingAccount ID -// billingProfileID - BillingProfile ID -// startDate - Start Date -// endDate - End Date -// options - GenerateReservationDetailsReportClientBeginByBillingProfileIDOptions contains the optional parameters for the -// GenerateReservationDetailsReportClient.BeginByBillingProfileID method. +// +// Generated from API version 2023-04-01-preview +// - billingAccountID - Billing account ID +// - billingProfileID - Billing profile ID. +// - startDate - Start Date +// - endDate - End Date +// - options - GenerateReservationDetailsReportClientBeginByBillingProfileIDOptions contains the optional parameters for the +// GenerateReservationDetailsReportClient.BeginByBillingProfileID method. func (client *GenerateReservationDetailsReportClient) BeginByBillingProfileID(ctx context.Context, billingAccountID string, billingProfileID string, startDate string, endDate string, options *GenerateReservationDetailsReportClientBeginByBillingProfileIDOptions) (*runtime.Poller[GenerateReservationDetailsReportClientByBillingProfileIDResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.byBillingProfileID(ctx, billingAccountID, billingProfileID, startDate, endDate, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[GenerateReservationDetailsReportClientByBillingProfileIDResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GenerateReservationDetailsReportClientByBillingProfileIDResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return runtime.NewPollerFromResumeToken[GenerateReservationDetailsReportClientByBillingProfileIDResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[GenerateReservationDetailsReportClientByBillingProfileIDResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } @@ -144,13 +137,14 @@ func (client *GenerateReservationDetailsReportClient) BeginByBillingProfileID(ct // The Reservation usage details can be viewed by only certain enterprise roles by default. For more // details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// +// Generated from API version 2023-04-01-preview 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 { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -171,14 +165,14 @@ func (client *GenerateReservationDetailsReportClient) byBillingProfileIDCreateRe 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.host, urlPath)) + 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("startDate", startDate) reqQP.Set("endDate", endDate) - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/go.mod b/sdk/resourcemanager/costmanagement/armcostmanagement/go.mod index d30fc671b6e9..20b32e41d11f 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.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect - golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect - golang.org/x/text v0.3.7 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + golang.org/x/net v0.7.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 ed5b814680ee..f54c298864a1 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/go.sum +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/go.sum @@ -1,33 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= +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/internal v1.1.2 h1:+5VZ72z0Qan5Bog5C+ZkgSqUbeVUd9wgtHOrIKuc5b8= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= 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 v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/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/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +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.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +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/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +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 new file mode 100644 index 000000000000..bd78b6c5eed0 --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/models.go @@ -0,0 +1,2639 @@ +//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 "time" + +// Alert - An individual alert. +type Alert struct { + // eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating + // the latest version or not. + ETag *string `json:"eTag,omitempty"` + + // Alert properties. + Properties *AlertProperties `json:"properties,omitempty"` + + // READ-ONLY; Resource Id. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// AlertProperties - Alert properties. +type AlertProperties struct { + // dateTime in which alert was closed + CloseTime *string `json:"closeTime,omitempty"` + + // related budget + CostEntityID *string `json:"costEntityId,omitempty"` + + // dateTime in which alert was created + CreationTime *string `json:"creationTime,omitempty"` + + // defines the type of alert + Definition *AlertPropertiesDefinition `json:"definition,omitempty"` + + // Alert description + Description *string `json:"description,omitempty"` + + // Alert details + Details *AlertPropertiesDetails `json:"details,omitempty"` + + // dateTime in which alert was last modified + ModificationTime *string `json:"modificationTime,omitempty"` + + // Source of alert + Source *AlertSource `json:"source,omitempty"` + + // alert status + Status *AlertStatus `json:"status,omitempty"` + + // dateTime in which the alert status was last modified + StatusModificationTime *string `json:"statusModificationTime,omitempty"` + + // User who last modified the alert + StatusModificationUserName *string `json:"statusModificationUserName,omitempty"` +} + +// AlertPropertiesDefinition - defines the type of alert +type AlertPropertiesDefinition struct { + // Alert category + Category *AlertCategory `json:"category,omitempty"` + + // Criteria that triggered alert + Criteria *AlertCriteria `json:"criteria,omitempty"` + + // type of alert + Type *AlertType `json:"type,omitempty"` +} + +// AlertPropertiesDetails - Alert details +type AlertPropertiesDetails struct { + // budget threshold amount + Amount *float64 `json:"amount,omitempty"` + + // company name + CompanyName *string `json:"companyName,omitempty"` + + // list of emails to contact + ContactEmails []*string `json:"contactEmails,omitempty"` + + // list of action groups to broadcast to + ContactGroups []*string `json:"contactGroups,omitempty"` + + // list of contact roles + ContactRoles []*string `json:"contactRoles,omitempty"` + + // current spend + CurrentSpend *float64 `json:"currentSpend,omitempty"` + + // department name + DepartmentName *string `json:"departmentName,omitempty"` + + // datetime of enrollmentEndDate + EnrollmentEndDate *string `json:"enrollmentEndDate,omitempty"` + + // enrollment number + EnrollmentNumber *string `json:"enrollmentNumber,omitempty"` + + // datetime of enrollmentStartDate + EnrollmentStartDate *string `json:"enrollmentStartDate,omitempty"` + + // invoicing threshold + InvoicingThreshold *float64 `json:"invoicingThreshold,omitempty"` + + // array of meters to filter by + MeterFilter []any `json:"meterFilter,omitempty"` + + // operator used to compare currentSpend with amount + Operator *AlertOperator `json:"operator,omitempty"` + + // overriding alert + OverridingAlert *string `json:"overridingAlert,omitempty"` + + // datetime of periodStartDate + PeriodStartDate *string `json:"periodStartDate,omitempty"` + + // array of resources to filter by + ResourceFilter []any `json:"resourceFilter,omitempty"` + + // array of resourceGroups to filter by + ResourceGroupFilter []any `json:"resourceGroupFilter,omitempty"` + + // tags to filter by + TagFilter any `json:"tagFilter,omitempty"` + + // notification threshold percentage as a decimal which activated this alert + Threshold *float64 `json:"threshold,omitempty"` + + // Type of timegrain cadence + TimeGrainType *AlertTimeGrainType `json:"timeGrainType,omitempty"` + + // notificationId that triggered this alert + TriggeredBy *string `json:"triggeredBy,omitempty"` + + // unit of currency being used + Unit *string `json:"unit,omitempty"` +} + +// AlertsClientDismissOptions contains the optional parameters for the AlertsClient.Dismiss method. +type AlertsClientDismissOptions struct { + // placeholder for future optional parameters +} + +// AlertsClientGetOptions contains the optional parameters for the AlertsClient.Get method. +type AlertsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AlertsClientListExternalOptions contains the optional parameters for the AlertsClient.ListExternal method. +type AlertsClientListExternalOptions struct { + // placeholder for future optional parameters +} + +// AlertsClientListOptions contains the optional parameters for the AlertsClient.List method. +type AlertsClientListOptions struct { + // placeholder for future optional parameters +} + +// AlertsResult - Result of alerts. +type AlertsResult struct { + // READ-ONLY; URL to get the next set of alerts results if there are any. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; List of alerts. + Value []*Alert `json:"value,omitempty" azure:"ro"` +} + +// 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 `json:"averageUtilizationPercentage,omitempty" azure:"ro"` + + // READ-ONLY; The estimated cost with benefit for the 'totalHours' in the look-back period. It's equal to (commitmentAmount + // * totalHours) + BenefitCost *float64 `json:"benefitCost,omitempty" azure:"ro"` + + // READ-ONLY; The commitment amount at the commitmentGranularity. + CommitmentAmount *float64 `json:"commitmentAmount,omitempty" azure:"ro"` + + // READ-ONLY; Estimated benefit coverage percentage for the 'totalHours' in the look-back period, with this commitment. + CoveragePercentage *float64 `json:"coveragePercentage,omitempty" azure:"ro"` + + // READ-ONLY; The difference between total cost and benefit cost for the 'totalHours' in the look-back period. + OverageCost *float64 `json:"overageCost,omitempty" azure:"ro"` + + // READ-ONLY; The amount saved for the 'totalHours' in the look-back period, by purchasing the recommended quantity of the + // benefit. + SavingsAmount *float64 `json:"savingsAmount,omitempty" azure:"ro"` + + // READ-ONLY; The savings in percentage for the 'totalHours' in the look-back period, by purchasing the recommended quantity + // of benefit. + SavingsPercentage *float64 `json:"savingsPercentage,omitempty" azure:"ro"` + + // READ-ONLY; Total cost, which is sum of benefit cost and overage cost. + TotalCost *float64 `json:"totalCost,omitempty" azure:"ro"` + + // READ-ONLY; Estimated unused portion of the 'benefitCost'. + WastageCost *float64 `json:"wastageCost,omitempty" azure:"ro"` +} + +// 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 `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; The list of benefit recommendations with the recommendation details.. + Value []*AllSavingsBenefitDetails `json:"value,omitempty" azure:"ro"` +} + +// BenefitRecommendationModel - benefit plan recommendation details. +type BenefitRecommendationModel struct { + // Reservation or SavingsPlan. + Kind *BenefitKind `json:"kind,omitempty"` + + // The properties of the benefit recommendations. + Properties BenefitRecommendationPropertiesClassification `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// 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 `json:"scope,omitempty"` + + // Grain of the proposed commitment amount. Supported values: 'Hourly' + CommitmentGranularity *Grain `json:"commitmentGranularity,omitempty"` + + // The number of days of usage evaluated for computing the recommendations. + LookBackPeriod *LookBackPeriod `json:"lookBackPeriod,omitempty"` + + // The details of the proposed recommendation. + RecommendationDetails *AllSavingsBenefitDetails `json:"recommendationDetails,omitempty"` + + // Term period of the benefit. For example, P1Y or P3Y. + Term *Term `json:"term,omitempty"` + + // On-demand charges between firstConsumptionDate and lastConsumptionDate that were used for computing benefit recommendations. + Usage *RecommendationUsageDetails `json:"usage,omitempty"` + + // READ-ONLY; The list of all benefit recommendations with the recommendation details. + AllRecommendationDetails *AllSavingsList `json:"allRecommendationDetails,omitempty" azure:"ro"` + + // READ-ONLY; ARM SKU name. 'ComputeSavingsPlan' for SavingsPlan. + ArmSKUName *string `json:"armSkuName,omitempty" azure:"ro"` + + // READ-ONLY; The current cost without benefit, corresponds to 'totalHours' in the look-back period. + CostWithoutBenefit *float64 `json:"costWithoutBenefit,omitempty" azure:"ro"` + + // READ-ONLY; An ISO 4217 currency code identifier for the costs and savings amounts. + CurrencyCode *string `json:"currencyCode,omitempty" azure:"ro"` + + // READ-ONLY; The first usage date used for looking back for computing the recommendations. + FirstConsumptionDate *time.Time `json:"firstConsumptionDate,omitempty" azure:"ro"` + + // READ-ONLY; The last usage date used for looking back for computing the recommendations. + LastConsumptionDate *time.Time `json:"lastConsumptionDate,omitempty" azure:"ro"` + + // 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 `json:"totalHours,omitempty" azure:"ro"` +} + +// 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 `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; The list of benefit recommendations. + Value []*BenefitRecommendationModel `json:"value,omitempty" azure:"ro"` +} + +// BenefitResource - The benefit resource model definition. +type BenefitResource struct { + // Reservation or SavingsPlan. + Kind *BenefitKind `json:"kind,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// 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 `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; The list of benefit utilization summaries. + Value []BenefitUtilizationSummaryClassification `json:"value,omitempty" azure:"ro"` +} + +// 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 `json:"kind,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// 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 `json:"benefitType,omitempty"` + + // READ-ONLY; ARM SKU name. For example, 'ComputeSavingsPlan' for savings plan. + ArmSKUName *string `json:"armSkuName,omitempty" azure:"ro"` + + // READ-ONLY; The benefit ID is the identifier of the benefit. + BenefitID *string `json:"benefitId,omitempty" azure:"ro"` + + // READ-ONLY; The benefit order ID is the identifier for a benefit purchase. + BenefitOrderID *string `json:"benefitOrderId,omitempty" azure:"ro"` + + // 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 `json:"usageDate,omitempty" azure:"ro"` +} + +// BlobInfo - The blob information generated by this operation. +type BlobInfo struct { + // Link to the blob to download file. + BlobLink *string `json:"blobLink,omitempty"` + + // Bytes in the blob. + ByteCount *int64 `json:"byteCount,omitempty"` +} + +// Budget - A budget resource. +type Budget struct { + // eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating + // the latest version or not. + ETag *string `json:"eTag,omitempty"` + + // The properties of the budget. + Properties *BudgetProperties `json:"properties,omitempty"` + + // READ-ONLY; Resource Id. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// BudgetComparisonExpression - The comparison expression to be used in the budgets. +type BudgetComparisonExpression struct { + // REQUIRED; The name of the column to use in comparison. + Name *string `json:"name,omitempty"` + + // REQUIRED; The operator to use for comparison. + Operator *BudgetOperatorType `json:"operator,omitempty"` + + // REQUIRED; Array of values to use for comparison + Values []*string `json:"values,omitempty"` +} + +// BudgetFilter - May be used to filter budgets by user-specified dimensions and/or tags. +// Supported for CategoryType(s): Cost, ReservationUtilization. +type BudgetFilter struct { + // The logical "AND" expression. Must have at least 2 items. + // Supported for CategoryType(s): Cost. + And []*BudgetFilterProperties `json:"and,omitempty"` + + // Has comparison expression for a dimension. + // Supported for CategoryType(s): Cost, ReservationUtilization. + // Supported dimension names for CategoryType: ReservationUtilization + // * ReservationId + // * ReservedResourceType + Dimensions *BudgetComparisonExpression `json:"dimensions,omitempty"` + + // Has comparison expression for a tag. + // Supported for CategoryType(s): Cost. + Tags *BudgetComparisonExpression `json:"tags,omitempty"` +} + +// BudgetFilterProperties - The Dimensions or Tags to filter a budget by. +// Supported for CategoryType(s): Cost, ReservationUtilization. +type BudgetFilterProperties struct { + // Has comparison expression for a dimension. + // Supported for CategoryType(s): Cost, ReservationUtilization. + // Supported dimension names for CategoryType: ReservationUtilization + // * ReservationId + // * ReservedResourceType + Dimensions *BudgetComparisonExpression `json:"dimensions,omitempty"` + + // Has comparison expression for a tag. + // Supported for CategoryType(s): Cost. + Tags *BudgetComparisonExpression `json:"tags,omitempty"` +} + +// BudgetProperties - The properties of the budget. +type BudgetProperties struct { + // REQUIRED; The category of the budget. + // * 'Cost' defines a Budget. + // * 'ReservationUtilization' defines a Reservation Utilization Alert Rule. + Category *CategoryType `json:"category,omitempty"` + + // REQUIRED; The time covered by a budget. Tracking of the amount will be reset based on the time grain. + // Supported for CategoryType(s): Cost, ReservationUtilization. + // Supported timeGrainTypes for CategoryType: Cost + // * Monthly + // + // + // * Quarterly + // + // + // * Annually + // + // + // * BillingMonth* + // + // + // * BillingQuarter* + // + // + // * BillingAnnual* + // + // *only supported for Web Direct customers. + // + // Supported timeGrainTypes for CategoryType: ReservationUtilization + // + // + // * Last7Days + // + // + // * Last30Days + // + // Required for CategoryType(s): Cost, ReservationUtilization. + TimeGrain *TimeGrainType `json:"timeGrain,omitempty"` + + // REQUIRED; The time period that defines the active period of the budget. The budget will evaluate data on or after the startDate + // and will expire on the endDate. + // Supported for CategoryType(s): Cost, ReservationUtilization. + // Required for CategoryType(s): Cost, ReservationUtilization. + TimePeriod *BudgetTimePeriod `json:"timePeriod,omitempty"` + + // The total amount of cost to track with the budget. + // Supported for CategoryType(s): Cost. + // Required for CategoryType(s): Cost. + Amount *float32 `json:"amount,omitempty"` + + // May be used to filter budgets by user-specified dimensions and/or tags. + // Supported for CategoryType(s): Cost, ReservationUtilization. + Filter *BudgetFilter `json:"filter,omitempty"` + + // Dictionary of notifications associated with the budget. + // Supported for CategoryType(s): Cost, ReservationUtilization. + // * Constraints for CategoryType: Cost - Budget can have up to 5 notifications with thresholdType: Actual and 5 notifications + // with thresholdType: Forecasted. + // * Constraints for CategoryType: ReservationUtilization - Only one notification allowed. thresholdType is not applicable. + Notifications map[string]*Notification `json:"notifications,omitempty"` + + // READ-ONLY; The current amount of cost which is being tracked for a budget. + // Supported for CategoryType(s): Cost. + CurrentSpend *CurrentSpend `json:"currentSpend,omitempty" azure:"ro"` + + // READ-ONLY; The forecasted cost which is being tracked for a budget. + // Supported for CategoryType(s): Cost. + ForecastSpend *ForecastSpend `json:"forecastSpend,omitempty" azure:"ro"` +} + +// BudgetTimePeriod - The time period that defines the active period of the budget. The budget will evaluate data on or after +// the startDate and will expire on the endDate. +// Supported for CategoryType(s): Cost, ReservationUtilization. +// Required for CategoryType(s): Cost, ReservationUtilization. +type BudgetTimePeriod struct { + // REQUIRED; The start date for the budget. + // * Constraints for CategoryType: Cost - Must be first of the month and should be less than the end date. Budget start date + // must be on or after June 1, 2017. Future start date should not be more than + // twelve months. Past start date should be selected within the timegrain period. + // + // + // * Constraints for CategoryType: ReservationUtilization - Must be on or after the current date and less than the end date. + StartDate *time.Time `json:"startDate,omitempty"` + + // The end date for the budget. + // * Constraints for CategoryType: Cost - No constraints. If not provided, we default this to 10 years from the start date. + // + // + // * Constraints for CategoryType: ReservationUtilization - End date cannot be more than 3 years after the start date. + EndDate *time.Time `json:"endDate,omitempty"` +} + +// BudgetsClientCreateOrUpdateOptions contains the optional parameters for the BudgetsClient.CreateOrUpdate method. +type BudgetsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// BudgetsClientDeleteOptions contains the optional parameters for the BudgetsClient.Delete method. +type BudgetsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// BudgetsClientGetOptions contains the optional parameters for the BudgetsClient.Get method. +type BudgetsClientGetOptions struct { + // placeholder for future optional parameters +} + +// BudgetsClientListOptions contains the optional parameters for the BudgetsClient.NewListPager method. +type BudgetsClientListOptions struct { +} + +// BudgetsListResult - Result of listing budgets. It contains a list of available budgets in the scope provided. +type BudgetsListResult struct { + // READ-ONLY; The link (url) to the next page of results. It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; The list of budgets. + Value []*Budget `json:"value,omitempty" azure:"ro"` +} + +// CheckNameAvailabilityRequest - The check availability request body. +type CheckNameAvailabilityRequest struct { + // The name of the resource for which availability needs to be checked. + Name *string `json:"name,omitempty"` + + // The resource type. + Type *string `json:"type,omitempty"` +} + +// CheckNameAvailabilityResponse - The check availability result. +type CheckNameAvailabilityResponse struct { + // Detailed reason why the given name is available. + Message *string `json:"message,omitempty"` + + // Indicates if the resource name is available. + NameAvailable *bool `json:"nameAvailable,omitempty"` + + // The reason why the given name is not available. + Reason *CheckNameAvailabilityReason `json:"reason,omitempty"` +} + +// CommonExportProperties - The common properties of the export. +type CommonExportProperties struct { + // REQUIRED; Has the definition for the export. + Definition *ExportDefinition `json:"definition,omitempty"` + + // REQUIRED; Has delivery information for the export. + DeliveryInfo *ExportDeliveryInfo `json:"deliveryInfo,omitempty"` + + // The format of the export being delivered. Currently only 'Csv' is supported. + Format *FormatType `json:"format,omitempty"` + + // 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 Microsoft Customer Agreement + // commerce scopes. + PartitionData *bool `json:"partitionData,omitempty"` + + // If requested, has the most recent run history for the export. + RunHistory *ExportExecutionListResult `json:"runHistory,omitempty"` + + // READ-ONLY; If the export has an active schedule, provides an estimate of the next run time. + NextRunTimeEstimate *time.Time `json:"nextRunTimeEstimate,omitempty" azure:"ro"` +} + +// CostDetailsOperationResults - The result of the long running operation for cost details Api. +type CostDetailsOperationResults struct { + // The details of the error. + Error *ErrorDetails `json:"error,omitempty"` + + // The id of the long running operation. + ID *string `json:"id,omitempty"` + + // The manifest of the report generated by the operation. + Manifest *ReportManifest `json:"manifest,omitempty"` + + // The name of the long running operation. + Name *string `json:"name,omitempty"` + + // The status of the cost details operation + Status *CostDetailsStatusType `json:"status,omitempty"` + + // The type of the long running operation. + Type *string `json:"type,omitempty"` + + // The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. + ValidTill *time.Time `json:"validTill,omitempty"` +} + +// 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 `json:"end,omitempty"` + + // REQUIRED; The start date to pull data from. example format 2020-03-15 + Start *string `json:"start,omitempty"` +} + +// CurrentSpend - The current amount of cost which is being tracked for a budget. +// Supported for CategoryType(s): Cost. +type CurrentSpend struct { + // READ-ONLY; The total amount of cost which is being tracked by the budget. + Amount *float32 `json:"amount,omitempty" azure:"ro"` + + // READ-ONLY; The unit of measure for the budget amount. + Unit *string `json:"unit,omitempty" azure:"ro"` +} + +// Dimension - List of Dimension. +type Dimension struct { + // Dimension properties. + Properties *DimensionProperties `json:"properties,omitempty"` + + // READ-ONLY; ETag of the resource. + ETag *string `json:"eTag,omitempty" azure:"ro"` + + // READ-ONLY; Resource Id. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Location of the resource. + Location *string `json:"location,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; SKU of the resource. + SKU *string `json:"sku,omitempty" azure:"ro"` + + // READ-ONLY; Resource tags. + Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// DimensionProperties - Dimension properties. +type DimensionProperties struct { + // Dimension data. + Data []*string `json:"data,omitempty"` + + // READ-ONLY; Dimension category. + Category *string `json:"category,omitempty" azure:"ro"` + + // READ-ONLY; Dimension description. + Description *string `json:"description,omitempty" azure:"ro"` + + // READ-ONLY; Filter enabled. + FilterEnabled *bool `json:"filterEnabled,omitempty" azure:"ro"` + + // READ-ONLY; Grouping enabled. + GroupingEnabled *bool `json:"groupingEnabled,omitempty" azure:"ro"` + + // READ-ONLY; The link (url) to the next page of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; Total number of data for the dimension. + Total *int32 `json:"total,omitempty" azure:"ro"` + + // READ-ONLY; Usage end. + UsageEnd *time.Time `json:"usageEnd,omitempty" azure:"ro"` + + // READ-ONLY; Usage start. + UsageStart *time.Time `json:"usageStart,omitempty" azure:"ro"` +} + +// DimensionsClientByExternalCloudProviderTypeOptions contains the optional parameters for the DimensionsClient.NewByExternalCloudProviderTypePager +// method. +type DimensionsClientByExternalCloudProviderTypeOptions struct { + // May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions. + Expand *string + // May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators + // are 'eq','lt', 'gt', 'le', 'ge'. + Filter *string + // Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, + // the value of the nextLink element will include a skiptoken parameter that + // specifies a starting point to use for subsequent calls. + Skiptoken *string + // May be used to limit the number of results to the most recent N dimension data. + Top *int32 +} + +// DimensionsClientListOptions contains the optional parameters for the DimensionsClient.NewListPager method. +type DimensionsClientListOptions struct { + // May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions. + Expand *string + // May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators + // are 'eq','lt', 'gt', 'le', 'ge'. + Filter *string + // Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, + // the value of the nextLink element will include a skiptoken parameter that + // specifies a starting point to use for subsequent calls. + Skiptoken *string + // May be used to limit the number of results to the most recent N dimension data. + Top *int32 +} + +// DimensionsListResult - Result of listing dimensions. It contains a list of available dimensions. +type DimensionsListResult struct { + // READ-ONLY; The list of dimensions. + Value []*Dimension `json:"value,omitempty" azure:"ro"` +} + +// DismissAlertPayload - The request payload to update an alert +type DismissAlertPayload struct { + // Alert properties. + Properties *AlertProperties `json:"properties,omitempty"` +} + +// DownloadURL - The URL to download the generated report. +type DownloadURL struct { + // The URL to download the generated report. + DownloadURL *string `json:"downloadUrl,omitempty"` + + // The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. + ValidTill *time.Time `json:"validTill,omitempty"` + + // READ-ONLY; The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. + ExpiryTime *time.Time `json:"expiryTime,omitempty" azure:"ro"` +} + +// ErrorDetails - The details of the error. +type ErrorDetails struct { + // READ-ONLY; Error code. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; Error message indicating why the operation failed. + Message *string `json:"message,omitempty" azure:"ro"` +} + +// ErrorDetailsWithNestedDetails - The details of the error. +type ErrorDetailsWithNestedDetails struct { + // READ-ONLY; Error code. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; The additional details of the error. + Details []*ErrorDetails `json:"details,omitempty" azure:"ro"` + + // READ-ONLY; Error message indicating why the operation failed. + Message *string `json:"message,omitempty" azure:"ro"` +} + +// ErrorResponse - Error response indicates that the service is not able to process the incoming request. The reason is provided +// in the error message. +// Some Error responses: +// * 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" +// header. +// +// * 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" +// header. +type ErrorResponse struct { + // The details of the error. + Error *ErrorDetails `json:"error,omitempty"` +} + +// 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 `json:"error,omitempty"` +} + +// 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 + // the latest version or not. + ETag *string `json:"eTag,omitempty"` + + // The properties of the export. + Properties *ExportProperties `json:"properties,omitempty"` + + // READ-ONLY; Resource Id. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ExportDataset - The definition for data in the export. +type ExportDataset struct { + // The export dataset configuration. + Configuration *ExportDatasetConfiguration `json:"configuration,omitempty"` + + // The granularity of rows in the export. Currently only 'Daily' is supported. + Granularity *GranularityType `json:"granularity,omitempty"` +} + +// ExportDatasetConfiguration - The export dataset configuration. Allows columns to be selected for the export. If not provided +// then the export will include all available columns. +type ExportDatasetConfiguration struct { + // Array of column names to be included in the export. If not provided then the export will include all available columns. + // The available columns can vary by customer channel (see examples). + Columns []*string `json:"columns,omitempty"` +} + +// ExportDefinition - The definition of an export. +type ExportDefinition struct { + // REQUIRED; The time frame for pulling data for the export. If custom, then a specific time period must be provided. + Timeframe *TimeframeType `json:"timeframe,omitempty"` + + // REQUIRED; The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that do + // not yet provide data for charges or amortization for service reservations. + Type *ExportType `json:"type,omitempty"` + + // The definition for data in the export. + DataSet *ExportDataset `json:"dataSet,omitempty"` + + // Has time period for pulling data for the export. + TimePeriod *ExportTimePeriod `json:"timePeriod,omitempty"` +} + +// ExportDeliveryDestination - This represents the blob storage account location where exports of costs will be delivered. +// There are two ways to configure the destination. The approach recommended for most customers is to specify +// the resourceId of the storage account. This requires a one-time registration of the account's subscription with the Microsoft.CostManagementExports +// resource provider in order to give Cost Management +// services access to the storage. When creating an export in the Azure portal this registration is performed automatically +// but API users may need to register the subscription explicitly (for more +// information see https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-supported-services ). Another +// way to configure the destination is available ONLY to Partners with a +// Microsoft Partner Agreement plan who are global admins of their billing account. These Partners, instead of specifying +// the resourceId of a storage account, can specify the storage account name along +// with a SAS token for the account. This allows exports of costs to a storage account in any tenant. The SAS token should +// be created for the blob service with Service/Container/Object resource types and +// with Read/Write/Delete/List/Add/Create permissions (for more information see https://docs.microsoft.com/en-us/azure/cost-management-billing/costs/export-cost-data-storage-account-sas-key +// ). +type ExportDeliveryDestination struct { + // REQUIRED; The name of the container where exports will be uploaded. If the container does not exist it will be created. + Container *string `json:"container,omitempty"` + + // The resource id of the storage account where exports will be delivered. This is not required if a sasToken and storageAccount + // are specified. + ResourceID *string `json:"resourceId,omitempty"` + + // The name of the directory where exports will be uploaded. + RootFolderPath *string `json:"rootFolderPath,omitempty"` + + // A SAS token for the storage account. For a restricted set of Azure customers this together with storageAccount can be specified + // instead of resourceId. Note: the value returned by the API for this + // property will always be obfuscated. Returning this same obfuscated value will not result in the SAS token being updated. + // To update this value a new SAS token must be specified. + SasToken *string `json:"sasToken,omitempty"` + + // The storage account where exports will be uploaded. For a restricted set of Azure customers this together with sasToken + // can be specified instead of resourceId. + StorageAccount *string `json:"storageAccount,omitempty"` +} + +// ExportDeliveryInfo - The delivery information associated with a export. +type ExportDeliveryInfo struct { + // REQUIRED; Has destination for the export being delivered. + Destination *ExportDeliveryDestination `json:"destination,omitempty"` +} + +// ExportExecutionListResult - Result of listing the run history of an export. +type ExportExecutionListResult struct { + // READ-ONLY; A list of export runs. + Value []*ExportRun `json:"value,omitempty" azure:"ro"` +} + +// ExportListResult - Result of listing exports. It contains a list of available exports in the scope provided. +type ExportListResult struct { + // READ-ONLY; The list of exports. + Value []*Export `json:"value,omitempty" azure:"ro"` +} + +// ExportProperties - The properties of the export. +type ExportProperties struct { + // REQUIRED; Has the definition for the export. + Definition *ExportDefinition `json:"definition,omitempty"` + + // REQUIRED; Has delivery information for the export. + DeliveryInfo *ExportDeliveryInfo `json:"deliveryInfo,omitempty"` + + // The format of the export being delivered. Currently only 'Csv' is supported. + Format *FormatType `json:"format,omitempty"` + + // 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 Microsoft Customer Agreement + // commerce scopes. + PartitionData *bool `json:"partitionData,omitempty"` + + // If requested, has the most recent run history for the export. + RunHistory *ExportExecutionListResult `json:"runHistory,omitempty"` + + // Has schedule information for the export. + Schedule *ExportSchedule `json:"schedule,omitempty"` + + // READ-ONLY; If the export has an active schedule, provides an estimate of the next run time. + NextRunTimeEstimate *time.Time `json:"nextRunTimeEstimate,omitempty" azure:"ro"` +} + +// ExportRecurrencePeriod - The start and end date for recurrence schedule. +type ExportRecurrencePeriod struct { + // REQUIRED; The start date of recurrence. + From *time.Time `json:"from,omitempty"` + + // The end date of recurrence. + To *time.Time `json:"to,omitempty"` +} + +// 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 `json:"eTag,omitempty"` + + // The properties of the export run. + Properties *ExportRunProperties `json:"properties,omitempty"` + + // READ-ONLY; Resource Id. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ExportRunProperties - The properties of the export run. +type ExportRunProperties struct { + // The details of any error. + Error *ErrorDetails `json:"error,omitempty"` + + // The type of the export run. + ExecutionType *ExecutionType `json:"executionType,omitempty"` + + // The name of the exported file. + FileName *string `json:"fileName,omitempty"` + + // The time when the export run finished. + ProcessingEndTime *time.Time `json:"processingEndTime,omitempty"` + + // The time when export was picked up to be run. + ProcessingStartTime *time.Time `json:"processingStartTime,omitempty"` + + // The export settings that were in effect for this run. + RunSettings *CommonExportProperties `json:"runSettings,omitempty"` + + // The last known status of the export run. + Status *ExecutionStatus `json:"status,omitempty"` + + // 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 `json:"submittedBy,omitempty"` + + // The time when export was queued to be run. + SubmittedTime *time.Time `json:"submittedTime,omitempty"` +} + +// ExportSchedule - The schedule associated with the export. +type ExportSchedule struct { + // The schedule recurrence. + Recurrence *RecurrenceType `json:"recurrence,omitempty"` + + // Has start and end date of the recurrence. The start date must be in future. If present, the end date must be greater than + // start date. + RecurrencePeriod *ExportRecurrencePeriod `json:"recurrencePeriod,omitempty"` + + // The status of the export's schedule. If 'Inactive', the export's schedule is paused. + Status *StatusType `json:"status,omitempty"` +} + +// ExportTimePeriod - The date range for data in the export. This should only be specified with timeFrame set to 'Custom'. +// The maximum date range is 3 months. +type ExportTimePeriod struct { + // REQUIRED; The start date for export data. + From *time.Time `json:"from,omitempty"` + + // REQUIRED; The end date for export data. + To *time.Time `json:"to,omitempty"` +} + +// ExportsClientCreateOrUpdateOptions contains the optional parameters for the ExportsClient.CreateOrUpdate method. +type ExportsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ExportsClientDeleteOptions contains the optional parameters for the ExportsClient.Delete method. +type ExportsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ExportsClientExecuteOptions contains the optional parameters for the ExportsClient.Execute method. +type ExportsClientExecuteOptions struct { + // placeholder for future optional parameters +} + +// ExportsClientGetExecutionHistoryOptions contains the optional parameters for the ExportsClient.GetExecutionHistory method. +type ExportsClientGetExecutionHistoryOptions struct { + // placeholder for future optional parameters +} + +// 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 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 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 `json:"fileFormats,omitempty"` +} + +// ForecastAggregation - The aggregation expression to be used in the forecast. +type ForecastAggregation struct { + // REQUIRED; The name of the aggregation function to use. + Function *FunctionType `json:"function,omitempty"` + + // REQUIRED; The name of the column to aggregate. + Name *FunctionName `json:"name,omitempty"` +} + +// ForecastClientExternalCloudProviderUsageOptions contains the optional parameters for the ForecastClient.ExternalCloudProviderUsage +// method. +type ForecastClientExternalCloudProviderUsageOptions struct { + // May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter + // supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently + // support 'ne', 'or', or 'not'. + Filter *string +} + +// ForecastClientUsageOptions contains the optional parameters for the ForecastClient.Usage method. +type ForecastClientUsageOptions struct { + // May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter + // supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently + // support 'ne', 'or', or 'not'. + Filter *string +} + +// ForecastColumn - Forecast column properties +type ForecastColumn struct { + // The name of column. + Name *string `json:"name,omitempty"` + + // The type of column. + Type *string `json:"type,omitempty"` +} + +// 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 `json:"name,omitempty"` + + // REQUIRED; The operator to use for comparison. + Operator *ForecastOperatorType `json:"operator,omitempty"` + + // REQUIRED; Array of values to use for comparison + Values []*string `json:"values,omitempty"` +} + +// ForecastDataset - The definition of data present in the forecast. +type ForecastDataset struct { + // 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 `json:"aggregation,omitempty"` + + // Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping + // are provided. + Configuration *ForecastDatasetConfiguration `json:"configuration,omitempty"` + + // Has filter expression to use in the forecast. + Filter *ForecastFilter `json:"filter,omitempty"` + + // The granularity of rows in the forecast. + Granularity *GranularityType `json:"granularity,omitempty"` +} + +// 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 `json:"columns,omitempty"` +} + +// ForecastDefinition - The definition of a forecast. +type ForecastDefinition struct { + // REQUIRED; Has definition for data in this forecast. + Dataset *ForecastDataset `json:"dataset,omitempty"` + + // REQUIRED; The time frame for pulling data for the forecast. If custom, then a specific time period must be provided. + Timeframe *ForecastTimeframe `json:"timeframe,omitempty"` + + // REQUIRED; The type of the forecast. + Type *ForecastType `json:"type,omitempty"` + + // A boolean determining if actualCost will be included. + IncludeActualCost *bool `json:"includeActualCost,omitempty"` + + // A boolean determining if FreshPartialCost will be included. + IncludeFreshPartialCost *bool `json:"includeFreshPartialCost,omitempty"` + + // Has time period for pulling data for the forecast. + TimePeriod *ForecastTimePeriod `json:"timePeriod,omitempty"` +} + +// 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 `json:"and,omitempty"` + + // Has comparison expression for a dimension + Dimensions *ForecastComparisonExpression `json:"dimensions,omitempty"` + + // The logical "OR" expression. Must have at least 2 items. + Or []*ForecastFilter `json:"or,omitempty"` + + // Has comparison expression for a tag + Tags *ForecastComparisonExpression `json:"tags,omitempty"` +} + +// ForecastProperties - Forecast properties +type ForecastProperties struct { + // Array of columns + Columns []*ForecastColumn `json:"columns,omitempty"` + + // The link (url) to the next page of results. + NextLink *string `json:"nextLink,omitempty"` + + // Array of rows + Rows [][]any `json:"rows,omitempty"` +} + +// ForecastResult - Result of forecast. It contains all columns listed under groupings and aggregation. +type ForecastResult struct { + // Forecast properties + Properties *ForecastProperties `json:"properties,omitempty"` + + // READ-ONLY; ETag of the resource. + ETag *string `json:"eTag,omitempty" azure:"ro"` + + // READ-ONLY; Resource Id. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Location of the resource. + Location *string `json:"location,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; SKU of the resource. + SKU *string `json:"sku,omitempty" azure:"ro"` + + // READ-ONLY; Resource tags. + Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ForecastSpend - The forecasted cost which is being tracked for a budget. +// Supported for CategoryType(s): Cost. +type ForecastSpend struct { + // READ-ONLY; The forecasted cost for the total time period which is being tracked by the budget. This value is only provided + // if the budget contains a forecast alert type. + Amount *float32 `json:"amount,omitempty" azure:"ro"` + + // READ-ONLY; The unit of measure for the budget amount. + Unit *string `json:"unit,omitempty" azure:"ro"` +} + +// ForecastTimePeriod - Has time period for pulling data for the forecast. +type ForecastTimePeriod struct { + // REQUIRED; The start date to pull data from. + From *time.Time `json:"from,omitempty"` + + // REQUIRED; The end date to pull data to. + To *time.Time `json:"to,omitempty"` +} + +// 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 `json:"error,omitempty"` +} + +// 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 `json:"billingPeriod,omitempty"` + + // 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 `json:"invoiceId,omitempty"` + + // The type of the detailed report. By default ActualCost is provided + Metric *CostDetailsMetricType `json:"metric,omitempty"` + + // 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 `json:"timePeriod,omitempty"` +} + +// GenerateDetailedCostReportClientBeginCreateOperationOptions contains the optional parameters for the GenerateDetailedCostReportClient.BeginCreateOperation +// method. +type GenerateDetailedCostReportClientBeginCreateOperationOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// 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 + // either timePeriod or invoiceId or billingPeriod parameters. If none provided + // current month cost is provided. + BillingPeriod *string `json:"billingPeriod,omitempty"` + + // Customer ID for Microsoft Customer Agreement scopes (Invoice Id is also required for this). + CustomerID *string `json:"customerId,omitempty"` + + // 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 `json:"invoiceId,omitempty"` + + // The type of the detailed report. By default ActualCost is provided + Metric *GenerateDetailedCostReportMetricType `json:"metric,omitempty"` + + // Has time period for pulling data for the cost detailed report. Can only have one of either timePeriod or invoiceId or billingPeriod + // parameters. If none provided current month cost is provided. + TimePeriod *GenerateDetailedCostReportTimePeriod `json:"timePeriod,omitempty"` +} + +// GenerateDetailedCostReportErrorResponse - Error response indicates that the service is not able to process the incoming +// request. The reason is provided in the error message. +// Some Error responses: +// * 413 Request Entity Too Large - Request is throttled. The amount of data required to fulfill the request exceeds the maximum +// size permitted of 2Gb. Please utilize our Exports feature instead. +// +// * 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" +// header. +// +// * 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" +// header. +type GenerateDetailedCostReportErrorResponse struct { + // The details of the error. + Error *ErrorDetails `json:"error,omitempty"` +} + +// GenerateDetailedCostReportOperationResult - The result of the long running operation for cost detailed report. +type GenerateDetailedCostReportOperationResult struct { + // The ARM resource id of the long running operation. + ID *string `json:"id,omitempty"` + + // The name of the long running operation. + Name *string `json:"name,omitempty"` + + // The properties of the resource generated. + Properties *DownloadURL `json:"properties,omitempty"` + + // The type of the long running operation. + Type *string `json:"type,omitempty"` +} + +// GenerateDetailedCostReportOperationResultsClientBeginGetOptions contains the optional parameters for the GenerateDetailedCostReportOperationResultsClient.BeginGet +// method. +type GenerateDetailedCostReportOperationResultsClientBeginGetOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GenerateDetailedCostReportOperationStatusClientGetOptions contains the optional parameters for the GenerateDetailedCostReportOperationStatusClient.Get +// method. +type GenerateDetailedCostReportOperationStatusClientGetOptions struct { + // placeholder for future optional parameters +} + +// GenerateDetailedCostReportOperationStatuses - The status of the long running operation for cost detailed report. +type GenerateDetailedCostReportOperationStatuses struct { + // The details of the error. + Error *ErrorDetails `json:"error,omitempty"` + + // The ID of the long running operation. + ID *string `json:"id,omitempty"` + + // The name of the long running operation. + Name *string `json:"name,omitempty"` + + // The properties of the usage file generated. + Properties *DownloadURL `json:"properties,omitempty"` + + // The status of the long running operation. + Status *Status `json:"status,omitempty"` + + // The type of the long running operation. + Type *string `json:"type,omitempty"` +} + +// GenerateDetailedCostReportTimePeriod - The start and end date for pulling data for the cost detailed report. +type GenerateDetailedCostReportTimePeriod struct { + // REQUIRED; The end date to pull data to. example format 2020-03-15 + End *string `json:"end,omitempty"` + + // REQUIRED; The start date to pull data from. example format 2020-03-15 + Start *string `json:"start,omitempty"` +} + +// GenerateReservationDetailsReportClientBeginByBillingAccountIDOptions contains the optional parameters for the GenerateReservationDetailsReportClient.BeginByBillingAccountID +// method. +type GenerateReservationDetailsReportClientBeginByBillingAccountIDOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GenerateReservationDetailsReportClientBeginByBillingProfileIDOptions contains the optional parameters for the GenerateReservationDetailsReportClient.BeginByBillingProfileID +// method. +type GenerateReservationDetailsReportClientBeginByBillingProfileIDOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// IncludedQuantityUtilizationSummary - Included Quantity utilization summary resource. +type IncludedQuantityUtilizationSummary struct { + // REQUIRED; Supported values: 'SavingsPlan'. + Kind *BenefitKind `json:"kind,omitempty"` + + // Included Quantity utilization summary properties. + Properties *IncludedQuantityUtilizationSummaryProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// 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 `json:"benefitType,omitempty"` + + // READ-ONLY; ARM SKU name. For example, 'ComputeSavingsPlan' for savings plan. + ArmSKUName *string `json:"armSkuName,omitempty" azure:"ro"` + + // READ-ONLY; The benefit ID is the identifier of the benefit. + BenefitID *string `json:"benefitId,omitempty" azure:"ro"` + + // READ-ONLY; The benefit order ID is the identifier for a benefit purchase. + BenefitOrderID *string `json:"benefitOrderId,omitempty" azure:"ro"` + + // 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 `json:"usageDate,omitempty" azure:"ro"` + + // READ-ONLY; This is the utilized percentage for the benefit ID. + UtilizationPercentage *float64 `json:"utilizationPercentage,omitempty" azure:"ro"` +} + +// KpiProperties - Each KPI must contain a 'type' and 'enabled' key. +type KpiProperties struct { + // show the KPI in the UI? + Enabled *bool `json:"enabled,omitempty"` + + // ID of resource related to metric (budget). + ID *string `json:"id,omitempty"` + + // KPI type (Forecast, Budget). + Type *KpiType `json:"type,omitempty"` +} + +// Notification - The notification associated with a budget. +// Supported for CategoryType(s): Cost, ReservationUtilization. +type Notification struct { + // REQUIRED; Email addresses to send the notification to when the threshold is breached. Must have at least one contact email + // or contact group specified at the Subscription or Resource Group scopes. All other + // scopes must have at least one contact email specified. + // Supported for CategoryType(s): Cost, ReservationUtilization. + ContactEmails []*string `json:"contactEmails,omitempty"` + + // REQUIRED; The notification is enabled or not. + // Supported for CategoryType(s): Cost, ReservationUtilization. + Enabled *bool `json:"enabled,omitempty"` + + // REQUIRED; The comparison operator. + // Supported for CategoryType(s): Cost, ReservationUtilization. + // Supported operators for CategoryType: Cost + // * GreaterThan + // + // + // * GreaterThanOrEqualTo + // + // Supported operators for CategoryType: ReservationUtilization + // + // + // * LessThan + Operator *BudgetNotificationOperatorType `json:"operator,omitempty"` + + // REQUIRED; Threshold value associated with a notification. It is always percent with a maximum of 2 decimal places. + // Supported for CategoryType(s): Cost, ReservationUtilization. + // CategoryType: Cost - Must be between 0 and 1000. Notification is sent when the cost exceeded the threshold. + // CategoryType: ReservationUtilization - Must be between 0 and 100. Notification is sent when a reservation has a utilization + // percentage below the threshold. + Threshold *float32 `json:"threshold,omitempty"` + + // Subscription or Resource Group scopes only. Action groups to send the notification to when the threshold is exceeded. Must + // be provided as a fully qualified Azure resource id. + // Supported for CategoryType(s): Cost. + ContactGroups []*string `json:"contactGroups,omitempty"` + + // Subscription or Resource Group scopes only. Contact roles to send the notification to when the threshold is breached. + // Supported for CategoryType(s): Cost. + ContactRoles []*string `json:"contactRoles,omitempty"` + + // Frequency of a notification. Represents how long the notification will be silent after triggering an alert for a threshold + // breach. If not specified, the frequency will be set by default based on the + // timeGrain (Weekly when timeGrain: Last7Days, Monthly when timeGrain: Last30Days). + // Supported for CategoryType(s): ReservationUtilization. + Frequency *Frequency `json:"frequency,omitempty"` + + // Language in which the recipient will receive the notification, + // Supported for CategoryType(s): Cost, ReservationUtilization. + Locale *CultureCode `json:"locale,omitempty"` + + // The type of threshold. + // Supported for CategoryType(s): Cost. + ThresholdType *ThresholdType `json:"thresholdType,omitempty"` +} + +// NotificationProperties - The properties of the scheduled action notification. +type NotificationProperties struct { + // REQUIRED; Subject of the email. Length is limited to 70 characters. + Subject *string `json:"subject,omitempty"` + + // REQUIRED; Array of email addresses. + To []*string `json:"to,omitempty"` + + // Locale of the email. + Language *string `json:"language,omitempty"` + + // Optional message to be added in the email. Length is limited to 250 characters. + Message *string `json:"message,omitempty"` + + // Regional format used for formatting date/time and currency values in the email. + RegionalFormat *string `json:"regionalFormat,omitempty"` +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Localized display information for this particular operation. + Display *OperationDisplay `json:"display,omitempty"` + + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType `json:"actionType,omitempty" azure:"ro"` + + // 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 `json:"isDataAction,omitempty" azure:"ro"` + + // 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 `json:"name,omitempty" azure:"ro"` + + // 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 `json:"origin,omitempty" azure:"ro"` +} + +// OperationDisplay - Localized display information for this particular operation. +type OperationDisplay struct { + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. + Description *string `json:"description,omitempty" azure:"ro"` + + // 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 `json:"operation,omitempty" azure:"ro"` + + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". + Provider *string `json:"provider,omitempty" azure:"ro"` + + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". + Resource *string `json:"resource,omitempty" azure:"ro"` +} + +// OperationForCostManagement - A Cost management REST API operation. +type OperationForCostManagement struct { + // Localized display information for this particular operation. + Display *OperationDisplay `json:"display,omitempty"` + + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType `json:"actionType,omitempty" azure:"ro"` + + // READ-ONLY; Operation id: {provider}/{resource}/{operation}. + ID *string `json:"id,omitempty" azure:"ro"` + + // 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 `json:"isDataAction,omitempty" azure:"ro"` + + // 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 `json:"name,omitempty" azure:"ro"` + + // 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 `json:"origin,omitempty" azure:"ro"` +} + +// 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 { + // READ-ONLY; URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; List of cost management operations supported by the Microsoft.CostManagement resource provider. + Value []*OperationForCostManagement `json:"value,omitempty" azure:"ro"` +} + +// OperationStatus - The status of the long running operation. +type OperationStatus struct { + // The properties of the resource generated. + Properties *ReportURL `json:"properties,omitempty"` + + // The status of the long running operation. + Status *OperationStatusType `json:"status,omitempty"` +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PivotProperties - Each pivot must contain a 'type' and 'name'. +type PivotProperties struct { + // Data field to show in view. + Name *string `json:"name,omitempty"` + + // Data type to show in view. + Type *PivotType `json:"type,omitempty"` +} + +// 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 `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// 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 `json:"eTag,omitempty"` + + // READ-ONLY; Resource Id. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// QueryAggregation - The aggregation expression to be used in the query. +type QueryAggregation struct { + // REQUIRED; The name of the aggregation function to use. + Function *FunctionType `json:"function,omitempty"` + + // REQUIRED; The name of the column to aggregate. + Name *string `json:"name,omitempty"` +} + +// QueryClientUsageByExternalCloudProviderTypeOptions contains the optional parameters for the QueryClient.UsageByExternalCloudProviderType +// method. +type QueryClientUsageByExternalCloudProviderTypeOptions struct { + // placeholder for future optional parameters +} + +// QueryClientUsageOptions contains the optional parameters for the QueryClient.Usage method. +type QueryClientUsageOptions struct { + // placeholder for future optional parameters +} + +// QueryColumn properties +type QueryColumn struct { + // The name of column. + Name *string `json:"name,omitempty"` + + // The type of column. + Type *string `json:"type,omitempty"` +} + +// QueryComparisonExpression - The comparison expression to be used in the query. +type QueryComparisonExpression struct { + // REQUIRED; The name of the column to use in comparison. + Name *string `json:"name,omitempty"` + + // REQUIRED; The operator to use for comparison. + Operator *QueryOperatorType `json:"operator,omitempty"` + + // REQUIRED; Array of values to use for comparison + Values []*string `json:"values,omitempty"` +} + +// QueryDataset - The definition of data present in the query. +type QueryDataset struct { + // Dictionary of aggregation expression to use in the query. The key of each item in the dictionary is the alias for the aggregated + // column. Query can have up to 2 aggregation clauses. + Aggregation map[string]*QueryAggregation `json:"aggregation,omitempty"` + + // Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping + // are provided. + Configuration *QueryDatasetConfiguration `json:"configuration,omitempty"` + + // The filter expression to use in the query. Please reference our Query API REST documentation for how to properly format + // the filter. + Filter *QueryFilter `json:"filter,omitempty"` + + // The granularity of rows in the query. + Granularity *GranularityType `json:"granularity,omitempty"` + + // Array of group by expression to use in the query. Query can have up to 2 group by clauses. + Grouping []*QueryGrouping `json:"grouping,omitempty"` +} + +// QueryDatasetConfiguration - The configuration of dataset in the query. +type QueryDatasetConfiguration struct { + // Array of column names to be included in the query. Any valid query column name is allowed. If not provided, then query + // includes all columns. + Columns []*string `json:"columns,omitempty"` +} + +// QueryDefinition - The definition of a query. +type QueryDefinition struct { + // REQUIRED; Has definition for data in this query. + Dataset *QueryDataset `json:"dataset,omitempty"` + + // REQUIRED; The time frame for pulling data for the query. If custom, then a specific time period must be provided. + Timeframe *TimeframeType `json:"timeframe,omitempty"` + + // REQUIRED; The type of the query. + Type *ExportType `json:"type,omitempty"` + + // Has time period for pulling data for the query. + TimePeriod *QueryTimePeriod `json:"timePeriod,omitempty"` +} + +// QueryFilter - The filter expression to be used in the export. +type QueryFilter struct { + // The logical "AND" expression. Must have at least 2 items. + And []*QueryFilter `json:"and,omitempty"` + + // Has comparison expression for a dimension + Dimensions *QueryComparisonExpression `json:"dimensions,omitempty"` + + // The logical "OR" expression. Must have at least 2 items. + Or []*QueryFilter `json:"or,omitempty"` + + // Has comparison expression for a tag + Tags *QueryComparisonExpression `json:"tags,omitempty"` +} + +// QueryGrouping - The group by expression to be used in the query. +type QueryGrouping struct { + // REQUIRED; The name of the column to group. + Name *string `json:"name,omitempty"` + + // REQUIRED; Has type of the column to group. + Type *QueryColumnType `json:"type,omitempty"` +} + +// QueryProperties - Query properties +type QueryProperties struct { + // Array of columns + Columns []*QueryColumn `json:"columns,omitempty"` + + // The link (url) to the next page of results. + NextLink *string `json:"nextLink,omitempty"` + + // Array of rows + Rows [][]any `json:"rows,omitempty"` +} + +// QueryResult - Result of query. It contains all columns listed under groupings and aggregation. +type QueryResult struct { + // Query properties + Properties *QueryProperties `json:"properties,omitempty"` + + // READ-ONLY; ETag of the resource. + ETag *string `json:"eTag,omitempty" azure:"ro"` + + // READ-ONLY; Resource Id. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Location of the resource. + Location *string `json:"location,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; SKU of the resource. + SKU *string `json:"sku,omitempty" azure:"ro"` + + // READ-ONLY; Resource tags. + Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// QueryTimePeriod - The start and end date for pulling data for the query. +type QueryTimePeriod struct { + // REQUIRED; The start date to pull data from. + From *time.Time `json:"from,omitempty"` + + // REQUIRED; The end date to pull data to. + To *time.Time `json:"to,omitempty"` +} + +// 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 `json:"usageGrain,omitempty"` + + // READ-ONLY; On-demand charges for each hour between firstConsumptionDate and lastConsumptionDate that were used for computing + // benefit recommendations. + Charges []*float64 `json:"charges,omitempty" azure:"ro"` +} + +// ReportConfigAggregation - The aggregation expression to be used in the report. +type ReportConfigAggregation struct { + // REQUIRED; The name of the aggregation function to use. + Function *FunctionType `json:"function,omitempty"` + + // REQUIRED; The name of the column to aggregate. + Name *string `json:"name,omitempty"` +} + +// ReportConfigComparisonExpression - The comparison expression to be used in the report. +type ReportConfigComparisonExpression struct { + // REQUIRED; The name of the column to use in comparison. + Name *string `json:"name,omitempty"` + + // REQUIRED; The operator to use for comparison. + Operator *OperatorType `json:"operator,omitempty"` + + // REQUIRED; Array of values to use for comparison + Values []*string `json:"values,omitempty"` +} + +// ReportConfigDataset - The definition of data present in the report. +type ReportConfigDataset struct { + // Dictionary of aggregation expression to use in the report. The key of each item in the dictionary is the alias for the + // aggregated column. Report can have up to 2 aggregation clauses. + Aggregation map[string]*ReportConfigAggregation `json:"aggregation,omitempty"` + + // Has configuration information for the data in the report. The configuration will be ignored if aggregation and grouping + // are provided. + Configuration *ReportConfigDatasetConfiguration `json:"configuration,omitempty"` + + // Has filter expression to use in the report. + Filter *ReportConfigFilter `json:"filter,omitempty"` + + // The granularity of rows in the report. + Granularity *ReportGranularityType `json:"granularity,omitempty"` + + // Array of group by expression to use in the report. Report can have up to 2 group by clauses. + Grouping []*ReportConfigGrouping `json:"grouping,omitempty"` + + // Array of order by expression to use in the report. + Sorting []*ReportConfigSorting `json:"sorting,omitempty"` +} + +// ReportConfigDatasetConfiguration - The configuration of dataset in the report. +type ReportConfigDatasetConfiguration struct { + // Array of column names to be included in the report. Any valid report column name is allowed. If not provided, then report + // includes all columns. + Columns []*string `json:"columns,omitempty"` +} + +// ReportConfigDefinition - The definition of a report config. +type ReportConfigDefinition struct { + // REQUIRED; The time frame for pulling data for the report. If custom, then a specific time period must be provided. + Timeframe *ReportTimeframeType `json:"timeframe,omitempty"` + + // REQUIRED; The type of the report. Usage represents actual usage, forecast represents forecasted data and UsageAndForecast + // represents both usage and forecasted data. Actual usage and forecasted data can be + // differentiated based on dates. + Type *ReportType `json:"type,omitempty"` + + // Has definition for data in this report config. + DataSet *ReportConfigDataset `json:"dataSet,omitempty"` + + // If true, report includes monetary commitment. + IncludeMonetaryCommitment *bool `json:"includeMonetaryCommitment,omitempty"` + + // Has time period for pulling data for the report. + TimePeriod *ReportConfigTimePeriod `json:"timePeriod,omitempty"` +} + +// ReportConfigFilter - The filter expression to be used in the report. +type ReportConfigFilter struct { + // The logical "AND" expression. Must have at least 2 items. + And []*ReportConfigFilter `json:"and,omitempty"` + + // Has comparison expression for a dimension + Dimensions *ReportConfigComparisonExpression `json:"dimensions,omitempty"` + + // The logical "OR" expression. Must have at least 2 items. + Or []*ReportConfigFilter `json:"or,omitempty"` + + // Has comparison expression for a tag + Tags *ReportConfigComparisonExpression `json:"tags,omitempty"` +} + +// ReportConfigGrouping - The group by expression to be used in the report. +type ReportConfigGrouping struct { + // REQUIRED; The name of the column to group. This version supports subscription lowest possible grain. + Name *string `json:"name,omitempty"` + + // REQUIRED; Has type of the column to group. + Type *QueryColumnType `json:"type,omitempty"` +} + +// ReportConfigSorting - The order by expression to be used in the report. +type ReportConfigSorting struct { + // REQUIRED; The name of the column to sort. + Name *string `json:"name,omitempty"` + + // Direction of sort. + Direction *ReportConfigSortingType `json:"direction,omitempty"` +} + +// ReportConfigTimePeriod - The start and end date for pulling data for the report. +type ReportConfigTimePeriod struct { + // REQUIRED; The start date to pull data from. + From *time.Time `json:"from,omitempty"` + + // REQUIRED; The end date to pull data to. + To *time.Time `json:"to,omitempty"` +} + +// ReportManifest - The manifest of the report generated by the operation. +type ReportManifest struct { + // The total number of blobs. + BlobCount *int32 `json:"blobCount,omitempty"` + + // List of blob information generated by this operation. + Blobs []*BlobInfo `json:"blobs,omitempty"` + + // The total number of bytes in all blobs. + ByteCount *int64 `json:"byteCount,omitempty"` + + // Is the data in compressed format. + CompressData *bool `json:"compressData,omitempty"` + + // The data format of the report + DataFormat *CostDetailsDataFormat `json:"dataFormat,omitempty"` + + // The Manifest version. + ManifestVersion *string `json:"manifestVersion,omitempty"` + + // The context of the Cost Details request. + RequestContext *RequestContext `json:"requestContext,omitempty"` +} + +// 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 + ReportURL *ReservationReportSchema `json:"reportUrl,omitempty"` + + // The time at which report URL becomes invalid. + ValidUntil *time.Time `json:"validUntil,omitempty"` +} + +// RequestContext - The context of the Cost Details request. +type RequestContext struct { + // The request payload body provided in Cost Details call + RequestBody *GenerateCostDetailsReportRequestDefinition `json:"requestBody,omitempty"` + + // The request scope of the request. + RequestScope *string `json:"requestScope,omitempty"` +} + +// 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 `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ResourceForCostManagement - The Resource model definition. +type ResourceForCostManagement struct { + // READ-ONLY; ETag of the resource. + ETag *string `json:"eTag,omitempty" azure:"ro"` + + // READ-ONLY; Resource Id. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Location of the resource. + Location *string `json:"location,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; SKU of the resource. + SKU *string `json:"sku,omitempty" azure:"ro"` + + // READ-ONLY; Resource tags. + Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// SavingsPlanUtilizationSummary - Savings plan utilization summary resource. +type SavingsPlanUtilizationSummary struct { + // REQUIRED; Supported values: 'SavingsPlan'. + Kind *BenefitKind `json:"kind,omitempty"` + + // Savings plan utilization summary properties. + Properties *SavingsPlanUtilizationSummaryProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// 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 `json:"benefitType,omitempty"` + + // READ-ONLY; ARM SKU name. For example, 'ComputeSavingsPlan' for savings plan. + ArmSKUName *string `json:"armSkuName,omitempty" azure:"ro"` + + // 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-04-01-preview 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 `json:"avgUtilizationPercentage,omitempty" azure:"ro"` + + // READ-ONLY; The benefit ID is the identifier of the benefit. + BenefitID *string `json:"benefitId,omitempty" azure:"ro"` + + // READ-ONLY; The benefit order ID is the identifier for a benefit purchase. + BenefitOrderID *string `json:"benefitOrderId,omitempty" azure:"ro"` + + // 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-04-01-preview 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 `json:"maxUtilizationPercentage,omitempty" azure:"ro"` + + // 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-04-01-preview 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 `json:"minUtilizationPercentage,omitempty" azure:"ro"` + + // 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 `json:"usageDate,omitempty" azure:"ro"` +} + +// ScheduleProperties - The properties of the schedule. +type ScheduleProperties struct { + // REQUIRED; The end date and time of the scheduled action (UTC). + EndDate *time.Time `json:"endDate,omitempty"` + + // REQUIRED; Frequency of the schedule. + Frequency *ScheduleFrequency `json:"frequency,omitempty"` + + // REQUIRED; The start date and time of the scheduled action (UTC). + StartDate *time.Time `json:"startDate,omitempty"` + + // 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 `json:"dayOfMonth,omitempty"` + + // Day names in english on which cost analysis data will be emailed. This property is applicable when frequency is Weekly + // or Monthly. + DaysOfWeek []*DaysOfWeek `json:"daysOfWeek,omitempty"` + + // UTC time at which cost analysis data will be emailed. + HourOfDay *int32 `json:"hourOfDay,omitempty"` + + // 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 `json:"weeksOfMonth,omitempty"` +} + +// ScheduledAction - Scheduled action definition. +type ScheduledAction struct { + // Kind of the scheduled action. + Kind *ScheduledActionKind `json:"kind,omitempty"` + + // The properties of the scheduled action. + Properties *ScheduledActionProperties `json:"properties,omitempty"` + + // 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 `json:"eTag,omitempty" azure:"ro"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Kind of the scheduled action. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// 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 `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; The list of scheduled actions. + Value []*ScheduledAction `json:"value,omitempty" azure:"ro"` +} + +// ScheduledActionProperties - The properties of the scheduled action. +type ScheduledActionProperties struct { + // REQUIRED; Scheduled action name. + DisplayName *string `json:"displayName,omitempty"` + + // REQUIRED; Notification properties based on scheduled action kind. + Notification *NotificationProperties `json:"notification,omitempty"` + + // REQUIRED; Schedule of the scheduled action. + Schedule *ScheduleProperties `json:"schedule,omitempty"` + + // REQUIRED; Status of the scheduled action. + Status *ScheduledActionStatus `json:"status,omitempty"` + + // REQUIRED; Cost analysis viewId used for scheduled action. For example, '/providers/Microsoft.CostManagement/views/swaggerExample' + ViewID *string `json:"viewId,omitempty"` + + // Destination format of the view data. This is optional. + FileDestination *FileDestination `json:"fileDestination,omitempty"` + + // Email address of the point of contact that should get the unsubscribe requests and notification emails. + NotificationEmail *string `json:"notificationEmail,omitempty"` + + // 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 `json:"scope,omitempty"` +} + +// ScheduledActionProxyResource - The Resource model definition. +type ScheduledActionProxyResource struct { + // Kind of the scheduled action. + Kind *ScheduledActionKind `json:"kind,omitempty"` + + // 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 `json:"eTag,omitempty" azure:"ro"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Kind of the scheduled action. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// 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 { + // placeholder for future optional parameters +} + +// ScheduledActionsClientCreateOrUpdateOptions contains the optional parameters for the ScheduledActionsClient.CreateOrUpdate +// method. +type ScheduledActionsClientCreateOrUpdateOptions struct { +} + +// 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 `json:"scope,omitempty"` + + // Grain of the proposed commitment amount. Supported values: 'Hourly' + CommitmentGranularity *Grain `json:"commitmentGranularity,omitempty"` + + // The number of days of usage evaluated for computing the recommendations. + LookBackPeriod *LookBackPeriod `json:"lookBackPeriod,omitempty"` + + // The details of the proposed recommendation. + RecommendationDetails *AllSavingsBenefitDetails `json:"recommendationDetails,omitempty"` + + // Term period of the benefit. For example, P1Y or P3Y. + Term *Term `json:"term,omitempty"` + + // On-demand charges between firstConsumptionDate and lastConsumptionDate that were used for computing benefit recommendations. + Usage *RecommendationUsageDetails `json:"usage,omitempty"` + + // READ-ONLY; The list of all benefit recommendations with the recommendation details. + AllRecommendationDetails *AllSavingsList `json:"allRecommendationDetails,omitempty" azure:"ro"` + + // READ-ONLY; ARM SKU name. 'ComputeSavingsPlan' for SavingsPlan. + ArmSKUName *string `json:"armSkuName,omitempty" azure:"ro"` + + // READ-ONLY; The current cost without benefit, corresponds to 'totalHours' in the look-back period. + CostWithoutBenefit *float64 `json:"costWithoutBenefit,omitempty" azure:"ro"` + + // READ-ONLY; An ISO 4217 currency code identifier for the costs and savings amounts. + CurrencyCode *string `json:"currencyCode,omitempty" azure:"ro"` + + // READ-ONLY; The first usage date used for looking back for computing the recommendations. + FirstConsumptionDate *time.Time `json:"firstConsumptionDate,omitempty" azure:"ro"` + + // READ-ONLY; The last usage date used for looking back for computing the recommendations. + LastConsumptionDate *time.Time `json:"lastConsumptionDate,omitempty" azure:"ro"` + + // 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 `json:"totalHours,omitempty" azure:"ro"` +} + +// 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 `json:"scope,omitempty"` + + // Grain of the proposed commitment amount. Supported values: 'Hourly' + CommitmentGranularity *Grain `json:"commitmentGranularity,omitempty"` + + // The number of days of usage evaluated for computing the recommendations. + LookBackPeriod *LookBackPeriod `json:"lookBackPeriod,omitempty"` + + // The details of the proposed recommendation. + RecommendationDetails *AllSavingsBenefitDetails `json:"recommendationDetails,omitempty"` + + // Term period of the benefit. For example, P1Y or P3Y. + Term *Term `json:"term,omitempty"` + + // On-demand charges between firstConsumptionDate and lastConsumptionDate that were used for computing benefit recommendations. + Usage *RecommendationUsageDetails `json:"usage,omitempty"` + + // READ-ONLY; The list of all benefit recommendations with the recommendation details. + AllRecommendationDetails *AllSavingsList `json:"allRecommendationDetails,omitempty" azure:"ro"` + + // READ-ONLY; ARM SKU name. 'ComputeSavingsPlan' for SavingsPlan. + ArmSKUName *string `json:"armSkuName,omitempty" azure:"ro"` + + // READ-ONLY; The current cost without benefit, corresponds to 'totalHours' in the look-back period. + CostWithoutBenefit *float64 `json:"costWithoutBenefit,omitempty" azure:"ro"` + + // READ-ONLY; An ISO 4217 currency code identifier for the costs and savings amounts. + CurrencyCode *string `json:"currencyCode,omitempty" azure:"ro"` + + // READ-ONLY; The first usage date used for looking back for computing the recommendations. + FirstConsumptionDate *time.Time `json:"firstConsumptionDate,omitempty" azure:"ro"` + + // READ-ONLY; The last usage date used for looking back for computing the recommendations. + LastConsumptionDate *time.Time `json:"lastConsumptionDate,omitempty" azure:"ro"` + + // 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 `json:"resourceGroup,omitempty" azure:"ro"` + + // READ-ONLY; The subscription ID that this single scope recommendation is for. Applicable only if recommendation is for 'Single' + // scope. + SubscriptionID *string `json:"subscriptionId,omitempty" azure:"ro"` + + // 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 `json:"totalHours,omitempty" azure:"ro"` +} + +// 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 `json:"status,omitempty"` +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time `json:"createdAt,omitempty"` + + // The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + + // The type of identity that created the resource. + CreatedByType *CreatedByType `json:"createdByType,omitempty"` + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + + // The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` +} + +// 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 + // the latest version or not. + ETag *string `json:"eTag,omitempty"` + + // The properties of the view. + Properties *ViewProperties `json:"properties,omitempty"` + + // READ-ONLY; Resource Id. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ViewListResult - Result of listing views. It contains a list of available views. +type ViewListResult struct { + // READ-ONLY; The link (url) to the next page of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; The list of views. + Value []*View `json:"value,omitempty" azure:"ro"` +} + +// ViewProperties - The properties of the view. +type ViewProperties struct { + // Show costs accumulated over time. + Accumulated *AccumulatedType `json:"accumulated,omitempty"` + + // Chart type of the main view in Cost Analysis. Required. + Chart *ChartType `json:"chart,omitempty"` + + // User input name of the view. Required. + DisplayName *string `json:"displayName,omitempty"` + + // List of KPIs to show in Cost Analysis UI. + Kpis []*KpiProperties `json:"kpis,omitempty"` + + // Metric to use when displaying costs. + Metric *MetricType `json:"metric,omitempty"` + + // Configuration of 3 sub-views in the Cost Analysis UI. + Pivots []*PivotProperties `json:"pivots,omitempty"` + + // Query body configuration. Required. + Query *ReportConfigDefinition `json:"query,omitempty"` + + // Cost Management scope to save the view on. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + // for resourceGroup + // scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + // for + // Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + // for EnrollmentAccount scope, + // 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile + // scope, + // 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection + // scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + // Management Group scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for + // ExternalBillingAccount scope, and + // '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope. + Scope *string `json:"scope,omitempty"` + + // READ-ONLY; Date the user created this view. + CreatedOn *time.Time `json:"createdOn,omitempty" azure:"ro"` + + // READ-ONLY; Currency of the current view. + Currency *string `json:"currency,omitempty" azure:"ro"` + + // READ-ONLY; Date range of the current view. + DateRange *string `json:"dateRange,omitempty" azure:"ro"` + + // READ-ONLY; Date when the user last modified this view. + ModifiedOn *time.Time `json:"modifiedOn,omitempty" azure:"ro"` +} + +// ViewsClientCreateOrUpdateByScopeOptions contains the optional parameters for the ViewsClient.CreateOrUpdateByScope method. +type ViewsClientCreateOrUpdateByScopeOptions struct { + // placeholder for future optional parameters +} + +// ViewsClientCreateOrUpdateOptions contains the optional parameters for the ViewsClient.CreateOrUpdate method. +type ViewsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ViewsClientDeleteByScopeOptions contains the optional parameters for the ViewsClient.DeleteByScope method. +type ViewsClientDeleteByScopeOptions struct { + // placeholder for future optional parameters +} + +// ViewsClientDeleteOptions contains the optional parameters for the ViewsClient.Delete method. +type ViewsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ViewsClientGetByScopeOptions contains the optional parameters for the ViewsClient.GetByScope method. +type ViewsClientGetByScopeOptions struct { + // placeholder for future optional parameters +} + +// ViewsClientGetOptions contains the optional parameters for the ViewsClient.Get method. +type ViewsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ViewsClientListByScopeOptions contains the optional parameters for the ViewsClient.NewListByScopePager method. +type ViewsClientListByScopeOptions struct { + // placeholder for future optional parameters +} + +// ViewsClientListOptions contains the optional parameters for the ViewsClient.NewListPager method. +type ViewsClientListOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/models_serde.go b/sdk/resourcemanager/costmanagement/armcostmanagement/models_serde.go new file mode 100644 index 000000000000..b09e3c6e4ab6 --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/models_serde.go @@ -0,0 +1,4926 @@ +//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" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Alert. +func (a Alert) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "eTag", a.ETag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Alert. +func (a *Alert) 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 "eTag": + err = unpopulate(val, "ETag", &a.ETag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + 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 AlertProperties. +func (a AlertProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "closeTime", a.CloseTime) + populate(objectMap, "costEntityId", a.CostEntityID) + populate(objectMap, "creationTime", a.CreationTime) + populate(objectMap, "definition", a.Definition) + populate(objectMap, "description", a.Description) + populate(objectMap, "details", a.Details) + populate(objectMap, "modificationTime", a.ModificationTime) + populate(objectMap, "source", a.Source) + populate(objectMap, "status", a.Status) + populate(objectMap, "statusModificationTime", a.StatusModificationTime) + populate(objectMap, "statusModificationUserName", a.StatusModificationUserName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertProperties. +func (a *AlertProperties) 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 "closeTime": + err = unpopulate(val, "CloseTime", &a.CloseTime) + delete(rawMsg, key) + case "costEntityId": + err = unpopulate(val, "CostEntityID", &a.CostEntityID) + delete(rawMsg, key) + case "creationTime": + err = unpopulate(val, "CreationTime", &a.CreationTime) + delete(rawMsg, key) + case "definition": + err = unpopulate(val, "Definition", &a.Definition) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &a.Details) + delete(rawMsg, key) + case "modificationTime": + err = unpopulate(val, "ModificationTime", &a.ModificationTime) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &a.Source) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + delete(rawMsg, key) + case "statusModificationTime": + err = unpopulate(val, "StatusModificationTime", &a.StatusModificationTime) + delete(rawMsg, key) + case "statusModificationUserName": + err = unpopulate(val, "StatusModificationUserName", &a.StatusModificationUserName) + 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 AlertPropertiesDefinition. +func (a AlertPropertiesDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "category", a.Category) + populate(objectMap, "criteria", a.Criteria) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertPropertiesDefinition. +func (a *AlertPropertiesDefinition) 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 "category": + err = unpopulate(val, "Category", &a.Category) + delete(rawMsg, key) + case "criteria": + err = unpopulate(val, "Criteria", &a.Criteria) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + 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 AlertPropertiesDetails. +func (a AlertPropertiesDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "amount", a.Amount) + populate(objectMap, "companyName", a.CompanyName) + populate(objectMap, "contactEmails", a.ContactEmails) + populate(objectMap, "contactGroups", a.ContactGroups) + populate(objectMap, "contactRoles", a.ContactRoles) + populate(objectMap, "currentSpend", a.CurrentSpend) + populate(objectMap, "departmentName", a.DepartmentName) + populate(objectMap, "enrollmentEndDate", a.EnrollmentEndDate) + populate(objectMap, "enrollmentNumber", a.EnrollmentNumber) + populate(objectMap, "enrollmentStartDate", a.EnrollmentStartDate) + populate(objectMap, "invoicingThreshold", a.InvoicingThreshold) + populate(objectMap, "meterFilter", a.MeterFilter) + populate(objectMap, "operator", a.Operator) + populate(objectMap, "overridingAlert", a.OverridingAlert) + populate(objectMap, "periodStartDate", a.PeriodStartDate) + populate(objectMap, "resourceFilter", a.ResourceFilter) + populate(objectMap, "resourceGroupFilter", a.ResourceGroupFilter) + populate(objectMap, "tagFilter", &a.TagFilter) + populate(objectMap, "threshold", a.Threshold) + populate(objectMap, "timeGrainType", a.TimeGrainType) + populate(objectMap, "triggeredBy", a.TriggeredBy) + populate(objectMap, "unit", a.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertPropertiesDetails. +func (a *AlertPropertiesDetails) 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 "amount": + err = unpopulate(val, "Amount", &a.Amount) + delete(rawMsg, key) + case "companyName": + err = unpopulate(val, "CompanyName", &a.CompanyName) + delete(rawMsg, key) + case "contactEmails": + err = unpopulate(val, "ContactEmails", &a.ContactEmails) + delete(rawMsg, key) + case "contactGroups": + err = unpopulate(val, "ContactGroups", &a.ContactGroups) + delete(rawMsg, key) + case "contactRoles": + err = unpopulate(val, "ContactRoles", &a.ContactRoles) + delete(rawMsg, key) + case "currentSpend": + err = unpopulate(val, "CurrentSpend", &a.CurrentSpend) + delete(rawMsg, key) + case "departmentName": + err = unpopulate(val, "DepartmentName", &a.DepartmentName) + delete(rawMsg, key) + case "enrollmentEndDate": + err = unpopulate(val, "EnrollmentEndDate", &a.EnrollmentEndDate) + delete(rawMsg, key) + case "enrollmentNumber": + err = unpopulate(val, "EnrollmentNumber", &a.EnrollmentNumber) + delete(rawMsg, key) + case "enrollmentStartDate": + err = unpopulate(val, "EnrollmentStartDate", &a.EnrollmentStartDate) + delete(rawMsg, key) + case "invoicingThreshold": + err = unpopulate(val, "InvoicingThreshold", &a.InvoicingThreshold) + delete(rawMsg, key) + case "meterFilter": + err = unpopulate(val, "MeterFilter", &a.MeterFilter) + delete(rawMsg, key) + case "operator": + err = unpopulate(val, "Operator", &a.Operator) + delete(rawMsg, key) + case "overridingAlert": + err = unpopulate(val, "OverridingAlert", &a.OverridingAlert) + delete(rawMsg, key) + case "periodStartDate": + err = unpopulate(val, "PeriodStartDate", &a.PeriodStartDate) + delete(rawMsg, key) + case "resourceFilter": + err = unpopulate(val, "ResourceFilter", &a.ResourceFilter) + delete(rawMsg, key) + case "resourceGroupFilter": + err = unpopulate(val, "ResourceGroupFilter", &a.ResourceGroupFilter) + delete(rawMsg, key) + case "tagFilter": + err = unpopulate(val, "TagFilter", &a.TagFilter) + delete(rawMsg, key) + case "threshold": + err = unpopulate(val, "Threshold", &a.Threshold) + delete(rawMsg, key) + case "timeGrainType": + err = unpopulate(val, "TimeGrainType", &a.TimeGrainType) + delete(rawMsg, key) + case "triggeredBy": + err = unpopulate(val, "TriggeredBy", &a.TriggeredBy) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &a.Unit) + 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 AlertsResult. +func (a AlertsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertsResult. +func (a *AlertsResult) 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 "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 AllSavingsBenefitDetails. +func (a AllSavingsBenefitDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "averageUtilizationPercentage": + err = unpopulate(val, "AverageUtilizationPercentage", &a.AverageUtilizationPercentage) + delete(rawMsg, key) + case "benefitCost": + err = unpopulate(val, "BenefitCost", &a.BenefitCost) + delete(rawMsg, key) + case "commitmentAmount": + err = unpopulate(val, "CommitmentAmount", &a.CommitmentAmount) + delete(rawMsg, key) + case "coveragePercentage": + err = unpopulate(val, "CoveragePercentage", &a.CoveragePercentage) + delete(rawMsg, key) + case "overageCost": + err = unpopulate(val, "OverageCost", &a.OverageCost) + delete(rawMsg, key) + 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", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AllSavingsList. +func (a AllSavingsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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 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", &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 "properties": + b.Properties, err = unmarshalBenefitRecommendationPropertiesClassification(val) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BenefitRecommendationProperties. +func (b BenefitRecommendationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allRecommendationDetails": + err = unpopulate(val, "AllRecommendationDetails", &b.AllRecommendationDetails) + delete(rawMsg, key) + case "armSkuName": + err = unpopulate(val, "ArmSKUName", &b.ArmSKUName) + delete(rawMsg, key) + case "commitmentGranularity": + err = unpopulate(val, "CommitmentGranularity", &b.CommitmentGranularity) + delete(rawMsg, key) + case "costWithoutBenefit": + err = unpopulate(val, "CostWithoutBenefit", &b.CostWithoutBenefit) + delete(rawMsg, key) + case "currencyCode": + err = unpopulate(val, "CurrencyCode", &b.CurrencyCode) + delete(rawMsg, key) + case "firstConsumptionDate": + err = unpopulateTimeRFC3339(val, "FirstConsumptionDate", &b.FirstConsumptionDate) + delete(rawMsg, key) + case "lastConsumptionDate": + err = unpopulateTimeRFC3339(val, "LastConsumptionDate", &b.LastConsumptionDate) + delete(rawMsg, key) + case "lookBackPeriod": + err = unpopulate(val, "LookBackPeriod", &b.LookBackPeriod) + delete(rawMsg, key) + 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", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BenefitRecommendationsListResult. +func (b BenefitRecommendationsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// 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", 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", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BenefitResource. +func (b BenefitResource) 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, "type", b.Type) + return json.Marshal(objectMap) +} + +// 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", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BenefitUtilizationSummariesListResult. +func (b BenefitUtilizationSummariesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// 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", 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": + b.Value, err = unmarshalBenefitUtilizationSummaryClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BenefitUtilizationSummary. +func (b BenefitUtilizationSummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BenefitUtilizationSummaryProperties. +func (b BenefitUtilizationSummaryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "armSkuName": + err = unpopulate(val, "ArmSKUName", &b.ArmSKUName) + delete(rawMsg, key) + 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", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BlobInfo. +func (b BlobInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "blobLink", b.BlobLink) + populate(objectMap, "byteCount", b.ByteCount) + return json.Marshal(objectMap) +} + +// 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", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Budget. +func (b Budget) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "eTag", b.ETag) + populate(objectMap, "id", b.ID) + 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 Budget. +func (b *Budget) 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 "eTag": + err = unpopulate(val, "ETag", &b.ETag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BudgetComparisonExpression. +func (b BudgetComparisonExpression) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", b.Name) + populate(objectMap, "operator", b.Operator) + populate(objectMap, "values", b.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BudgetComparisonExpression. +func (b *BudgetComparisonExpression) 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 "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "operator": + err = unpopulate(val, "Operator", &b.Operator) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &b.Values) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BudgetFilter. +func (b BudgetFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "and", b.And) + populate(objectMap, "dimensions", b.Dimensions) + populate(objectMap, "tags", b.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BudgetFilter. +func (b *BudgetFilter) 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 "and": + err = unpopulate(val, "And", &b.And) + delete(rawMsg, key) + case "dimensions": + err = unpopulate(val, "Dimensions", &b.Dimensions) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &b.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BudgetFilterProperties. +func (b BudgetFilterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dimensions", b.Dimensions) + populate(objectMap, "tags", b.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BudgetFilterProperties. +func (b *BudgetFilterProperties) 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 "dimensions": + err = unpopulate(val, "Dimensions", &b.Dimensions) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &b.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BudgetProperties. +func (b BudgetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "amount", b.Amount) + populate(objectMap, "category", b.Category) + populate(objectMap, "currentSpend", b.CurrentSpend) + populate(objectMap, "filter", b.Filter) + populate(objectMap, "forecastSpend", b.ForecastSpend) + populate(objectMap, "notifications", b.Notifications) + populate(objectMap, "timeGrain", b.TimeGrain) + populate(objectMap, "timePeriod", b.TimePeriod) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BudgetProperties. +func (b *BudgetProperties) 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 "amount": + err = unpopulate(val, "Amount", &b.Amount) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &b.Category) + delete(rawMsg, key) + case "currentSpend": + err = unpopulate(val, "CurrentSpend", &b.CurrentSpend) + delete(rawMsg, key) + case "filter": + err = unpopulate(val, "Filter", &b.Filter) + delete(rawMsg, key) + case "forecastSpend": + err = unpopulate(val, "ForecastSpend", &b.ForecastSpend) + delete(rawMsg, key) + case "notifications": + err = unpopulate(val, "Notifications", &b.Notifications) + delete(rawMsg, key) + case "timeGrain": + err = unpopulate(val, "TimeGrain", &b.TimeGrain) + delete(rawMsg, key) + case "timePeriod": + err = unpopulate(val, "TimePeriod", &b.TimePeriod) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BudgetTimePeriod. +func (b BudgetTimePeriod) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "endDate", b.EndDate) + populateTimeRFC3339(objectMap, "startDate", b.StartDate) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BudgetTimePeriod. +func (b *BudgetTimePeriod) 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 "endDate": + err = unpopulateTimeRFC3339(val, "EndDate", &b.EndDate) + delete(rawMsg, key) + case "startDate": + err = unpopulateTimeRFC3339(val, "StartDate", &b.StartDate) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BudgetsListResult. +func (b BudgetsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BudgetsListResult. +func (b *BudgetsListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &b.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityRequest. +func (c CheckNameAvailabilityRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", c.Name) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityResponse. +func (c CheckNameAvailabilityResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &c.NameAvailable) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &c.Reason) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CommonExportProperties. +func (c CommonExportProperties) 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) + return json.Marshal(objectMap) +} + +// 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CostDetailsOperationResults. +func (c CostDetailsOperationResults) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &c.Error) + delete(rawMsg, key) + case "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", &c.Name) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + delete(rawMsg, key) + case "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", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CostDetailsTimePeriod. +func (c CostDetailsTimePeriod) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "end", c.End) + populate(objectMap, "start", c.Start) + return json.Marshal(objectMap) +} + +// 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CurrentSpend. +func (c CurrentSpend) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "amount", c.Amount) + populate(objectMap, "unit", c.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CurrentSpend. +func (c *CurrentSpend) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "amount": + err = unpopulate(val, "Amount", &c.Amount) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &c.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Dimension. +func (d Dimension) 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) + return json.Marshal(objectMap) +} + +// 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "eTag": + err = unpopulate(val, "ETag", &d.ETag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.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) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DimensionProperties. +func (d DimensionProperties) 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) + return json.Marshal(objectMap) +} + +// 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DimensionsListResult. +func (d DimensionsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DismissAlertPayload. +func (d DismissAlertPayload) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", d.Properties) + return json.Marshal(objectMap) +} + +// 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DownloadURL. +func (d DownloadURL) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "downloadUrl": + err = unpopulate(val, "DownloadURL", &d.DownloadURL) + delete(rawMsg, key) + case "expiryTime": + err = unpopulateTimeRFC3339(val, "ExpiryTime", &d.ExpiryTime) + delete(rawMsg, key) + case "validTill": + err = unpopulateTimeRFC3339(val, "ValidTill", &d.ValidTill) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetails. +func (e ErrorDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + 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 ErrorDetailsWithNestedDetails. +func (e ErrorDetailsWithNestedDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + 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 ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + 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 ErrorResponseWithNestedDetails. +func (e ErrorResponseWithNestedDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + 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 Export. +func (e Export) 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 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", 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 ExportDataset. +func (e ExportDataset) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "configuration", e.Configuration) + populate(objectMap, "granularity", e.Granularity) + return json.Marshal(objectMap) +} + +// 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "configuration": + err = unpopulate(val, "Configuration", &e.Configuration) + delete(rawMsg, key) + case "granularity": + err = unpopulate(val, "Granularity", &e.Granularity) + 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 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 ForecastSpend. +func (f ForecastSpend) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "amount", f.Amount) + populate(objectMap, "unit", f.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ForecastSpend. +func (f *ForecastSpend) 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 "amount": + err = unpopulate(val, "Amount", &f.Amount) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &f.Unit) + 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, "error", g.Error) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + 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 { + 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) + 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 "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 Notification. +func (n Notification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "contactEmails", n.ContactEmails) + populate(objectMap, "contactGroups", n.ContactGroups) + populate(objectMap, "contactRoles", n.ContactRoles) + populate(objectMap, "enabled", n.Enabled) + populate(objectMap, "frequency", n.Frequency) + populate(objectMap, "locale", n.Locale) + populate(objectMap, "operator", n.Operator) + populate(objectMap, "threshold", n.Threshold) + populate(objectMap, "thresholdType", n.ThresholdType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Notification. +func (n *Notification) 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 "contactEmails": + err = unpopulate(val, "ContactEmails", &n.ContactEmails) + delete(rawMsg, key) + case "contactGroups": + err = unpopulate(val, "ContactGroups", &n.ContactGroups) + delete(rawMsg, key) + case "contactRoles": + err = unpopulate(val, "ContactRoles", &n.ContactRoles) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &n.Enabled) + delete(rawMsg, key) + case "frequency": + err = unpopulate(val, "Frequency", &n.Frequency) + delete(rawMsg, key) + case "locale": + err = unpopulate(val, "Locale", &n.Locale) + delete(rawMsg, key) + case "operator": + err = unpopulate(val, "Operator", &n.Operator) + delete(rawMsg, key) + case "threshold": + err = unpopulate(val, "Threshold", &n.Threshold) + delete(rawMsg, key) + case "thresholdType": + err = unpopulate(val, "ThresholdType", &n.ThresholdType) + 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 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", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &q.Name) + delete(rawMsg, key) + 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", &q.Name) + delete(rawMsg, key) + case "operator": + err = unpopulate(val, "Operator", &q.Operator) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &q.Values) + 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 QueryDataset. +func (q QueryDataset) 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) + return json.Marshal(objectMap) +} + +// 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", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aggregation": + err = unpopulate(val, "Aggregation", &q.Aggregation) + delete(rawMsg, key) + 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", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QueryDatasetConfiguration. +func (q QueryDatasetConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "columns", q.Columns) + return json.Marshal(objectMap) +} + +// 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", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "columns": + err = unpopulate(val, "Columns", &q.Columns) + 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 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", &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 QueryFilter. +func (q QueryFilter) 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) + return json.Marshal(objectMap) +} + +// 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", q, 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) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &q.Tags) + 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 QueryGrouping. +func (q QueryGrouping) 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 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", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &q.Name) + delete(rawMsg, key) + 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 "nextLink": + err = unpopulate(val, "NextLink", &q.NextLink) + delete(rawMsg, key) + case "rows": + err = unpopulate(val, "Rows", &q.Rows) + 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 QueryResult. +func (q QueryResult) 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) + return json.Marshal(objectMap) +} + +// 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", q, 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) + delete(rawMsg, key) + 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 QueryTimePeriod. +func (q QueryTimePeriod) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "from", q.From) + populateTimeRFC3339(objectMap, "to", q.To) + return json.Marshal(objectMap) +} + +// 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", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "from": + err = unpopulateTimeRFC3339(val, "From", &q.From) + delete(rawMsg, key) + case "to": + err = unpopulateTimeRFC3339(val, "To", &q.To) + 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 RecommendationUsageDetails. +func (r RecommendationUsageDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "charges", r.Charges) + populate(objectMap, "usageGrain", r.UsageGrain) + return json.Marshal(objectMap) +} + +// 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "charges": + err = unpopulate(val, "Charges", &r.Charges) + delete(rawMsg, key) + case "usageGrain": + err = unpopulate(val, "UsageGrain", &r.UsageGrain) + delete(rawMsg, key) + } + if err != nil { + 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) { + objectMap := make(map[string]any) + populate(objectMap, "function", r.Function) + populate(objectMap, "name", r.Name) + return json.Marshal(objectMap) +} + +// 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "function": + err = unpopulate(val, "Function", &r.Function) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReportConfigComparisonExpression. +func (r ReportConfigComparisonExpression) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "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", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReportConfigDataset. +func (r ReportConfigDataset) 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) + return json.Marshal(objectMap) +} + +// 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", r, 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) + 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", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReportConfigDatasetConfiguration. +func (r ReportConfigDatasetConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "columns", r.Columns) + return json.Marshal(objectMap) +} + +// 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "columns": + err = unpopulate(val, "Columns", &r.Columns) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReportConfigDefinition. +func (r ReportConfigDefinition) 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) + return json.Marshal(objectMap) +} + +// 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataSet": + err = unpopulate(val, "DataSet", &r.DataSet) + delete(rawMsg, key) + case "includeMonetaryCommitment": + err = unpopulate(val, "IncludeMonetaryCommitment", &r.IncludeMonetaryCommitment) + delete(rawMsg, key) + case "timePeriod": + err = unpopulate(val, "TimePeriod", &r.TimePeriod) + delete(rawMsg, key) + case "timeframe": + err = unpopulate(val, "Timeframe", &r.Timeframe) + 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) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReportConfigFilter. +func (r ReportConfigFilter) 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) + return json.Marshal(objectMap) +} + +// 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReportConfigGrouping. +func (r ReportConfigGrouping) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", r.Name) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// 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", r, err) + } + for key, val := range rawMsg { + var err error + switch 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) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReportConfigSorting. +func (r ReportConfigSorting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "direction", r.Direction) + populate(objectMap, "name", r.Name) + return json.Marshal(objectMap) +} + +// 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "direction": + err = unpopulate(val, "Direction", &r.Direction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReportConfigTimePeriod. +func (r ReportConfigTimePeriod) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "from", r.From) + populateTimeRFC3339(objectMap, "to", r.To) + return json.Marshal(objectMap) +} + +// 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "from": + err = unpopulateTimeRFC3339(val, "From", &r.From) + delete(rawMsg, key) + case "to": + err = unpopulateTimeRFC3339(val, "To", &r.To) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReportManifest. +func (r ReportManifest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "blobCount": + err = unpopulate(val, "BlobCount", &r.BlobCount) + delete(rawMsg, key) + case "blobs": + err = unpopulate(val, "Blobs", &r.Blobs) + delete(rawMsg, key) + 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", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReportURL. +func (r ReportURL) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "reportUrl", r.ReportURL) + populateTimeRFC3339(objectMap, "validUntil", r.ValidUntil) + return json.Marshal(objectMap) +} + +// 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "reportUrl": + err = unpopulate(val, "ReportURL", &r.ReportURL) + delete(rawMsg, key) + case "validUntil": + err = unpopulateTimeRFC3339(val, "ValidUntil", &r.ValidUntil) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RequestContext. +func (r RequestContext) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "requestBody", r.RequestBody) + populate(objectMap, "requestScope", r.RequestScope) + return json.Marshal(objectMap) +} + +// 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "requestBody": + err = unpopulate(val, "RequestBody", &r.RequestBody) + delete(rawMsg, key) + case "requestScope": + err = unpopulate(val, "RequestScope", &r.RequestScope) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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) + } + for key, val := range rawMsg { + var err error + switch key { + 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) + } + } + return nil +} + +// 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, "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 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) + } + 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 "sku": + err = unpopulate(val, "SKU", &r.SKU) + delete(rawMsg, key) + 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 { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SavingsPlanUtilizationSummary. +func (s SavingsPlanUtilizationSummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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 "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + 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 SavingsPlanUtilizationSummaryProperties. +func (s SavingsPlanUtilizationSummaryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScheduleProperties. +func (s ScheduleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dayOfMonth": + err = unpopulate(val, "DayOfMonth", &s.DayOfMonth) + delete(rawMsg, key) + case "daysOfWeek": + err = unpopulate(val, "DaysOfWeek", &s.DaysOfWeek) + delete(rawMsg, key) + case "endDate": + err = unpopulateTimeRFC3339(val, "EndDate", &s.EndDate) + delete(rawMsg, key) + case "frequency": + err = unpopulate(val, "Frequency", &s.Frequency) + delete(rawMsg, key) + 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", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScheduledAction. +func (s ScheduledAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "eTag": + err = unpopulate(val, "ETag", &s.ETag) + delete(rawMsg, key) + 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 "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", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScheduledActionListResult. +func (s ScheduledActionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + 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 ScheduledActionProperties. +func (s ScheduledActionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + delete(rawMsg, key) + 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", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScheduledActionProxyResource. +func (s ScheduledActionProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "eTag": + err = unpopulate(val, "ETag", &s.ETag) + delete(rawMsg, key) + 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", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SharedScopeBenefitRecommendationProperties. +func (s SharedScopeBenefitRecommendationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allRecommendationDetails": + err = unpopulate(val, "AllRecommendationDetails", &s.AllRecommendationDetails) + delete(rawMsg, key) + 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", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SingleScopeBenefitRecommendationProperties. +func (s SingleScopeBenefitRecommendationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allRecommendationDetails": + err = unpopulate(val, "AllRecommendationDetails", &s.AllRecommendationDetails) + delete(rawMsg, key) + 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 "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", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Status. +func (s Status) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "status", s.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Status. +func (s *Status) 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 "status": + err = unpopulate(val, "Status", &s.Status) + 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 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) + populate(objectMap, "eTag", v.ETag) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type View. +func (v *View) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "eTag": + err = unpopulate(val, "ETag", &v.ETag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ViewListResult. +func (v ViewListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ViewListResult. +func (v *ViewListResult) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ViewProperties. +func (v ViewProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accumulated", v.Accumulated) + populate(objectMap, "chart", v.Chart) + populateTimeRFC3339(objectMap, "createdOn", v.CreatedOn) + populate(objectMap, "currency", v.Currency) + populate(objectMap, "dateRange", v.DateRange) + populate(objectMap, "displayName", v.DisplayName) + populate(objectMap, "kpis", v.Kpis) + populate(objectMap, "metric", v.Metric) + populateTimeRFC3339(objectMap, "modifiedOn", v.ModifiedOn) + populate(objectMap, "pivots", v.Pivots) + populate(objectMap, "query", v.Query) + populate(objectMap, "scope", v.Scope) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ViewProperties. +func (v *ViewProperties) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "accumulated": + err = unpopulate(val, "Accumulated", &v.Accumulated) + delete(rawMsg, key) + case "chart": + err = unpopulate(val, "Chart", &v.Chart) + delete(rawMsg, key) + case "createdOn": + err = unpopulateTimeRFC3339(val, "CreatedOn", &v.CreatedOn) + delete(rawMsg, key) + case "currency": + err = unpopulate(val, "Currency", &v.Currency) + delete(rawMsg, key) + case "dateRange": + err = unpopulate(val, "DateRange", &v.DateRange) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &v.DisplayName) + delete(rawMsg, key) + case "kpis": + err = unpopulate(val, "Kpis", &v.Kpis) + delete(rawMsg, key) + case "metric": + err = unpopulate(val, "Metric", &v.Metric) + delete(rawMsg, key) + case "modifiedOn": + err = unpopulateTimeRFC3339(val, "ModifiedOn", &v.ModifiedOn) + delete(rawMsg, key) + case "pivots": + err = unpopulate(val, "Pivots", &v.Pivots) + delete(rawMsg, key) + case "query": + err = unpopulate(val, "Query", &v.Query) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &v.Scope) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_operations_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/operations_client.go similarity index 75% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_operations_client.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/operations_client.go index f34e2f76b719..1443d41643ab 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_operations_client.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/operations_client.go @@ -5,6 +5,7 @@ // 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 @@ -12,8 +13,6 @@ import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -22,36 +21,27 @@ import ( // OperationsClient contains the methods for the Operations group. // Don't use this type directly, use NewOperationsClient() instead. type OperationsClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &OperationsClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // NewListPager - Lists all of the available cost management REST API operations. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// +// Generated from API version 2023-04-01-preview +// - 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]{ More: func(page OperationsClientListResponse) bool { @@ -68,7 +58,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption if err != nil { return OperationsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return OperationsClientListResponse{}, err } @@ -83,12 +73,12 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption // listCreateRequest creates the List request. func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.CostManagement/operations" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil 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..b6cf73dc0f33 --- /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-04-01-preview +// - 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-04-01-preview +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-04-01-preview") + 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-04-01-preview +// - 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-04-01-preview +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-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_query_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/query_client.go similarity index 65% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_query_client.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/query_client.go index 33fb2aa9eb69..92f8817634d0 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_query_client.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/query_client.go @@ -5,6 +5,7 @@ // 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 @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,53 +24,45 @@ import ( // QueryClient contains the methods for the Query group. // Don't use this type directly, use NewQueryClient() instead. type QueryClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewQueryClient creates a new instance of QueryClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewQueryClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*QueryClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".QueryClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &QueryClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // Usage - Query the usage data for scope defined. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// scope - The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for -// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount -// scope, -// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// parameters - Parameters supplied to the CreateOrUpdate Query Config operation. -// options - QueryClientUsageOptions contains the optional parameters for the QueryClient.Usage method. +// +// Generated from API version 2023-04-01-preview +// - scope - The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription +// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for +// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount +// scope, +// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' +// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' +// for invoiceSection scope, and +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. +// - parameters - Parameters supplied to the CreateOrUpdate Query Config operation. +// - options - QueryClientUsageOptions contains the optional parameters for the QueryClient.Usage method. func (client *QueryClient) Usage(ctx context.Context, scope string, parameters QueryDefinition, options *QueryClientUsageOptions) (QueryClientUsageResponse, error) { req, err := client.usageCreateRequest(ctx, scope, parameters, options) if err != nil { return QueryClientUsageResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return QueryClientUsageResponse{}, err } @@ -85,12 +76,12 @@ func (client *QueryClient) Usage(ctx context.Context, scope string, parameters Q func (client *QueryClient) usageCreateRequest(ctx context.Context, scope string, parameters QueryDefinition, options *QueryClientUsageOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.CostManagement/query" urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + 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", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -107,20 +98,21 @@ 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 -// externalCloudProviderType - The external cloud provider type associated with dimension/query operations. This includes -// 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. -// externalCloudProviderID - This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for -// consolidated account used with dimension/query operations. -// parameters - Parameters supplied to the CreateOrUpdate Query Config operation. -// options - QueryClientUsageByExternalCloudProviderTypeOptions contains the optional parameters for the QueryClient.UsageByExternalCloudProviderType -// method. +// +// Generated from API version 2023-04-01-preview +// - externalCloudProviderType - The external cloud provider type associated with dimension/query operations. This includes +// 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. +// - externalCloudProviderID - This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for +// consolidated account used with dimension/query operations. +// - parameters - Parameters supplied to the CreateOrUpdate Query Config operation. +// - options - QueryClientUsageByExternalCloudProviderTypeOptions contains the optional parameters for the QueryClient.UsageByExternalCloudProviderType +// method. func (client *QueryClient) UsageByExternalCloudProviderType(ctx context.Context, externalCloudProviderType ExternalCloudProviderType, externalCloudProviderID string, parameters QueryDefinition, options *QueryClientUsageByExternalCloudProviderTypeOptions) (QueryClientUsageByExternalCloudProviderTypeResponse, error) { req, err := client.usageByExternalCloudProviderTypeCreateRequest(ctx, externalCloudProviderType, externalCloudProviderID, parameters, options) if err != nil { return QueryClientUsageByExternalCloudProviderTypeResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return QueryClientUsageByExternalCloudProviderTypeResponse{}, err } @@ -141,12 +133,12 @@ func (client *QueryClient) usageByExternalCloudProviderTypeCreateRequest(ctx con return nil, errors.New("parameter externalCloudProviderID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{externalCloudProviderId}", url.PathEscape(externalCloudProviderID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + 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", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") 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/response_types.go b/sdk/resourcemanager/costmanagement/armcostmanagement/response_types.go new file mode 100644 index 000000000000..3cf5b174cc30 --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/response_types.go @@ -0,0 +1,285 @@ +//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 + +// AlertsClientDismissResponse contains the response from method AlertsClient.Dismiss. +type AlertsClientDismissResponse struct { + Alert +} + +// AlertsClientGetResponse contains the response from method AlertsClient.Get. +type AlertsClientGetResponse struct { + Alert +} + +// AlertsClientListExternalResponse contains the response from method AlertsClient.ListExternal. +type AlertsClientListExternalResponse struct { + AlertsResult +} + +// AlertsClientListResponse contains the response from method AlertsClient.List. +type AlertsClientListResponse struct { + AlertsResult +} + +// BenefitRecommendationsClientListResponse contains the response from method BenefitRecommendationsClient.NewListPager. +type BenefitRecommendationsClientListResponse struct { + BenefitRecommendationsListResult +} + +// 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 +} + +// BudgetsClientCreateOrUpdateResponse contains the response from method BudgetsClient.CreateOrUpdate. +type BudgetsClientCreateOrUpdateResponse struct { + Budget +} + +// BudgetsClientDeleteResponse contains the response from method BudgetsClient.Delete. +type BudgetsClientDeleteResponse struct { + // placeholder for future response values +} + +// BudgetsClientGetResponse contains the response from method BudgetsClient.Get. +type BudgetsClientGetResponse struct { + Budget +} + +// BudgetsClientListResponse contains the response from method BudgetsClient.NewListPager. +type BudgetsClientListResponse struct { + BudgetsListResult +} + +// DimensionsClientByExternalCloudProviderTypeResponse contains the response from method DimensionsClient.NewByExternalCloudProviderTypePager. +type DimensionsClientByExternalCloudProviderTypeResponse struct { + DimensionsListResult +} + +// DimensionsClientListResponse contains the response from method DimensionsClient.NewListPager. +type DimensionsClientListResponse struct { + DimensionsListResult +} + +// ExportsClientCreateOrUpdateResponse contains the response from method ExportsClient.CreateOrUpdate. +type ExportsClientCreateOrUpdateResponse struct { + Export +} + +// ExportsClientDeleteResponse contains the response from method ExportsClient.Delete. +type ExportsClientDeleteResponse struct { + // placeholder for future response values +} + +// ExportsClientExecuteResponse contains the response from method ExportsClient.Execute. +type ExportsClientExecuteResponse struct { + // placeholder for future response values +} + +// ExportsClientGetExecutionHistoryResponse contains the response from method ExportsClient.GetExecutionHistory. +type ExportsClientGetExecutionHistoryResponse struct { + ExportExecutionListResult +} + +// ExportsClientGetResponse contains the response from method ExportsClient.Get. +type ExportsClientGetResponse struct { + Export +} + +// ExportsClientListResponse contains the response from method ExportsClient.List. +type ExportsClientListResponse struct { + ExportListResult +} + +// ForecastClientExternalCloudProviderUsageResponse contains the response from method ForecastClient.ExternalCloudProviderUsage. +type ForecastClientExternalCloudProviderUsageResponse struct { + ForecastResult +} + +// ForecastClientUsageResponse contains the response from method ForecastClient.Usage. +type ForecastClientUsageResponse struct { + 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. +type GenerateDetailedCostReportClientCreateOperationResponse struct { + GenerateDetailedCostReportOperationResult +} + +// GenerateDetailedCostReportOperationResultsClientGetResponse contains the response from method GenerateDetailedCostReportOperationResultsClient.BeginGet. +type GenerateDetailedCostReportOperationResultsClientGetResponse struct { + GenerateDetailedCostReportOperationResult +} + +// GenerateDetailedCostReportOperationStatusClientGetResponse contains the response from method GenerateDetailedCostReportOperationStatusClient.Get. +type GenerateDetailedCostReportOperationStatusClientGetResponse struct { + GenerateDetailedCostReportOperationStatuses +} + +// GenerateReservationDetailsReportClientByBillingAccountIDResponse contains the response from method GenerateReservationDetailsReportClient.BeginByBillingAccountID. +type GenerateReservationDetailsReportClientByBillingAccountIDResponse struct { + OperationStatus +} + +// GenerateReservationDetailsReportClientByBillingProfileIDResponse contains the response from method GenerateReservationDetailsReportClient.BeginByBillingProfileID. +type GenerateReservationDetailsReportClientByBillingProfileIDResponse struct { + OperationStatus +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +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 +} + +// QueryClientUsageResponse contains the response from method QueryClient.Usage. +type QueryClientUsageResponse struct { + QueryResult +} + +// 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 +} + +// ViewsClientCreateOrUpdateResponse contains the response from method ViewsClient.CreateOrUpdate. +type ViewsClientCreateOrUpdateResponse struct { + View +} + +// ViewsClientDeleteByScopeResponse contains the response from method ViewsClient.DeleteByScope. +type ViewsClientDeleteByScopeResponse struct { + // placeholder for future response values +} + +// ViewsClientDeleteResponse contains the response from method ViewsClient.Delete. +type ViewsClientDeleteResponse struct { + // placeholder for future response values +} + +// ViewsClientGetByScopeResponse contains the response from method ViewsClient.GetByScope. +type ViewsClientGetByScopeResponse struct { + View +} + +// ViewsClientGetResponse contains the response from method ViewsClient.Get. +type ViewsClientGetResponse struct { + View +} + +// ViewsClientListByScopeResponse contains the response from method ViewsClient.NewListByScopePager. +type ViewsClientListByScopeResponse struct { + ViewListResult +} + +// ViewsClientListResponse contains the response from method ViewsClient.NewListPager. +type ViewsClientListResponse struct { + ViewListResult +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/scheduledactions_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/scheduledactions_client.go new file mode 100644 index 000000000000..5df635293700 --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/scheduledactions_client.go @@ -0,0 +1,723 @@ +//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 + ifMatch *string +} + +// NewScheduledActionsClient creates a new instance of ScheduledActionsClient with the specified values. +// - ifMatch - ETag of the Entity. Not required when creating an entity, but required when updating an entity. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewScheduledActionsClient(ifMatch *string, 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{ + ifMatch: ifMatch, + 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-04-01-preview +// - 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-04-01-preview") + 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-04-01-preview +// - 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-04-01-preview") + 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-04-01-preview +// - 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-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if client.ifMatch != nil { + req.Raw().Header["If-Match"] = []string{*client.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-04-01-preview +// - 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-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if client.ifMatch != nil { + req.Raw().Header["If-Match"] = []string{*client.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-04-01-preview +// - 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-04-01-preview") + 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-04-01-preview +// - 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-04-01-preview") + 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-04-01-preview +// - 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-04-01-preview") + 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-04-01-preview +// - 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-04-01-preview") + 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-04-01-preview +// - 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-04-01-preview") + 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-04-01-preview +// - 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-04-01-preview") + 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-04-01-preview +// - 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-04-01-preview") + 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-04-01-preview +// - 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-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_time_rfc3339.go b/sdk/resourcemanager/costmanagement/armcostmanagement/time_rfc3339.go similarity index 96% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/time_rfc3339.go index 3fccf88c1d9f..91525711655a 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/time_rfc3339.go @@ -5,6 +5,7 @@ // 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 @@ -61,7 +62,7 @@ func (t *timeRFC3339) Parse(layout, value string) error { return err } -func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_views_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/views_client.go similarity index 66% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_views_client.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/views_client.go index 51a00b3475a9..cab223de7b8e 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_views_client.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/views_client.go @@ -5,6 +5,7 @@ // 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 @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,28 +24,19 @@ import ( // ViewsClient contains the methods for the Views group. // Don't use this type directly, use NewViewsClient() instead. type ViewsClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewViewsClient creates a new instance of ViewsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewViewsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ViewsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".ViewsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ViewsClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } @@ -55,16 +45,17 @@ func NewViewsClient(credential azcore.TokenCredential, options *arm.ClientOption // You may obtain the latest eTag by performing a get operation. Create operation does not // require eTag. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// viewName - View name -// parameters - Parameters supplied to the CreateOrUpdate View operation. -// options - ViewsClientCreateOrUpdateOptions contains the optional parameters for the ViewsClient.CreateOrUpdate method. +// +// Generated from API version 2023-04-01-preview +// - viewName - View name +// - parameters - Parameters supplied to the CreateOrUpdate View operation. +// - options - ViewsClientCreateOrUpdateOptions contains the optional parameters for the ViewsClient.CreateOrUpdate method. func (client *ViewsClient) CreateOrUpdate(ctx context.Context, viewName string, parameters View, options *ViewsClientCreateOrUpdateOptions) (ViewsClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, viewName, parameters, options) if err != nil { return ViewsClientCreateOrUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ViewsClientCreateOrUpdateResponse{}, err } @@ -81,12 +72,12 @@ func (client *ViewsClient) createOrUpdateCreateRequest(ctx context.Context, view return nil, errors.New("parameter viewName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + 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", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -105,30 +96,31 @@ func (client *ViewsClient) createOrUpdateHandleResponse(resp *http.Response) (Vi // request. You may obtain the latest eTag by performing a get operation. Create operation does not // require eTag. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// scope - The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, -// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup -// scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' -// for -// Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile -// scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection -// scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for -// Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External -// Billing Account scope and -// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. -// viewName - View name -// parameters - Parameters supplied to the CreateOrUpdate View operation. -// options - ViewsClientCreateOrUpdateByScopeOptions contains the optional parameters for the ViewsClient.CreateOrUpdateByScope -// method. +// +// Generated from API version 2023-04-01-preview +// - scope - The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, +// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup +// scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' +// for +// Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' +// for EnrollmentAccount scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection +// scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for +// Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External +// Billing Account scope and +// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. +// - viewName - View name +// - parameters - Parameters supplied to the CreateOrUpdate View operation. +// - options - ViewsClientCreateOrUpdateByScopeOptions contains the optional parameters for the ViewsClient.CreateOrUpdateByScope +// method. func (client *ViewsClient) CreateOrUpdateByScope(ctx context.Context, scope string, viewName string, parameters View, options *ViewsClientCreateOrUpdateByScopeOptions) (ViewsClientCreateOrUpdateByScopeResponse, error) { req, err := client.createOrUpdateByScopeCreateRequest(ctx, scope, viewName, parameters, options) if err != nil { return ViewsClientCreateOrUpdateByScopeResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ViewsClientCreateOrUpdateByScopeResponse{}, err } @@ -149,12 +141,12 @@ func (client *ViewsClient) createOrUpdateByScopeCreateRequest(ctx context.Contex return nil, errors.New("parameter viewName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + 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", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -171,15 +163,16 @@ 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 -// viewName - View name -// options - ViewsClientDeleteOptions contains the optional parameters for the ViewsClient.Delete method. +// +// Generated from API version 2023-04-01-preview +// - 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) { req, err := client.deleteCreateRequest(ctx, viewName, options) if err != nil { return ViewsClientDeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ViewsClientDeleteResponse{}, err } @@ -196,12 +189,12 @@ func (client *ViewsClient) deleteCreateRequest(ctx context.Context, viewName str return nil, errors.New("parameter viewName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + 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", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -209,28 +202,29 @@ 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 -// scope - The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, -// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup -// scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' -// for -// Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile -// scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection -// scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for -// Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External -// Billing Account scope and -// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. -// viewName - View name -// options - ViewsClientDeleteByScopeOptions contains the optional parameters for the ViewsClient.DeleteByScope method. +// +// Generated from API version 2023-04-01-preview +// - scope - The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, +// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup +// scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' +// for +// Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' +// for EnrollmentAccount scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection +// scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for +// Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External +// Billing Account scope and +// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. +// - viewName - View name +// - options - ViewsClientDeleteByScopeOptions contains the optional parameters for the ViewsClient.DeleteByScope method. func (client *ViewsClient) DeleteByScope(ctx context.Context, scope string, viewName string, options *ViewsClientDeleteByScopeOptions) (ViewsClientDeleteByScopeResponse, error) { req, err := client.deleteByScopeCreateRequest(ctx, scope, viewName, options) if err != nil { return ViewsClientDeleteByScopeResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ViewsClientDeleteByScopeResponse{}, err } @@ -251,12 +245,12 @@ func (client *ViewsClient) deleteByScopeCreateRequest(ctx context.Context, scope return nil, errors.New("parameter viewName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + 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", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -264,15 +258,16 @@ 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 -// viewName - View name -// options - ViewsClientGetOptions contains the optional parameters for the ViewsClient.Get method. +// +// Generated from API version 2023-04-01-preview +// - 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) { req, err := client.getCreateRequest(ctx, viewName, options) if err != nil { return ViewsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ViewsClientGetResponse{}, err } @@ -289,12 +284,12 @@ func (client *ViewsClient) getCreateRequest(ctx context.Context, viewName string return nil, errors.New("parameter viewName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -311,28 +306,29 @@ 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 -// scope - The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, -// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup -// scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' -// for -// Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile -// scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection -// scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for -// Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External -// Billing Account scope and -// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. -// viewName - View name -// options - ViewsClientGetByScopeOptions contains the optional parameters for the ViewsClient.GetByScope method. +// +// Generated from API version 2023-04-01-preview +// - scope - The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, +// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup +// scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' +// for +// Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' +// for EnrollmentAccount scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection +// scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for +// Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External +// Billing Account scope and +// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. +// - viewName - View name +// - options - ViewsClientGetByScopeOptions contains the optional parameters for the ViewsClient.GetByScope method. func (client *ViewsClient) GetByScope(ctx context.Context, scope string, viewName string, options *ViewsClientGetByScopeOptions) (ViewsClientGetByScopeResponse, error) { req, err := client.getByScopeCreateRequest(ctx, scope, viewName, options) if err != nil { return ViewsClientGetByScopeResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ViewsClientGetByScopeResponse{}, err } @@ -353,12 +349,12 @@ func (client *ViewsClient) getByScopeCreateRequest(ctx context.Context, scope st return nil, errors.New("parameter viewName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -374,9 +370,9 @@ func (client *ViewsClient) getByScopeHandleResponse(resp *http.Response) (ViewsC } // NewListPager - Lists all views by tenant and object. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// options - ViewsClientListOptions contains the optional parameters for the ViewsClient.List method. +// +// Generated from API version 2023-04-01-preview +// - 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]{ More: func(page ViewsClientListResponse) bool { @@ -393,7 +389,7 @@ func (client *ViewsClient) NewListPager(options *ViewsClientListOptions) *runtim if err != nil { return ViewsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ViewsClientListResponse{}, err } @@ -408,12 +404,12 @@ func (client *ViewsClient) NewListPager(options *ViewsClientListOptions) *runtim // listCreateRequest creates the List request. func (client *ViewsClient) listCreateRequest(ctx context.Context, options *ViewsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.CostManagement/views" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -429,22 +425,22 @@ func (client *ViewsClient) listHandleResponse(resp *http.Response) (ViewsClientL } // NewListByScopePager - Lists all views at the given scope. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// scope - The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, -// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup -// scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' -// for -// Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile -// scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection -// scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for -// Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External -// Billing Account scope and -// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. -// options - ViewsClientListByScopeOptions contains the optional parameters for the ViewsClient.ListByScope method. +// +// Generated from API version 2023-04-01-preview +// - scope - The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, +// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup +// scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' +// for +// Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' +// for EnrollmentAccount scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection +// scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for +// Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External +// Billing Account scope and +// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. +// - options - ViewsClientListByScopeOptions contains the optional parameters for the ViewsClient.NewListByScopePager method. func (client *ViewsClient) NewListByScopePager(scope string, options *ViewsClientListByScopeOptions) *runtime.Pager[ViewsClientListByScopeResponse] { return runtime.NewPager(runtime.PagingHandler[ViewsClientListByScopeResponse]{ More: func(page ViewsClientListByScopeResponse) bool { @@ -461,7 +457,7 @@ func (client *ViewsClient) NewListByScopePager(scope string, options *ViewsClien if err != nil { return ViewsClientListByScopeResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ViewsClientListByScopeResponse{}, err } @@ -480,12 +476,12 @@ func (client *ViewsClient) listByScopeCreateRequest(ctx context.Context, scope s 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.host, urlPath)) + 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", "2021-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_alerts_client_test.go b/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_alerts_client_test.go deleted file mode 100644 index 92055388efb4..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_alerts_client_test.go +++ /dev/null @@ -1,110 +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. - -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/tree/main/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingAccountAlerts.json -func ExampleAlertsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcostmanagement.NewAlertsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - "providers/Microsoft.Billing/billingAccounts/12345:6789", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/SingleResourceGroupAlert.json -func ExampleAlertsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcostmanagement.NewAlertsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/DismissResourceGroupAlerts.json -func ExampleAlertsClient_Dismiss() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcostmanagement.NewAlertsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalBillingAccountAlerts.json -func ExampleAlertsClient_ListExternal() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcostmanagement.NewAlertsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListExternal(ctx, - armcostmanagement.ExternalCloudProviderTypeExternalBillingAccounts, - "100", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_dimensions_client_test.go b/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_dimensions_client_test.go deleted file mode 100644 index 6cd634d0f3b2..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_dimensions_client_test.go +++ /dev/null @@ -1,76 +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. - -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/tree/main/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingAccountDimensionsList.json -func ExampleDimensionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcostmanagement.NewDimensionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("providers/Microsoft.Billing/billingAccounts/100", - &armcostmanagement.DimensionsClientListOptions{Filter: nil, - Expand: nil, - Skiptoken: nil, - Top: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalBillingAccountsDimensions.json -func ExampleDimensionsClient_NewByExternalCloudProviderTypePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcostmanagement.NewDimensionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewByExternalCloudProviderTypePager(armcostmanagement.ExternalCloudProviderTypeExternalBillingAccounts, - "100", - &armcostmanagement.DimensionsClientByExternalCloudProviderTypeOptions{Filter: nil, - Expand: nil, - Skiptoken: nil, - Top: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_exports_client_test.go b/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_exports_client_test.go deleted file mode 100644 index 7d71bd5cc537..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_exports_client_test.go +++ /dev/null @@ -1,182 +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. - -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/tree/main/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportsGetByBillingAccount.json -func ExampleExportsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcostmanagement.NewExportsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - "providers/Microsoft.Billing/billingAccounts/123456", - &armcostmanagement.ExportsClientListOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportGetByBillingAccount.json -func ExampleExportsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcostmanagement.NewExportsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "providers/Microsoft.Billing/billingAccounts/123456", - "TestExport", - &armcostmanagement.ExportsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportCreateOrUpdateByBillingAccount.json -func ExampleExportsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcostmanagement.NewExportsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportDeleteByBillingAccount.json -func ExampleExportsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcostmanagement.NewExportsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.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/tree/main/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunByBillingAccount.json -func ExampleExportsClient_Execute() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcostmanagement.NewExportsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.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/tree/main/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExportRunHistoryGetByBillingAccount.json -func ExampleExportsClient_GetExecutionHistory() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcostmanagement.NewExportsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetExecutionHistory(ctx, - "providers/Microsoft.Billing/billingAccounts/123456", - "TestExport", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_forecast_client_test.go b/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_forecast_client_test.go deleted file mode 100644 index c724a4e47ebc..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_forecast_client_test.go +++ /dev/null @@ -1,141 +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. - -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/tree/main/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingAccountForecast.json -func ExampleForecastClient_Usage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcostmanagement.NewForecastClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalBillingAccountForecast.json -func ExampleForecastClient_ExternalCloudProviderUsage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcostmanagement.NewForecastClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_generatedetailedcostreport_client_test.go b/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_generatedetailedcostreport_client_test.go deleted file mode 100644 index 63e6ca56c39b..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_generatedetailedcostreport_client_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. - -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/tree/main/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/GenerateDetailedCostReportByBillingAccountLegacyAndBillingPeriod.json -func ExampleGenerateDetailedCostReportClient_BeginCreateOperation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcostmanagement.NewGenerateDetailedCostReportClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_generatedetailedcostreportoperationresults_client_test.go b/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_generatedetailedcostreportoperationresults_client_test.go deleted file mode 100644 index d1a694dc4e16..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_generatedetailedcostreportoperationresults_client_test.go +++ /dev/null @@ -1,39 +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. - -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/tree/main/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() - client, err := armcostmanagement.NewGenerateDetailedCostReportOperationResultsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_generatedetailedcostreportoperationstatus_client_test.go b/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_generatedetailedcostreportoperationstatus_client_test.go deleted file mode 100644 index d44468312399..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_generatedetailedcostreportoperationstatus_client_test.go +++ /dev/null @@ -1,39 +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. - -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/tree/main/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() - client, err := armcostmanagement.NewGenerateDetailedCostReportOperationStatusClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_generatereservationdetailsreport_client_test.go b/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_generatereservationdetailsreport_client_test.go deleted file mode 100644 index f77b0ff8d03b..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_generatereservationdetailsreport_client_test.go +++ /dev/null @@ -1,9 +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. - -package armcostmanagement_test diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_operations_client_test.go deleted file mode 100644 index 6c79f13be4ba..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_operations_client_test.go +++ /dev/null @@ -1,41 +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. - -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/tree/main/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() - client, err := armcostmanagement.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_query_client_test.go b/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_query_client_test.go deleted file mode 100644 index 87bad79d9da3..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_query_client_test.go +++ /dev/null @@ -1,139 +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. - -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/tree/main/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingAccountQuery.json -func ExampleQueryClient_Usage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcostmanagement.NewQueryClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalBillingAccountsQuery.json -func ExampleQueryClient_UsageByExternalCloudProviderType() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcostmanagement.NewQueryClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_views_client_test.go b/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_views_client_test.go deleted file mode 100644 index 81dbb2a60921..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_views_client_test.go +++ /dev/null @@ -1,294 +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. - -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/tree/main/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() - client, err := armcostmanagement.NewViewsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armcostmanagement.NewViewsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByScopePager("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armcostmanagement.NewViewsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "swaggerExample", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armcostmanagement.NewViewsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armcostmanagement.NewViewsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.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/tree/main/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() - client, err := armcostmanagement.NewViewsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetByScope(ctx, - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", - "swaggerExample", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armcostmanagement.NewViewsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armcostmanagement.NewViewsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.DeleteByScope(ctx, - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", - "TestView", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_constants.go b/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_constants.go deleted file mode 100644 index 0ddb618dc87d..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_constants.go +++ /dev/null @@ -1,722 +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. - -package armcostmanagement - -const ( - moduleName = "armcostmanagement" - moduleVersion = "v1.0.0" -) - -// AccumulatedType - Show costs accumulated over time. -type AccumulatedType string - -const ( - AccumulatedTypeFalse AccumulatedType = "false" - AccumulatedTypeTrue AccumulatedType = "true" -) - -// PossibleAccumulatedTypeValues returns the possible values for the AccumulatedType const type. -func PossibleAccumulatedTypeValues() []AccumulatedType { - return []AccumulatedType{ - AccumulatedTypeFalse, - AccumulatedTypeTrue, - } -} - -// AlertCategory - Alert category -type AlertCategory string - -const ( - AlertCategoryBilling AlertCategory = "Billing" - AlertCategoryCost AlertCategory = "Cost" - AlertCategorySystem AlertCategory = "System" - AlertCategoryUsage AlertCategory = "Usage" -) - -// PossibleAlertCategoryValues returns the possible values for the AlertCategory const type. -func PossibleAlertCategoryValues() []AlertCategory { - return []AlertCategory{ - AlertCategoryBilling, - AlertCategoryCost, - AlertCategorySystem, - AlertCategoryUsage, - } -} - -// AlertCriteria - Criteria that triggered alert -type AlertCriteria string - -const ( - AlertCriteriaCostThresholdExceeded AlertCriteria = "CostThresholdExceeded" - AlertCriteriaCreditThresholdApproaching AlertCriteria = "CreditThresholdApproaching" - AlertCriteriaCreditThresholdReached AlertCriteria = "CreditThresholdReached" - AlertCriteriaCrossCloudCollectionError AlertCriteria = "CrossCloudCollectionError" - AlertCriteriaCrossCloudNewDataAvailable AlertCriteria = "CrossCloudNewDataAvailable" - AlertCriteriaForecastCostThresholdExceeded AlertCriteria = "ForecastCostThresholdExceeded" - AlertCriteriaForecastUsageThresholdExceeded AlertCriteria = "ForecastUsageThresholdExceeded" - AlertCriteriaGeneralThresholdError AlertCriteria = "GeneralThresholdError" - AlertCriteriaInvoiceDueDateApproaching AlertCriteria = "InvoiceDueDateApproaching" - AlertCriteriaInvoiceDueDateReached AlertCriteria = "InvoiceDueDateReached" - AlertCriteriaMultiCurrency AlertCriteria = "MultiCurrency" - AlertCriteriaQuotaThresholdApproaching AlertCriteria = "QuotaThresholdApproaching" - AlertCriteriaQuotaThresholdReached AlertCriteria = "QuotaThresholdReached" - AlertCriteriaUsageThresholdExceeded AlertCriteria = "UsageThresholdExceeded" -) - -// PossibleAlertCriteriaValues returns the possible values for the AlertCriteria const type. -func PossibleAlertCriteriaValues() []AlertCriteria { - return []AlertCriteria{ - AlertCriteriaCostThresholdExceeded, - AlertCriteriaCreditThresholdApproaching, - AlertCriteriaCreditThresholdReached, - AlertCriteriaCrossCloudCollectionError, - AlertCriteriaCrossCloudNewDataAvailable, - AlertCriteriaForecastCostThresholdExceeded, - AlertCriteriaForecastUsageThresholdExceeded, - AlertCriteriaGeneralThresholdError, - AlertCriteriaInvoiceDueDateApproaching, - AlertCriteriaInvoiceDueDateReached, - AlertCriteriaMultiCurrency, - AlertCriteriaQuotaThresholdApproaching, - AlertCriteriaQuotaThresholdReached, - AlertCriteriaUsageThresholdExceeded, - } -} - -// AlertOperator - operator used to compare currentSpend with amount -type AlertOperator string - -const ( - AlertOperatorEqualTo AlertOperator = "EqualTo" - AlertOperatorGreaterThan AlertOperator = "GreaterThan" - AlertOperatorGreaterThanOrEqualTo AlertOperator = "GreaterThanOrEqualTo" - AlertOperatorLessThan AlertOperator = "LessThan" - AlertOperatorLessThanOrEqualTo AlertOperator = "LessThanOrEqualTo" - AlertOperatorNone AlertOperator = "None" -) - -// PossibleAlertOperatorValues returns the possible values for the AlertOperator const type. -func PossibleAlertOperatorValues() []AlertOperator { - return []AlertOperator{ - AlertOperatorEqualTo, - AlertOperatorGreaterThan, - AlertOperatorGreaterThanOrEqualTo, - AlertOperatorLessThan, - AlertOperatorLessThanOrEqualTo, - AlertOperatorNone, - } -} - -// AlertSource - Source of alert -type AlertSource string - -const ( - AlertSourcePreset AlertSource = "Preset" - AlertSourceUser AlertSource = "User" -) - -// PossibleAlertSourceValues returns the possible values for the AlertSource const type. -func PossibleAlertSourceValues() []AlertSource { - return []AlertSource{ - AlertSourcePreset, - AlertSourceUser, - } -} - -// AlertStatus - alert status -type AlertStatus string - -const ( - AlertStatusActive AlertStatus = "Active" - AlertStatusDismissed AlertStatus = "Dismissed" - AlertStatusNone AlertStatus = "None" - AlertStatusOverridden AlertStatus = "Overridden" - AlertStatusResolved AlertStatus = "Resolved" -) - -// PossibleAlertStatusValues returns the possible values for the AlertStatus const type. -func PossibleAlertStatusValues() []AlertStatus { - return []AlertStatus{ - AlertStatusActive, - AlertStatusDismissed, - AlertStatusNone, - AlertStatusOverridden, - AlertStatusResolved, - } -} - -// AlertTimeGrainType - Type of timegrain cadence -type AlertTimeGrainType string - -const ( - AlertTimeGrainTypeAnnually AlertTimeGrainType = "Annually" - AlertTimeGrainTypeBillingAnnual AlertTimeGrainType = "BillingAnnual" - AlertTimeGrainTypeBillingMonth AlertTimeGrainType = "BillingMonth" - AlertTimeGrainTypeBillingQuarter AlertTimeGrainType = "BillingQuarter" - AlertTimeGrainTypeMonthly AlertTimeGrainType = "Monthly" - AlertTimeGrainTypeNone AlertTimeGrainType = "None" - AlertTimeGrainTypeQuarterly AlertTimeGrainType = "Quarterly" -) - -// PossibleAlertTimeGrainTypeValues returns the possible values for the AlertTimeGrainType const type. -func PossibleAlertTimeGrainTypeValues() []AlertTimeGrainType { - return []AlertTimeGrainType{ - AlertTimeGrainTypeAnnually, - AlertTimeGrainTypeBillingAnnual, - AlertTimeGrainTypeBillingMonth, - AlertTimeGrainTypeBillingQuarter, - AlertTimeGrainTypeMonthly, - AlertTimeGrainTypeNone, - AlertTimeGrainTypeQuarterly, - } -} - -// AlertType - type of alert -type AlertType string - -const ( - AlertTypeBudget AlertType = "Budget" - AlertTypeBudgetForecast AlertType = "BudgetForecast" - AlertTypeCredit AlertType = "Credit" - AlertTypeGeneral AlertType = "General" - AlertTypeInvoice AlertType = "Invoice" - AlertTypeQuota AlertType = "Quota" - AlertTypeXCloud AlertType = "xCloud" -) - -// PossibleAlertTypeValues returns the possible values for the AlertType const type. -func PossibleAlertTypeValues() []AlertType { - return []AlertType{ - AlertTypeBudget, - AlertTypeBudgetForecast, - AlertTypeCredit, - AlertTypeGeneral, - AlertTypeInvoice, - AlertTypeQuota, - AlertTypeXCloud, - } -} - -// ChartType - Chart type of the main view in Cost Analysis. Required. -type ChartType string - -const ( - ChartTypeArea ChartType = "Area" - ChartTypeGroupedColumn ChartType = "GroupedColumn" - ChartTypeLine ChartType = "Line" - ChartTypeStackedColumn ChartType = "StackedColumn" - ChartTypeTable ChartType = "Table" -) - -// PossibleChartTypeValues returns the possible values for the ChartType const type. -func PossibleChartTypeValues() []ChartType { - return []ChartType{ - ChartTypeArea, - ChartTypeGroupedColumn, - ChartTypeLine, - ChartTypeStackedColumn, - ChartTypeTable, - } -} - -// ExecutionStatus - The last known status of the export execution. -type ExecutionStatus string - -const ( - ExecutionStatusCompleted ExecutionStatus = "Completed" - ExecutionStatusDataNotAvailable ExecutionStatus = "DataNotAvailable" - ExecutionStatusFailed ExecutionStatus = "Failed" - ExecutionStatusInProgress ExecutionStatus = "InProgress" - ExecutionStatusNewDataNotAvailable ExecutionStatus = "NewDataNotAvailable" - ExecutionStatusQueued ExecutionStatus = "Queued" - ExecutionStatusTimeout ExecutionStatus = "Timeout" -) - -// PossibleExecutionStatusValues returns the possible values for the ExecutionStatus const type. -func PossibleExecutionStatusValues() []ExecutionStatus { - return []ExecutionStatus{ - ExecutionStatusCompleted, - ExecutionStatusDataNotAvailable, - ExecutionStatusFailed, - ExecutionStatusInProgress, - ExecutionStatusNewDataNotAvailable, - ExecutionStatusQueued, - ExecutionStatusTimeout, - } -} - -// ExecutionType - The type of the export execution. -type ExecutionType string - -const ( - ExecutionTypeOnDemand ExecutionType = "OnDemand" - ExecutionTypeScheduled ExecutionType = "Scheduled" -) - -// PossibleExecutionTypeValues returns the possible values for the ExecutionType const type. -func PossibleExecutionTypeValues() []ExecutionType { - return []ExecutionType{ - ExecutionTypeOnDemand, - ExecutionTypeScheduled, - } -} - -// ExportType - The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that -// do not yet provide data for charges or amortization for service reservations. -type ExportType string - -const ( - ExportTypeActualCost ExportType = "ActualCost" - ExportTypeAmortizedCost ExportType = "AmortizedCost" - ExportTypeUsage ExportType = "Usage" -) - -// PossibleExportTypeValues returns the possible values for the ExportType const type. -func PossibleExportTypeValues() []ExportType { - return []ExportType{ - ExportTypeActualCost, - ExportTypeAmortizedCost, - ExportTypeUsage, - } -} - -type ExternalCloudProviderType string - -const ( - ExternalCloudProviderTypeExternalBillingAccounts ExternalCloudProviderType = "externalBillingAccounts" - ExternalCloudProviderTypeExternalSubscriptions ExternalCloudProviderType = "externalSubscriptions" -) - -// PossibleExternalCloudProviderTypeValues returns the possible values for the ExternalCloudProviderType const type. -func PossibleExternalCloudProviderTypeValues() []ExternalCloudProviderType { - return []ExternalCloudProviderType{ - ExternalCloudProviderTypeExternalBillingAccounts, - ExternalCloudProviderTypeExternalSubscriptions, - } -} - -// ForecastTimeframeType - The time frame for pulling data for the forecast. If custom, then a specific time period must be -// provided. -type ForecastTimeframeType string - -const ( - ForecastTimeframeTypeBillingMonthToDate ForecastTimeframeType = "BillingMonthToDate" - ForecastTimeframeTypeCustom ForecastTimeframeType = "Custom" - ForecastTimeframeTypeMonthToDate ForecastTimeframeType = "MonthToDate" - ForecastTimeframeTypeTheLastBillingMonth ForecastTimeframeType = "TheLastBillingMonth" - ForecastTimeframeTypeTheLastMonth ForecastTimeframeType = "TheLastMonth" - ForecastTimeframeTypeWeekToDate ForecastTimeframeType = "WeekToDate" -) - -// PossibleForecastTimeframeTypeValues returns the possible values for the ForecastTimeframeType const type. -func PossibleForecastTimeframeTypeValues() []ForecastTimeframeType { - return []ForecastTimeframeType{ - ForecastTimeframeTypeBillingMonthToDate, - ForecastTimeframeTypeCustom, - ForecastTimeframeTypeMonthToDate, - ForecastTimeframeTypeTheLastBillingMonth, - ForecastTimeframeTypeTheLastMonth, - ForecastTimeframeTypeWeekToDate, - } -} - -// ForecastType - The type of the forecast. -type ForecastType string - -const ( - ForecastTypeActualCost ForecastType = "ActualCost" - ForecastTypeAmortizedCost ForecastType = "AmortizedCost" - ForecastTypeUsage ForecastType = "Usage" -) - -// PossibleForecastTypeValues returns the possible values for the ForecastType const type. -func PossibleForecastTypeValues() []ForecastType { - return []ForecastType{ - ForecastTypeActualCost, - ForecastTypeAmortizedCost, - ForecastTypeUsage, - } -} - -// FormatType - The format of the export being delivered. Currently only 'Csv' is supported. -type FormatType string - -const ( - FormatTypeCSV FormatType = "Csv" -) - -// PossibleFormatTypeValues returns the possible values for the FormatType const type. -func PossibleFormatTypeValues() []FormatType { - return []FormatType{ - FormatTypeCSV, - } -} - -// FunctionType - The name of the aggregation function to use. -type FunctionType string - -const ( - FunctionTypeSum FunctionType = "Sum" -) - -// PossibleFunctionTypeValues returns the possible values for the FunctionType const type. -func PossibleFunctionTypeValues() []FunctionType { - return []FunctionType{ - FunctionTypeSum, - } -} - -// GenerateDetailedCostReportMetricType - The type of the detailed report. By default ActualCost is provided -type GenerateDetailedCostReportMetricType string - -const ( - GenerateDetailedCostReportMetricTypeActualCost GenerateDetailedCostReportMetricType = "ActualCost" - GenerateDetailedCostReportMetricTypeAmortizedCost GenerateDetailedCostReportMetricType = "AmortizedCost" -) - -// PossibleGenerateDetailedCostReportMetricTypeValues returns the possible values for the GenerateDetailedCostReportMetricType const type. -func PossibleGenerateDetailedCostReportMetricTypeValues() []GenerateDetailedCostReportMetricType { - return []GenerateDetailedCostReportMetricType{ - GenerateDetailedCostReportMetricTypeActualCost, - GenerateDetailedCostReportMetricTypeAmortizedCost, - } -} - -// GranularityType - The granularity of rows in the export. Currently only 'Daily' is supported. -type GranularityType string - -const ( - GranularityTypeDaily GranularityType = "Daily" -) - -// PossibleGranularityTypeValues returns the possible values for the GranularityType const type. -func PossibleGranularityTypeValues() []GranularityType { - return []GranularityType{ - GranularityTypeDaily, - } -} - -// KpiType - KPI type (Forecast, Budget). -type KpiType string - -const ( - KpiTypeBudget KpiType = "Budget" - KpiTypeForecast KpiType = "Forecast" -) - -// PossibleKpiTypeValues returns the possible values for the KpiType const type. -func PossibleKpiTypeValues() []KpiType { - return []KpiType{ - KpiTypeBudget, - KpiTypeForecast, - } -} - -// MetricType - Metric to use when displaying costs. -type MetricType string - -const ( - MetricTypeAHUB MetricType = "AHUB" - MetricTypeActualCost MetricType = "ActualCost" - MetricTypeAmortizedCost MetricType = "AmortizedCost" -) - -// PossibleMetricTypeValues returns the possible values for the MetricType const type. -func PossibleMetricTypeValues() []MetricType { - return []MetricType{ - MetricTypeAHUB, - MetricTypeActualCost, - MetricTypeAmortizedCost, - } -} - -// OperationStatusType - The status of the long running operation. -type OperationStatusType string - -const ( - OperationStatusTypeCompleted OperationStatusType = "Completed" - OperationStatusTypeFailed OperationStatusType = "Failed" - OperationStatusTypeRunning OperationStatusType = "Running" -) - -// PossibleOperationStatusTypeValues returns the possible values for the OperationStatusType const type. -func PossibleOperationStatusTypeValues() []OperationStatusType { - return []OperationStatusType{ - OperationStatusTypeCompleted, - OperationStatusTypeFailed, - OperationStatusTypeRunning, - } -} - -// OperatorType - The operator to use for comparison. -type OperatorType string - -const ( - OperatorTypeContains OperatorType = "Contains" - OperatorTypeIn OperatorType = "In" -) - -// PossibleOperatorTypeValues returns the possible values for the OperatorType const type. -func PossibleOperatorTypeValues() []OperatorType { - return []OperatorType{ - OperatorTypeContains, - OperatorTypeIn, - } -} - -// PivotType - Data type to show in view. -type PivotType string - -const ( - PivotTypeDimension PivotType = "Dimension" - PivotTypeTagKey PivotType = "TagKey" -) - -// PossiblePivotTypeValues returns the possible values for the PivotType const type. -func PossiblePivotTypeValues() []PivotType { - return []PivotType{ - PivotTypeDimension, - PivotTypeTagKey, - } -} - -// QueryColumnType - The type of the column in the export. -type QueryColumnType string - -const ( - QueryColumnTypeDimension QueryColumnType = "Dimension" - QueryColumnTypeTag QueryColumnType = "Tag" -) - -// PossibleQueryColumnTypeValues returns the possible values for the QueryColumnType const type. -func PossibleQueryColumnTypeValues() []QueryColumnType { - return []QueryColumnType{ - QueryColumnTypeDimension, - QueryColumnTypeTag, - } -} - -// QueryOperatorType - The operator to use for comparison. -type QueryOperatorType string - -const ( - QueryOperatorTypeIn QueryOperatorType = "In" -) - -// PossibleQueryOperatorTypeValues returns the possible values for the QueryOperatorType const type. -func PossibleQueryOperatorTypeValues() []QueryOperatorType { - return []QueryOperatorType{ - QueryOperatorTypeIn, - } -} - -// RecurrenceType - The schedule recurrence. -type RecurrenceType string - -const ( - RecurrenceTypeAnnually RecurrenceType = "Annually" - RecurrenceTypeDaily RecurrenceType = "Daily" - RecurrenceTypeMonthly RecurrenceType = "Monthly" - RecurrenceTypeWeekly RecurrenceType = "Weekly" -) - -// PossibleRecurrenceTypeValues returns the possible values for the RecurrenceType const type. -func PossibleRecurrenceTypeValues() []RecurrenceType { - return []RecurrenceType{ - RecurrenceTypeAnnually, - RecurrenceTypeDaily, - RecurrenceTypeMonthly, - RecurrenceTypeWeekly, - } -} - -// 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 - -const ( - ReportConfigSortingTypeAscending ReportConfigSortingType = "Ascending" - ReportConfigSortingTypeDescending ReportConfigSortingType = "Descending" -) - -// PossibleReportConfigSortingTypeValues returns the possible values for the ReportConfigSortingType const type. -func PossibleReportConfigSortingTypeValues() []ReportConfigSortingType { - return []ReportConfigSortingType{ - ReportConfigSortingTypeAscending, - ReportConfigSortingTypeDescending, - } -} - -// ReportGranularityType - The granularity of rows in the report. -type ReportGranularityType string - -const ( - ReportGranularityTypeDaily ReportGranularityType = "Daily" - ReportGranularityTypeMonthly ReportGranularityType = "Monthly" -) - -// PossibleReportGranularityTypeValues returns the possible values for the ReportGranularityType const type. -func PossibleReportGranularityTypeValues() []ReportGranularityType { - return []ReportGranularityType{ - ReportGranularityTypeDaily, - ReportGranularityTypeMonthly, - } -} - -// ReportOperationStatusType - The status of the long running operation. -type ReportOperationStatusType string - -const ( - ReportOperationStatusTypeCompleted ReportOperationStatusType = "Completed" - ReportOperationStatusTypeFailed ReportOperationStatusType = "Failed" - ReportOperationStatusTypeInProgress ReportOperationStatusType = "InProgress" - ReportOperationStatusTypeNoDataFound ReportOperationStatusType = "NoDataFound" - ReportOperationStatusTypeQueued ReportOperationStatusType = "Queued" - ReportOperationStatusTypeReadyToDownload ReportOperationStatusType = "ReadyToDownload" - ReportOperationStatusTypeTimedOut ReportOperationStatusType = "TimedOut" -) - -// PossibleReportOperationStatusTypeValues returns the possible values for the ReportOperationStatusType const type. -func PossibleReportOperationStatusTypeValues() []ReportOperationStatusType { - return []ReportOperationStatusType{ - ReportOperationStatusTypeCompleted, - ReportOperationStatusTypeFailed, - ReportOperationStatusTypeInProgress, - ReportOperationStatusTypeNoDataFound, - ReportOperationStatusTypeQueued, - ReportOperationStatusTypeReadyToDownload, - ReportOperationStatusTypeTimedOut, - } -} - -// ReportTimeframeType - The time frame for pulling data for the report. If custom, then a specific time period must be provided. -type ReportTimeframeType string - -const ( - ReportTimeframeTypeCustom ReportTimeframeType = "Custom" - ReportTimeframeTypeMonthToDate ReportTimeframeType = "MonthToDate" - ReportTimeframeTypeWeekToDate ReportTimeframeType = "WeekToDate" - ReportTimeframeTypeYearToDate ReportTimeframeType = "YearToDate" -) - -// PossibleReportTimeframeTypeValues returns the possible values for the ReportTimeframeType const type. -func PossibleReportTimeframeTypeValues() []ReportTimeframeType { - return []ReportTimeframeType{ - ReportTimeframeTypeCustom, - ReportTimeframeTypeMonthToDate, - ReportTimeframeTypeWeekToDate, - ReportTimeframeTypeYearToDate, - } -} - -// ReportType - The type of the report. Usage represents actual usage, forecast represents forecasted data and UsageAndForecast -// represents both usage and forecasted data. Actual usage and forecasted data can be -// differentiated based on dates. -type ReportType string - -const ( - ReportTypeUsage ReportType = "Usage" -) - -// PossibleReportTypeValues returns the possible values for the ReportType const type. -func PossibleReportTypeValues() []ReportType { - return []ReportType{ - ReportTypeUsage, - } -} - -// ReservationReportSchema - The CSV file from the reportUrl blob link consists of reservation usage data with the following -// schema at daily granularity -type ReservationReportSchema string - -const ( - ReservationReportSchemaInstanceFlexibilityGroup ReservationReportSchema = "InstanceFlexibilityGroup" - ReservationReportSchemaInstanceFlexibilityRatio ReservationReportSchema = "InstanceFlexibilityRatio" - ReservationReportSchemaInstanceID ReservationReportSchema = "InstanceId" - ReservationReportSchemaKind ReservationReportSchema = "Kind" - ReservationReportSchemaReservationID ReservationReportSchema = "ReservationId" - ReservationReportSchemaReservationOrderID ReservationReportSchema = "ReservationOrderId" - ReservationReportSchemaReservedHours ReservationReportSchema = "ReservedHours" - ReservationReportSchemaSKUName ReservationReportSchema = "SkuName" - ReservationReportSchemaTotalReservedQuantity ReservationReportSchema = "TotalReservedQuantity" - ReservationReportSchemaUsageDate ReservationReportSchema = "UsageDate" - ReservationReportSchemaUsedHours ReservationReportSchema = "UsedHours" -) - -// PossibleReservationReportSchemaValues returns the possible values for the ReservationReportSchema const type. -func PossibleReservationReportSchemaValues() []ReservationReportSchema { - return []ReservationReportSchema{ - ReservationReportSchemaInstanceFlexibilityGroup, - ReservationReportSchemaInstanceFlexibilityRatio, - ReservationReportSchemaInstanceID, - ReservationReportSchemaKind, - ReservationReportSchemaReservationID, - ReservationReportSchemaReservationOrderID, - ReservationReportSchemaReservedHours, - ReservationReportSchemaSKUName, - ReservationReportSchemaTotalReservedQuantity, - ReservationReportSchemaUsageDate, - ReservationReportSchemaUsedHours, - } -} - -// StatusType - The status of the export's schedule. If 'Inactive', the export's schedule is paused. -type StatusType string - -const ( - StatusTypeActive StatusType = "Active" - StatusTypeInactive StatusType = "Inactive" -) - -// PossibleStatusTypeValues returns the possible values for the StatusType const type. -func PossibleStatusTypeValues() []StatusType { - return []StatusType{ - StatusTypeActive, - StatusTypeInactive, - } -} - -// TimeframeType - The time frame for pulling data for the export. If custom, then a specific time period must be provided. -type TimeframeType string - -const ( - TimeframeTypeBillingMonthToDate TimeframeType = "BillingMonthToDate" - TimeframeTypeCustom TimeframeType = "Custom" - TimeframeTypeMonthToDate TimeframeType = "MonthToDate" - TimeframeTypeTheLastBillingMonth TimeframeType = "TheLastBillingMonth" - TimeframeTypeTheLastMonth TimeframeType = "TheLastMonth" - TimeframeTypeWeekToDate TimeframeType = "WeekToDate" -) - -// PossibleTimeframeTypeValues returns the possible values for the TimeframeType const type. -func PossibleTimeframeTypeValues() []TimeframeType { - return []TimeframeType{ - TimeframeTypeBillingMonthToDate, - TimeframeTypeCustom, - TimeframeTypeMonthToDate, - TimeframeTypeTheLastBillingMonth, - TimeframeTypeTheLastMonth, - TimeframeTypeWeekToDate, - } -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreportoperationresults_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreportoperationresults_client.go deleted file mode 100644 index 3a2fbfb7216f..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreportoperationresults_client.go +++ /dev/null @@ -1,113 +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. - -package armcostmanagement - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "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" -) - -// GenerateDetailedCostReportOperationResultsClient contains the methods for the GenerateDetailedCostReportOperationResults group. -// Don't use this type directly, use NewGenerateDetailedCostReportOperationResultsClient() instead. -type GenerateDetailedCostReportOperationResultsClient struct { - host string - pl runtime.Pipeline -} - -// NewGenerateDetailedCostReportOperationResultsClient creates a new instance of GenerateDetailedCostReportOperationResultsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewGenerateDetailedCostReportOperationResultsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GenerateDetailedCostReportOperationResultsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &GenerateDetailedCostReportOperationResultsClient{ - host: ep, - pl: pl, - } - return client, nil -} - -// Get - Get the result of the specified operation. This link is provided in the GenerateDetailedCostReport creation request -// response header. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// operationID - The target operation Id. -// scope - The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for -// Billing Account scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount -// scope. Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for billingAccount -// scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile -// scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// options - GenerateDetailedCostReportOperationResultsClientGetOptions contains the optional parameters for the GenerateDetailedCostReportOperationResultsClient.Get -// method. -func (client *GenerateDetailedCostReportOperationResultsClient) Get(ctx context.Context, operationID string, scope string, options *GenerateDetailedCostReportOperationResultsClientGetOptions) (GenerateDetailedCostReportOperationResultsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, operationID, scope, options) - if err != nil { - return GenerateDetailedCostReportOperationResultsClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return GenerateDetailedCostReportOperationResultsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return GenerateDetailedCostReportOperationResultsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *GenerateDetailedCostReportOperationResultsClient) getCreateRequest(ctx context.Context, operationID string, scope string, options *GenerateDetailedCostReportOperationResultsClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.CostManagement/operationResults/{operationId}" - if operationID == "" { - return nil, errors.New("parameter operationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-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/zz_generated_models.go b/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_models.go deleted file mode 100644 index 9ba5a9006989..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_models.go +++ /dev/null @@ -1,1262 +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. - -package armcostmanagement - -import "time" - -// Alert - An individual alert. -type Alert struct { - // eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating - // the latest version or not. - ETag *string `json:"eTag,omitempty"` - - // Alert properties. - Properties *AlertProperties `json:"properties,omitempty"` - - // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// AlertProperties - Alert properties. -type AlertProperties struct { - // dateTime in which alert was closed - CloseTime *string `json:"closeTime,omitempty"` - - // related budget - CostEntityID *string `json:"costEntityId,omitempty"` - - // dateTime in which alert was created - CreationTime *string `json:"creationTime,omitempty"` - - // defines the type of alert - Definition *AlertPropertiesDefinition `json:"definition,omitempty"` - - // Alert description - Description *string `json:"description,omitempty"` - - // Alert details - Details *AlertPropertiesDetails `json:"details,omitempty"` - - // dateTime in which alert was last modified - ModificationTime *string `json:"modificationTime,omitempty"` - - // Source of alert - Source *AlertSource `json:"source,omitempty"` - - // alert status - Status *AlertStatus `json:"status,omitempty"` - - // dateTime in which the alert status was last modified - StatusModificationTime *string `json:"statusModificationTime,omitempty"` - - // User who last modified the alert - StatusModificationUserName *string `json:"statusModificationUserName,omitempty"` -} - -// AlertPropertiesDefinition - defines the type of alert -type AlertPropertiesDefinition struct { - // Alert category - Category *AlertCategory `json:"category,omitempty"` - - // Criteria that triggered alert - Criteria *AlertCriteria `json:"criteria,omitempty"` - - // type of alert - Type *AlertType `json:"type,omitempty"` -} - -// AlertPropertiesDetails - Alert details -type AlertPropertiesDetails struct { - // budget threshold amount - Amount *float64 `json:"amount,omitempty"` - - // company name - CompanyName *string `json:"companyName,omitempty"` - - // list of emails to contact - ContactEmails []*string `json:"contactEmails,omitempty"` - - // list of action groups to broadcast to - ContactGroups []*string `json:"contactGroups,omitempty"` - - // list of contact roles - ContactRoles []*string `json:"contactRoles,omitempty"` - - // current spend - CurrentSpend *float64 `json:"currentSpend,omitempty"` - - // department name - DepartmentName *string `json:"departmentName,omitempty"` - - // datetime of enrollmentEndDate - EnrollmentEndDate *string `json:"enrollmentEndDate,omitempty"` - - // enrollment number - EnrollmentNumber *string `json:"enrollmentNumber,omitempty"` - - // datetime of enrollmentStartDate - EnrollmentStartDate *string `json:"enrollmentStartDate,omitempty"` - - // invoicing threshold - InvoicingThreshold *float64 `json:"invoicingThreshold,omitempty"` - - // array of meters to filter by - MeterFilter []interface{} `json:"meterFilter,omitempty"` - - // operator used to compare currentSpend with amount - Operator *AlertOperator `json:"operator,omitempty"` - - // overriding alert - OverridingAlert *string `json:"overridingAlert,omitempty"` - - // datetime of periodStartDate - PeriodStartDate *string `json:"periodStartDate,omitempty"` - - // array of resources to filter by - ResourceFilter []interface{} `json:"resourceFilter,omitempty"` - - // array of resourceGroups to filter by - ResourceGroupFilter []interface{} `json:"resourceGroupFilter,omitempty"` - - // tags to filter by - TagFilter interface{} `json:"tagFilter,omitempty"` - - // notification threshold percentage as a decimal which activated this alert - Threshold *float64 `json:"threshold,omitempty"` - - // Type of timegrain cadence - TimeGrainType *AlertTimeGrainType `json:"timeGrainType,omitempty"` - - // notificationId that triggered this alert - TriggeredBy *string `json:"triggeredBy,omitempty"` - - // unit of currency being used - Unit *string `json:"unit,omitempty"` -} - -// AlertsClientDismissOptions contains the optional parameters for the AlertsClient.Dismiss method. -type AlertsClientDismissOptions struct { - // placeholder for future optional parameters -} - -// AlertsClientGetOptions contains the optional parameters for the AlertsClient.Get method. -type AlertsClientGetOptions struct { - // placeholder for future optional parameters -} - -// AlertsClientListExternalOptions contains the optional parameters for the AlertsClient.ListExternal method. -type AlertsClientListExternalOptions struct { - // placeholder for future optional parameters -} - -// AlertsClientListOptions contains the optional parameters for the AlertsClient.List method. -type AlertsClientListOptions struct { - // placeholder for future optional parameters -} - -// AlertsResult - Result of alerts. -type AlertsResult struct { - // READ-ONLY; URL to get the next set of alerts results if there are any. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` - - // READ-ONLY; List of alerts. - Value []*Alert `json:"value,omitempty" azure:"ro"` -} - -// CommonExportProperties - The common properties of the export. -type CommonExportProperties struct { - // REQUIRED; Has the definition for the export. - Definition *ExportDefinition `json:"definition,omitempty"` - - // REQUIRED; Has delivery information for the export. - DeliveryInfo *ExportDeliveryInfo `json:"deliveryInfo,omitempty"` - - // The format of the export being delivered. Currently only 'Csv' is supported. - Format *FormatType `json:"format,omitempty"` - - // If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. - // Note: this option is currently available only for modern commerce scopes. - PartitionData *bool `json:"partitionData,omitempty"` - - // If requested, has the most recent execution history for the export. - RunHistory *ExportExecutionListResult `json:"runHistory,omitempty"` - - // READ-ONLY; If the export has an active schedule, provides an estimate of the next execution time. - NextRunTimeEstimate *time.Time `json:"nextRunTimeEstimate,omitempty" azure:"ro"` -} - -// Dimension - List of Dimension. -type Dimension struct { - // Dimension properties. - Properties *DimensionProperties `json:"properties,omitempty"` - - // READ-ONLY; ETag of the resource. - ETag *string `json:"eTag,omitempty" azure:"ro"` - - // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Location of the resource. - Location *string `json:"location,omitempty" azure:"ro"` - - // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; SKU of the resource. - SKU *string `json:"sku,omitempty" azure:"ro"` - - // READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` - - // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// DimensionProperties - Dimension properties. -type DimensionProperties struct { - // Dimension data. - Data []*string `json:"data,omitempty"` - - // READ-ONLY; Dimension category. - Category *string `json:"category,omitempty" azure:"ro"` - - // READ-ONLY; Dimension description. - Description *string `json:"description,omitempty" azure:"ro"` - - // READ-ONLY; Filter enabled. - FilterEnabled *bool `json:"filterEnabled,omitempty" azure:"ro"` - - // READ-ONLY; Grouping enabled. - GroupingEnabled *bool `json:"groupingEnabled,omitempty" azure:"ro"` - - // READ-ONLY; The link (url) to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` - - // READ-ONLY; Total number of data for the dimension. - Total *int32 `json:"total,omitempty" azure:"ro"` - - // READ-ONLY; Usage end. - UsageEnd *time.Time `json:"usageEnd,omitempty" azure:"ro"` - - // READ-ONLY; Usage start. - UsageStart *time.Time `json:"usageStart,omitempty" azure:"ro"` -} - -// DimensionsClientByExternalCloudProviderTypeOptions contains the optional parameters for the DimensionsClient.ByExternalCloudProviderType -// method. -type DimensionsClientByExternalCloudProviderTypeOptions struct { - // May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions. - Expand *string - // May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators - // are 'eq','lt', 'gt', 'le', 'ge'. - Filter *string - // Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, - // the value of the nextLink element will include a skiptoken parameter that - // specifies a starting point to use for subsequent calls. - Skiptoken *string - // May be used to limit the number of results to the most recent N dimension data. - Top *int32 -} - -// DimensionsClientListOptions contains the optional parameters for the DimensionsClient.List method. -type DimensionsClientListOptions struct { - // May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions. - Expand *string - // May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators - // are 'eq','lt', 'gt', 'le', 'ge'. - Filter *string - // Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, - // the value of the nextLink element will include a skiptoken parameter that - // specifies a starting point to use for subsequent calls. - Skiptoken *string - // May be used to limit the number of results to the most recent N dimension data. - Top *int32 -} - -// DimensionsListResult - Result of listing dimensions. It contains a list of available dimensions. -type DimensionsListResult struct { - // READ-ONLY; The list of dimensions. - Value []*Dimension `json:"value,omitempty" azure:"ro"` -} - -// DismissAlertPayload - The request payload to update an alert -type DismissAlertPayload struct { - // Alert properties. - Properties *AlertProperties `json:"properties,omitempty"` -} - -// DownloadURL - The URL to download the generated report. -type DownloadURL struct { - // The URL to download the generated report. - DownloadURL *string `json:"downloadUrl,omitempty"` - - // The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. - ValidTill *time.Time `json:"validTill,omitempty"` -} - -// ErrorDetails - The details of the error. -type ErrorDetails struct { - // READ-ONLY; Error code. - Code *string `json:"code,omitempty" azure:"ro"` - - // READ-ONLY; Error message indicating why the operation failed. - Message *string `json:"message,omitempty" azure:"ro"` -} - -// ErrorResponse - Error response indicates that the service is not able to process the incoming request. The reason is provided -// in the error message. -// Some Error responses: -// * 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" -// header. -// -// * 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" -// header. -type ErrorResponse struct { - // The details of the error. - Error *ErrorDetails `json:"error,omitempty"` -} - -// 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 - // the latest version or not. - ETag *string `json:"eTag,omitempty"` - - // The properties of the export. - Properties *ExportProperties `json:"properties,omitempty"` - - // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ExportDataset - The definition for data in the export. -type ExportDataset struct { - // The export dataset configuration. - Configuration *ExportDatasetConfiguration `json:"configuration,omitempty"` - - // The granularity of rows in the export. Currently only 'Daily' is supported. - Granularity *GranularityType `json:"granularity,omitempty"` -} - -// ExportDatasetConfiguration - The export dataset configuration. Allows columns to be selected for the export. If not provided -// then the export will include all available columns. -type ExportDatasetConfiguration struct { - // Array of column names to be included in the export. If not provided then the export will include all available columns. - // The available columns can vary by customer channel (see examples). - Columns []*string `json:"columns,omitempty"` -} - -// ExportDefinition - The definition of an export. -type ExportDefinition struct { - // REQUIRED; The time frame for pulling data for the export. If custom, then a specific time period must be provided. - Timeframe *TimeframeType `json:"timeframe,omitempty"` - - // REQUIRED; The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that do - // not yet provide data for charges or amortization for service reservations. - Type *ExportType `json:"type,omitempty"` - - // The definition for data in the export. - DataSet *ExportDataset `json:"dataSet,omitempty"` - - // Has time period for pulling data for the export. - TimePeriod *ExportTimePeriod `json:"timePeriod,omitempty"` -} - -// ExportDeliveryDestination - This represents the blob storage account location where exports of costs will be delivered. -// There are two ways to configure the destination. The approach recommended for most customers is to specify -// the resourceId of the storage account. This requires a one-time registration of the account's subscription with the Microsoft.CostManagementExports -// resource provider in order to give Cost Management -// services access to the storage. When creating an export in the Azure portal this registration is performed automatically -// but API users may need to register the subscription explicitly (for more -// information see https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-supported-services ). Another -// way to configure the destination is available ONLY to Partners with a -// Microsoft Partner Agreement plan who are global admins of their billing account. These Partners, instead of specifying -// the resourceId of a storage account, can specify the storage account name along -// with a SAS token for the account. This allows exports of costs to a storage account in any tenant. The SAS token should -// be created for the blob service with Service/Container/Object resource types and -// with Read/Write/Delete/List/Add/Create permissions (for more information see https://docs.microsoft.com/en-us/azure/cost-management-billing/costs/export-cost-data-storage-account-sas-key -// ). -type ExportDeliveryDestination struct { - // REQUIRED; The name of the container where exports will be uploaded. If the container does not exist it will be created. - Container *string `json:"container,omitempty"` - - // The resource id of the storage account where exports will be delivered. This is not required if a sasToken and storageAccount - // are specified. - ResourceID *string `json:"resourceId,omitempty"` - - // The name of the directory where exports will be uploaded. - RootFolderPath *string `json:"rootFolderPath,omitempty"` - - // A SAS token for the storage account. For a restricted set of Azure customers this together with storageAccount can be specified - // instead of resourceId. Note: the value returned by the API for this - // property will always be obfuscated. Returning this same obfuscated value will not result in the SAS token being updated. - // To update this value a new SAS token must be specified. - SasToken *string `json:"sasToken,omitempty"` - - // The storage account where exports will be uploaded. For a restricted set of Azure customers this together with sasToken - // can be specified instead of resourceId. - StorageAccount *string `json:"storageAccount,omitempty"` -} - -// ExportDeliveryInfo - The delivery information associated with a export. -type ExportDeliveryInfo struct { - // REQUIRED; Has destination for the export being delivered. - Destination *ExportDeliveryDestination `json:"destination,omitempty"` -} - -// 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 `json:"eTag,omitempty"` - - // The properties of the export execution. - Properties *ExportExecutionProperties `json:"properties,omitempty"` - - // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ExportExecutionListResult - Result of listing the execution history of an export. -type ExportExecutionListResult struct { - // READ-ONLY; A list of export executions. - Value []*ExportExecution `json:"value,omitempty" azure:"ro"` -} - -// ExportExecutionProperties - The properties of the export execution. -type ExportExecutionProperties struct { - // The details of any error. - Error *ErrorDetails `json:"error,omitempty"` - - // The type of the export execution. - ExecutionType *ExecutionType `json:"executionType,omitempty"` - - // The name of the exported file. - FileName *string `json:"fileName,omitempty"` - - // The time when the export execution finished. - ProcessingEndTime *time.Time `json:"processingEndTime,omitempty"` - - // The time when export was picked up to be executed. - ProcessingStartTime *time.Time `json:"processingStartTime,omitempty"` - - // The export settings that were in effect for this execution. - RunSettings *CommonExportProperties `json:"runSettings,omitempty"` - - // The last known status of the export execution. - Status *ExecutionStatus `json:"status,omitempty"` - - // 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 `json:"submittedBy,omitempty"` - - // The time when export was queued to be executed. - SubmittedTime *time.Time `json:"submittedTime,omitempty"` -} - -// ExportListResult - Result of listing exports. It contains a list of available exports in the scope provided. -type ExportListResult struct { - // READ-ONLY; The list of exports. - Value []*Export `json:"value,omitempty" azure:"ro"` -} - -// ExportProperties - The properties of the export. -type ExportProperties struct { - // REQUIRED; Has the definition for the export. - Definition *ExportDefinition `json:"definition,omitempty"` - - // REQUIRED; Has delivery information for the export. - DeliveryInfo *ExportDeliveryInfo `json:"deliveryInfo,omitempty"` - - // The format of the export being delivered. Currently only 'Csv' is supported. - Format *FormatType `json:"format,omitempty"` - - // If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. - // Note: this option is currently available only for modern commerce scopes. - PartitionData *bool `json:"partitionData,omitempty"` - - // If requested, has the most recent execution history for the export. - RunHistory *ExportExecutionListResult `json:"runHistory,omitempty"` - - // Has schedule information for the export. - Schedule *ExportSchedule `json:"schedule,omitempty"` - - // READ-ONLY; If the export has an active schedule, provides an estimate of the next execution time. - NextRunTimeEstimate *time.Time `json:"nextRunTimeEstimate,omitempty" azure:"ro"` -} - -// ExportRecurrencePeriod - The start and end date for recurrence schedule. -type ExportRecurrencePeriod struct { - // REQUIRED; The start date of recurrence. - From *time.Time `json:"from,omitempty"` - - // The end date of recurrence. - To *time.Time `json:"to,omitempty"` -} - -// ExportSchedule - The schedule associated with the export. -type ExportSchedule struct { - // The schedule recurrence. - Recurrence *RecurrenceType `json:"recurrence,omitempty"` - - // Has start and end date of the recurrence. The start date must be in future. If present, the end date must be greater than - // start date. - RecurrencePeriod *ExportRecurrencePeriod `json:"recurrencePeriod,omitempty"` - - // The status of the export's schedule. If 'Inactive', the export's schedule is paused. - Status *StatusType `json:"status,omitempty"` -} - -// ExportTimePeriod - The date range for data in the export. This should only be specified with timeFrame set to 'Custom'. -// The maximum date range is 3 months. -type ExportTimePeriod struct { - // REQUIRED; The start date for export data. - From *time.Time `json:"from,omitempty"` - - // REQUIRED; The end date for export data. - To *time.Time `json:"to,omitempty"` -} - -// ExportsClientCreateOrUpdateOptions contains the optional parameters for the ExportsClient.CreateOrUpdate method. -type ExportsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ExportsClientDeleteOptions contains the optional parameters for the ExportsClient.Delete method. -type ExportsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ExportsClientExecuteOptions contains the optional parameters for the ExportsClient.Execute method. -type ExportsClientExecuteOptions struct { - // placeholder for future optional parameters -} - -// ExportsClientGetExecutionHistoryOptions contains the optional parameters for the ExportsClient.GetExecutionHistory method. -type ExportsClientGetExecutionHistoryOptions struct { - // placeholder for future optional parameters -} - -// 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. - 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. - Expand *string -} - -// ForecastClientExternalCloudProviderUsageOptions contains the optional parameters for the ForecastClient.ExternalCloudProviderUsage -// method. -type ForecastClientExternalCloudProviderUsageOptions struct { - // May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter - // supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently - // support 'ne', 'or', or 'not'. - Filter *string -} - -// ForecastClientUsageOptions contains the optional parameters for the ForecastClient.Usage method. -type ForecastClientUsageOptions struct { - // May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter - // supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently - // support 'ne', 'or', or 'not'. - Filter *string -} - -// 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 `json:"aggregation,omitempty"` - - // Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping - // are provided. - Configuration *QueryDatasetConfiguration `json:"configuration,omitempty"` - - // Has filter expression to use in the forecast. - Filter *QueryFilter `json:"filter,omitempty"` - - // The granularity of rows in the forecast. - Granularity *GranularityType `json:"granularity,omitempty"` -} - -// ForecastDefinition - The definition of a forecast. -type ForecastDefinition struct { - // REQUIRED; Has definition for data in this forecast. - Dataset *ForecastDataset `json:"dataset,omitempty"` - - // REQUIRED; The time frame for pulling data for the forecast. If custom, then a specific time period must be provided. - Timeframe *ForecastTimeframeType `json:"timeframe,omitempty"` - - // REQUIRED; The type of the forecast. - Type *ForecastType `json:"type,omitempty"` - - // a boolean determining if actualCost will be included - IncludeActualCost *bool `json:"includeActualCost,omitempty"` - - // a boolean determining if FreshPartialCost will be included - IncludeFreshPartialCost *bool `json:"includeFreshPartialCost,omitempty"` - - // Has time period for pulling data for the forecast. - TimePeriod *QueryTimePeriod `json:"timePeriod,omitempty"` -} - -// GenerateDetailedCostReportClientBeginCreateOperationOptions contains the optional parameters for the GenerateDetailedCostReportClient.BeginCreateOperation -// method. -type GenerateDetailedCostReportClientBeginCreateOperationOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// 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 - // either timePeriod or invoiceId or billingPeriod parameters. If none provided - // current month cost is provided. - BillingPeriod *string `json:"billingPeriod,omitempty"` - - // Customer Id for Modern (Invoice Id and billing profile is also required for this). - CustomerID *string `json:"customerId,omitempty"` - - // Invoice Id for PayAsYouGo customers and Modern billing profile scope. Can only have one of either timePeriod or invoiceId - // or billingPeriod parameters. If none provided current month cost is provided. - InvoiceID *string `json:"invoiceId,omitempty"` - - // The type of the detailed report. By default ActualCost is provided - Metric *GenerateDetailedCostReportMetricType `json:"metric,omitempty"` - - // Has time period for pulling data for the cost detailed report. Can only have one of either timePeriod or invoiceId or billingPeriod - // parameters. If none provided current month cost is provided. - TimePeriod *GenerateDetailedCostReportTimePeriod `json:"timePeriod,omitempty"` -} - -// GenerateDetailedCostReportErrorResponse - Error response indicates that the service is not able to process the incoming -// request. The reason is provided in the error message. -// Some Error responses: -// * 413 Request Entity Too Large - Request is throttled. The amount of data required to fulfill the request exceeds the maximum -// size permitted of 2Gb. Please utilize our Exports feature instead. -// -// * 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" -// header. -// -// * 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" -// header. -type GenerateDetailedCostReportErrorResponse struct { - // The details of the error. - Error *ErrorDetails `json:"error,omitempty"` -} - -// GenerateDetailedCostReportOperationResult - The result of the long running operation for cost detailed report. -type GenerateDetailedCostReportOperationResult struct { - // The id of the long running operation. - ID *string `json:"id,omitempty"` - - // The name of the long running operation. - Name *string `json:"name,omitempty"` - - // The properties of the resource generated. - Properties *DownloadURL `json:"properties,omitempty"` - - // The type of the long running operation. - Type *string `json:"type,omitempty"` -} - -// GenerateDetailedCostReportOperationResultsClientGetOptions contains the optional parameters for the GenerateDetailedCostReportOperationResultsClient.Get -// method. -type GenerateDetailedCostReportOperationResultsClientGetOptions struct { - // placeholder for future optional parameters -} - -// GenerateDetailedCostReportOperationStatusClientGetOptions contains the optional parameters for the GenerateDetailedCostReportOperationStatusClient.Get -// method. -type GenerateDetailedCostReportOperationStatusClientGetOptions struct { - // placeholder for future optional parameters -} - -// GenerateDetailedCostReportOperationStatuses - The status of the long running operation for cost detailed report. -type GenerateDetailedCostReportOperationStatuses struct { - // The details of the error. - Error *ErrorDetails `json:"error,omitempty"` - - // The id of the long running operation. - ID *string `json:"id,omitempty"` - - // The name of the long running operation. - Name *string `json:"name,omitempty"` - - // The properties of the resource generated. - Properties *DownloadURL `json:"properties,omitempty"` - - // The status of the long running operation. - Status *Status `json:"status,omitempty"` - - // The type of the long running operation. - Type *string `json:"type,omitempty"` -} - -// GenerateDetailedCostReportTimePeriod - The start and end date for pulling data for the cost detailed report. -type GenerateDetailedCostReportTimePeriod struct { - // REQUIRED; The end date to pull data to. example format 2020-03-15 - End *string `json:"end,omitempty"` - - // REQUIRED; The start date to pull data from. example format 2020-03-15 - Start *string `json:"start,omitempty"` -} - -// GenerateReservationDetailsReportClientBeginByBillingAccountIDOptions contains the optional parameters for the GenerateReservationDetailsReportClient.BeginByBillingAccountID -// method. -type GenerateReservationDetailsReportClientBeginByBillingAccountIDOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// GenerateReservationDetailsReportClientBeginByBillingProfileIDOptions contains the optional parameters for the GenerateReservationDetailsReportClient.BeginByBillingProfileID -// method. -type GenerateReservationDetailsReportClientBeginByBillingProfileIDOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// KpiProperties - Each KPI must contain a 'type' and 'enabled' key. -type KpiProperties struct { - // show the KPI in the UI? - Enabled *bool `json:"enabled,omitempty"` - - // ID of resource related to metric (budget). - ID *string `json:"id,omitempty"` - - // KPI type (Forecast, Budget). - Type *KpiType `json:"type,omitempty"` -} - -// Operation - A Cost management REST API operation. -type Operation struct { - // The object that represents the operation. - Display *OperationDisplay `json:"display,omitempty"` - - // READ-ONLY; Operation id: {provider}/{resource}/{operation}. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Operation name: {provider}/{resource}/{operation}. - Name *string `json:"name,omitempty" azure:"ro"` -} - -// OperationDisplay - The object that represents the operation. -type OperationDisplay struct { - // READ-ONLY; Operation description - Description *string `json:"description,omitempty" azure:"ro"` - - // READ-ONLY; Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty" azure:"ro"` - - // READ-ONLY; Service provider: Microsoft.CostManagement. - Provider *string `json:"provider,omitempty" azure:"ro"` - - // READ-ONLY; Resource on which the operation is performed: Dimensions, Query. - Resource *string `json:"resource,omitempty" azure:"ro"` -} - -// 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 { - // READ-ONLY; URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` - - // READ-ONLY; List of cost management operations supported by the Microsoft.CostManagement resource provider. - Value []*Operation `json:"value,omitempty" azure:"ro"` -} - -// OperationStatus - The status of the long running operation. -type OperationStatus struct { - // The properties of the resource generated. - Properties *ReportURL `json:"properties,omitempty"` - - // The status of the long running operation. - Status *OperationStatusType `json:"status,omitempty"` -} - -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - -// PivotProperties - Each pivot must contain a 'type' and 'name'. -type PivotProperties struct { - // Data field to show in view. - Name *string `json:"name,omitempty"` - - // Data type to show in view. - Type *PivotType `json:"type,omitempty"` -} - -// ProxyResource - The Resource model definition. -type ProxyResource struct { - // eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating - // the latest version or not. - ETag *string `json:"eTag,omitempty"` - - // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// QueryAggregation - The aggregation expression to be used in the query. -type QueryAggregation struct { - // REQUIRED; The name of the aggregation function to use. - Function *FunctionType `json:"function,omitempty"` - - // REQUIRED; The name of the column to aggregate. - Name *string `json:"name,omitempty"` -} - -// QueryClientUsageByExternalCloudProviderTypeOptions contains the optional parameters for the QueryClient.UsageByExternalCloudProviderType -// method. -type QueryClientUsageByExternalCloudProviderTypeOptions struct { - // placeholder for future optional parameters -} - -// QueryClientUsageOptions contains the optional parameters for the QueryClient.Usage method. -type QueryClientUsageOptions struct { - // placeholder for future optional parameters -} - -// QueryColumn properties -type QueryColumn struct { - // The name of column. - Name *string `json:"name,omitempty"` - - // The type of column. - Type *string `json:"type,omitempty"` -} - -// QueryComparisonExpression - The comparison expression to be used in the query. -type QueryComparisonExpression struct { - // REQUIRED; The name of the column to use in comparison. - Name *string `json:"name,omitempty"` - - // REQUIRED; The operator to use for comparison. - Operator *QueryOperatorType `json:"operator,omitempty"` - - // REQUIRED; Array of values to use for comparison - Values []*string `json:"values,omitempty"` -} - -// QueryDataset - The definition of data present in the query. -type QueryDataset struct { - // Dictionary of aggregation expression to use in the query. The key of each item in the dictionary is the alias for the aggregated - // column. Query can have up to 2 aggregation clauses. - Aggregation map[string]*QueryAggregation `json:"aggregation,omitempty"` - - // Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping - // are provided. - Configuration *QueryDatasetConfiguration `json:"configuration,omitempty"` - - // The filter expression to use in the query. Please reference our Query API REST documentation for how to properly format - // the filter. - Filter *QueryFilter `json:"filter,omitempty"` - - // The granularity of rows in the query. - Granularity *GranularityType `json:"granularity,omitempty"` - - // Array of group by expression to use in the query. Query can have up to 2 group by clauses. - Grouping []*QueryGrouping `json:"grouping,omitempty"` -} - -// QueryDatasetConfiguration - The configuration of dataset in the query. -type QueryDatasetConfiguration struct { - // Array of column names to be included in the query. Any valid query column name is allowed. If not provided, then query - // includes all columns. - Columns []*string `json:"columns,omitempty"` -} - -// QueryDefinition - The definition of a query. -type QueryDefinition struct { - // REQUIRED; Has definition for data in this query. - Dataset *QueryDataset `json:"dataset,omitempty"` - - // REQUIRED; The time frame for pulling data for the query. If custom, then a specific time period must be provided. - Timeframe *TimeframeType `json:"timeframe,omitempty"` - - // REQUIRED; The type of the query. - Type *ExportType `json:"type,omitempty"` - - // Has time period for pulling data for the query. - TimePeriod *QueryTimePeriod `json:"timePeriod,omitempty"` -} - -// QueryFilter - The filter expression to be used in the export. -type QueryFilter struct { - // The logical "AND" expression. Must have at least 2 items. - And []*QueryFilter `json:"and,omitempty"` - - // Has comparison expression for a dimension - Dimensions *QueryComparisonExpression `json:"dimensions,omitempty"` - - // The logical "OR" expression. Must have at least 2 items. - Or []*QueryFilter `json:"or,omitempty"` - - // Has comparison expression for a tag - Tags *QueryComparisonExpression `json:"tags,omitempty"` -} - -// QueryGrouping - The group by expression to be used in the query. -type QueryGrouping struct { - // REQUIRED; The name of the column to group. - Name *string `json:"name,omitempty"` - - // REQUIRED; Has type of the column to group. - Type *QueryColumnType `json:"type,omitempty"` -} - -// QueryProperties - Query properties -type QueryProperties struct { - // Array of columns - Columns []*QueryColumn `json:"columns,omitempty"` - - // The link (url) to the next page of results. - NextLink *string `json:"nextLink,omitempty"` - - // Array of rows - Rows [][]interface{} `json:"rows,omitempty"` -} - -// QueryResult - Result of query. It contains all columns listed under groupings and aggregation. -type QueryResult struct { - // Query properties - Properties *QueryProperties `json:"properties,omitempty"` - - // READ-ONLY; ETag of the resource. - ETag *string `json:"eTag,omitempty" azure:"ro"` - - // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Location of the resource. - Location *string `json:"location,omitempty" azure:"ro"` - - // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; SKU of the resource. - SKU *string `json:"sku,omitempty" azure:"ro"` - - // READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` - - // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// QueryTimePeriod - The start and end date for pulling data for the query. -type QueryTimePeriod struct { - // REQUIRED; The start date to pull data from. - From *time.Time `json:"from,omitempty"` - - // REQUIRED; The end date to pull data to. - To *time.Time `json:"to,omitempty"` -} - -// ReportConfigAggregation - The aggregation expression to be used in the report. -type ReportConfigAggregation struct { - // REQUIRED; The name of the aggregation function to use. - Function *FunctionType `json:"function,omitempty"` - - // REQUIRED; The name of the column to aggregate. - Name *string `json:"name,omitempty"` -} - -// ReportConfigComparisonExpression - The comparison expression to be used in the report. -type ReportConfigComparisonExpression struct { - // REQUIRED; The name of the column to use in comparison. - Name *string `json:"name,omitempty"` - - // REQUIRED; The operator to use for comparison. - Operator *OperatorType `json:"operator,omitempty"` - - // REQUIRED; Array of values to use for comparison - Values []*string `json:"values,omitempty"` -} - -// ReportConfigDataset - The definition of data present in the report. -type ReportConfigDataset struct { - // Dictionary of aggregation expression to use in the report. The key of each item in the dictionary is the alias for the - // aggregated column. Report can have up to 2 aggregation clauses. - Aggregation map[string]*ReportConfigAggregation `json:"aggregation,omitempty"` - - // Has configuration information for the data in the report. The configuration will be ignored if aggregation and grouping - // are provided. - Configuration *ReportConfigDatasetConfiguration `json:"configuration,omitempty"` - - // Has filter expression to use in the report. - Filter *ReportConfigFilter `json:"filter,omitempty"` - - // The granularity of rows in the report. - Granularity *ReportGranularityType `json:"granularity,omitempty"` - - // Array of group by expression to use in the report. Report can have up to 2 group by clauses. - Grouping []*ReportConfigGrouping `json:"grouping,omitempty"` - - // Array of order by expression to use in the report. - Sorting []*ReportConfigSorting `json:"sorting,omitempty"` -} - -// ReportConfigDatasetConfiguration - The configuration of dataset in the report. -type ReportConfigDatasetConfiguration struct { - // Array of column names to be included in the report. Any valid report column name is allowed. If not provided, then report - // includes all columns. - Columns []*string `json:"columns,omitempty"` -} - -// ReportConfigDefinition - The definition of a report config. -type ReportConfigDefinition struct { - // REQUIRED; The time frame for pulling data for the report. If custom, then a specific time period must be provided. - Timeframe *ReportTimeframeType `json:"timeframe,omitempty"` - - // REQUIRED; The type of the report. Usage represents actual usage, forecast represents forecasted data and UsageAndForecast - // represents both usage and forecasted data. Actual usage and forecasted data can be - // differentiated based on dates. - Type *ReportType `json:"type,omitempty"` - - // Has definition for data in this report config. - DataSet *ReportConfigDataset `json:"dataSet,omitempty"` - - // If true, report includes monetary commitment. - IncludeMonetaryCommitment *bool `json:"includeMonetaryCommitment,omitempty"` - - // Has time period for pulling data for the report. - TimePeriod *ReportConfigTimePeriod `json:"timePeriod,omitempty"` -} - -// ReportConfigFilter - The filter expression to be used in the report. -type ReportConfigFilter struct { - // The logical "AND" expression. Must have at least 2 items. - And []*ReportConfigFilter `json:"and,omitempty"` - - // Has comparison expression for a dimension - Dimensions *ReportConfigComparisonExpression `json:"dimensions,omitempty"` - - // The logical "OR" expression. Must have at least 2 items. - Or []*ReportConfigFilter `json:"or,omitempty"` - - // Has comparison expression for a tag - Tags *ReportConfigComparisonExpression `json:"tags,omitempty"` -} - -// ReportConfigGrouping - The group by expression to be used in the report. -type ReportConfigGrouping struct { - // REQUIRED; The name of the column to group. This version supports subscription lowest possible grain. - Name *string `json:"name,omitempty"` - - // REQUIRED; Has type of the column to group. - Type *ReportConfigColumnType `json:"type,omitempty"` -} - -// ReportConfigSorting - The order by expression to be used in the report. -type ReportConfigSorting struct { - // REQUIRED; The name of the column to sort. - Name *string `json:"name,omitempty"` - - // Direction of sort. - Direction *ReportConfigSortingType `json:"direction,omitempty"` -} - -// ReportConfigTimePeriod - The start and end date for pulling data for the report. -type ReportConfigTimePeriod struct { - // REQUIRED; The start date to pull data from. - From *time.Time `json:"from,omitempty"` - - // REQUIRED; The end date to pull data to. - To *time.Time `json:"to,omitempty"` -} - -// 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 - ReportURL *ReservationReportSchema `json:"reportUrl,omitempty"` - - // The time at which report URL becomes invalid. - ValidUntil *time.Time `json:"validUntil,omitempty"` -} - -// Resource - The Resource model definition. -type Resource struct { - // READ-ONLY; ETag of the resource. - ETag *string `json:"eTag,omitempty" azure:"ro"` - - // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Location of the resource. - Location *string `json:"location,omitempty" azure:"ro"` - - // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; SKU of the resource. - SKU *string `json:"sku,omitempty" azure:"ro"` - - // READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` - - // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// Status - The status of the long running operation. -type Status struct { - // The status of the long running operation. - Status *ReportOperationStatusType `json:"status,omitempty"` -} - -// 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 - // the latest version or not. - ETag *string `json:"eTag,omitempty"` - - // The properties of the view. - Properties *ViewProperties `json:"properties,omitempty"` - - // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ViewListResult - Result of listing views. It contains a list of available views. -type ViewListResult struct { - // READ-ONLY; The link (url) to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` - - // READ-ONLY; The list of views. - Value []*View `json:"value,omitempty" azure:"ro"` -} - -// ViewProperties - The properties of the view. -type ViewProperties struct { - // Show costs accumulated over time. - Accumulated *AccumulatedType `json:"accumulated,omitempty"` - - // Chart type of the main view in Cost Analysis. Required. - Chart *ChartType `json:"chart,omitempty"` - - // User input name of the view. Required. - DisplayName *string `json:"displayName,omitempty"` - - // List of KPIs to show in Cost Analysis UI. - Kpis []*KpiProperties `json:"kpis,omitempty"` - - // Metric to use when displaying costs. - Metric *MetricType `json:"metric,omitempty"` - - // Configuration of 3 sub-views in the Cost Analysis UI. - Pivots []*PivotProperties `json:"pivots,omitempty"` - - // Query body configuration. Required. - Query *ReportConfigDefinition `json:"query,omitempty"` - - // Cost Management scope to save the view on. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' - // for resourceGroup - // scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' - // for - // Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' - // for EnrollmentAccount scope, - // 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile - // scope, - // 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection - // scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for - // Management Group scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for - // ExternalBillingAccount scope, and - // '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope. - Scope *string `json:"scope,omitempty"` - - // READ-ONLY; Date the user created this view. - CreatedOn *time.Time `json:"createdOn,omitempty" azure:"ro"` - - // READ-ONLY; Currency of the current view. - Currency *string `json:"currency,omitempty" azure:"ro"` - - // READ-ONLY; Date range of the current view. - DateRange *string `json:"dateRange,omitempty" azure:"ro"` - - // READ-ONLY; Date when the user last modified this view. - ModifiedOn *time.Time `json:"modifiedOn,omitempty" azure:"ro"` -} - -// ViewsClientCreateOrUpdateByScopeOptions contains the optional parameters for the ViewsClient.CreateOrUpdateByScope method. -type ViewsClientCreateOrUpdateByScopeOptions struct { - // placeholder for future optional parameters -} - -// ViewsClientCreateOrUpdateOptions contains the optional parameters for the ViewsClient.CreateOrUpdate method. -type ViewsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ViewsClientDeleteByScopeOptions contains the optional parameters for the ViewsClient.DeleteByScope method. -type ViewsClientDeleteByScopeOptions struct { - // placeholder for future optional parameters -} - -// ViewsClientDeleteOptions contains the optional parameters for the ViewsClient.Delete method. -type ViewsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ViewsClientGetByScopeOptions contains the optional parameters for the ViewsClient.GetByScope method. -type ViewsClientGetByScopeOptions struct { - // placeholder for future optional parameters -} - -// ViewsClientGetOptions contains the optional parameters for the ViewsClient.Get method. -type ViewsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ViewsClientListByScopeOptions contains the optional parameters for the ViewsClient.ListByScope method. -type ViewsClientListByScopeOptions struct { - // placeholder for future optional parameters -} - -// ViewsClientListOptions contains the optional parameters for the ViewsClient.List method. -type ViewsClientListOptions struct { - // placeholder for future optional parameters -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_models_serde.go b/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_models_serde.go deleted file mode 100644 index 2eb55f6d045e..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_models_serde.go +++ /dev/null @@ -1,612 +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. - -package armcostmanagement - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type AlertPropertiesDetails. -func (a AlertPropertiesDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "amount", a.Amount) - populate(objectMap, "companyName", a.CompanyName) - populate(objectMap, "contactEmails", a.ContactEmails) - populate(objectMap, "contactGroups", a.ContactGroups) - populate(objectMap, "contactRoles", a.ContactRoles) - populate(objectMap, "currentSpend", a.CurrentSpend) - populate(objectMap, "departmentName", a.DepartmentName) - populate(objectMap, "enrollmentEndDate", a.EnrollmentEndDate) - populate(objectMap, "enrollmentNumber", a.EnrollmentNumber) - populate(objectMap, "enrollmentStartDate", a.EnrollmentStartDate) - populate(objectMap, "invoicingThreshold", a.InvoicingThreshold) - populate(objectMap, "meterFilter", a.MeterFilter) - populate(objectMap, "operator", a.Operator) - populate(objectMap, "overridingAlert", a.OverridingAlert) - populate(objectMap, "periodStartDate", a.PeriodStartDate) - populate(objectMap, "resourceFilter", a.ResourceFilter) - populate(objectMap, "resourceGroupFilter", a.ResourceGroupFilter) - populate(objectMap, "tagFilter", &a.TagFilter) - populate(objectMap, "threshold", a.Threshold) - populate(objectMap, "timeGrainType", a.TimeGrainType) - populate(objectMap, "triggeredBy", a.TriggeredBy) - populate(objectMap, "unit", a.Unit) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type CommonExportProperties. -func (c CommonExportProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - 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 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", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - 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", c, err) - } - } - return nil -} - -// 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - 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", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DismissAlertPayload. -func (d DismissAlertPayload) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", d.Properties) - return json.Marshal(objectMap) -} - -// 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "downloadUrl": - err = unpopulate(val, "DownloadURL", &d.DownloadURL) - delete(rawMsg, key) - case "validTill": - err = unpopulateTimeRFC3339(val, "ValidTill", &d.ValidTill) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ExportDatasetConfiguration. -func (e ExportDatasetConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "columns", e.Columns) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ExportExecutionListResult. -func (e ExportExecutionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", e.Value) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ExportExecutionProperties. -func (e ExportExecutionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - 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 ExportExecutionProperties. -func (e *ExportExecutionProperties) 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 ExportProperties. -func (e ExportProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - 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]interface{}) - 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 ExportTimePeriod. -func (e ExportTimePeriod) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - 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 ForecastDataset. -func (f ForecastDataset) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "aggregation", f.Aggregation) - populate(objectMap, "configuration", f.Configuration) - populate(objectMap, "filter", f.Filter) - populate(objectMap, "granularity", f.Granularity) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type QueryComparisonExpression. -func (q QueryComparisonExpression) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "name", q.Name) - populate(objectMap, "operator", q.Operator) - populate(objectMap, "values", q.Values) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type QueryDataset. -func (q QueryDataset) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - 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) -} - -// MarshalJSON implements the json.Marshaller interface for type QueryDatasetConfiguration. -func (q QueryDatasetConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "columns", q.Columns) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type QueryFilter. -func (q QueryFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "and", q.And) - populate(objectMap, "dimensions", q.Dimensions) - populate(objectMap, "or", q.Or) - populate(objectMap, "tags", q.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type QueryTimePeriod. -func (q QueryTimePeriod) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "from", q.From) - populateTimeRFC3339(objectMap, "to", q.To) - return json.Marshal(objectMap) -} - -// 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", q, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "from": - err = unpopulateTimeRFC3339(val, "From", &q.From) - delete(rawMsg, key) - case "to": - err = unpopulateTimeRFC3339(val, "To", &q.To) - 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 ReportConfigComparisonExpression. -func (r ReportConfigComparisonExpression) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "name", r.Name) - populate(objectMap, "operator", r.Operator) - populate(objectMap, "values", r.Values) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ReportConfigDataset. -func (r ReportConfigDataset) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - 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) -} - -// MarshalJSON implements the json.Marshaller interface for type ReportConfigDatasetConfiguration. -func (r ReportConfigDatasetConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "columns", r.Columns) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ReportConfigFilter. -func (r ReportConfigFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "and", r.And) - populate(objectMap, "dimensions", r.Dimensions) - populate(objectMap, "or", r.Or) - populate(objectMap, "tags", r.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ReportConfigTimePeriod. -func (r ReportConfigTimePeriod) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "from", r.From) - populateTimeRFC3339(objectMap, "to", r.To) - return json.Marshal(objectMap) -} - -// 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "from": - err = unpopulateTimeRFC3339(val, "From", &r.From) - delete(rawMsg, key) - case "to": - err = unpopulateTimeRFC3339(val, "To", &r.To) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "reportUrl": - err = unpopulate(val, "ReportURL", &r.ReportURL) - delete(rawMsg, key) - case "validUntil": - err = unpopulateTimeRFC3339(val, "ValidUntil", &r.ValidUntil) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ViewProperties. -func (v ViewProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "accumulated", v.Accumulated) - populate(objectMap, "chart", v.Chart) - populateTimeRFC3339(objectMap, "createdOn", v.CreatedOn) - populate(objectMap, "currency", v.Currency) - populate(objectMap, "dateRange", v.DateRange) - populate(objectMap, "displayName", v.DisplayName) - populate(objectMap, "kpis", v.Kpis) - populate(objectMap, "metric", v.Metric) - populateTimeRFC3339(objectMap, "modifiedOn", v.ModifiedOn) - populate(objectMap, "pivots", v.Pivots) - populate(objectMap, "query", v.Query) - populate(objectMap, "scope", v.Scope) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ViewProperties. -func (v *ViewProperties) 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", v, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "accumulated": - err = unpopulate(val, "Accumulated", &v.Accumulated) - delete(rawMsg, key) - case "chart": - err = unpopulate(val, "Chart", &v.Chart) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, "CreatedOn", &v.CreatedOn) - delete(rawMsg, key) - case "currency": - err = unpopulate(val, "Currency", &v.Currency) - delete(rawMsg, key) - case "dateRange": - err = unpopulate(val, "DateRange", &v.DateRange) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &v.DisplayName) - delete(rawMsg, key) - case "kpis": - err = unpopulate(val, "Kpis", &v.Kpis) - delete(rawMsg, key) - case "metric": - err = unpopulate(val, "Metric", &v.Metric) - delete(rawMsg, key) - case "modifiedOn": - err = unpopulateTimeRFC3339(val, "ModifiedOn", &v.ModifiedOn) - delete(rawMsg, key) - case "pivots": - err = unpopulate(val, "Pivots", &v.Pivots) - delete(rawMsg, key) - case "query": - err = unpopulate(val, "Query", &v.Query) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &v.Scope) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - } - return nil -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, fn string, v interface{}) error { - if data == nil { - return nil - } - if err := json.Unmarshal(data, v); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - return nil -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_response_types.go b/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_response_types.go deleted file mode 100644 index 0f40aeaffec8..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_response_types.go +++ /dev/null @@ -1,159 +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. - -package armcostmanagement - -// AlertsClientDismissResponse contains the response from method AlertsClient.Dismiss. -type AlertsClientDismissResponse struct { - Alert -} - -// AlertsClientGetResponse contains the response from method AlertsClient.Get. -type AlertsClientGetResponse struct { - Alert -} - -// AlertsClientListExternalResponse contains the response from method AlertsClient.ListExternal. -type AlertsClientListExternalResponse struct { - AlertsResult -} - -// AlertsClientListResponse contains the response from method AlertsClient.List. -type AlertsClientListResponse struct { - AlertsResult -} - -// DimensionsClientByExternalCloudProviderTypeResponse contains the response from method DimensionsClient.ByExternalCloudProviderType. -type DimensionsClientByExternalCloudProviderTypeResponse struct { - DimensionsListResult -} - -// DimensionsClientListResponse contains the response from method DimensionsClient.List. -type DimensionsClientListResponse struct { - DimensionsListResult -} - -// ExportsClientCreateOrUpdateResponse contains the response from method ExportsClient.CreateOrUpdate. -type ExportsClientCreateOrUpdateResponse struct { - Export -} - -// ExportsClientDeleteResponse contains the response from method ExportsClient.Delete. -type ExportsClientDeleteResponse struct { - // placeholder for future response values -} - -// ExportsClientExecuteResponse contains the response from method ExportsClient.Execute. -type ExportsClientExecuteResponse struct { - // placeholder for future response values -} - -// ExportsClientGetExecutionHistoryResponse contains the response from method ExportsClient.GetExecutionHistory. -type ExportsClientGetExecutionHistoryResponse struct { - ExportExecutionListResult -} - -// ExportsClientGetResponse contains the response from method ExportsClient.Get. -type ExportsClientGetResponse struct { - Export -} - -// ExportsClientListResponse contains the response from method ExportsClient.List. -type ExportsClientListResponse struct { - ExportListResult -} - -// ForecastClientExternalCloudProviderUsageResponse contains the response from method ForecastClient.ExternalCloudProviderUsage. -type ForecastClientExternalCloudProviderUsageResponse struct { - QueryResult -} - -// ForecastClientUsageResponse contains the response from method ForecastClient.Usage. -type ForecastClientUsageResponse struct { - QueryResult -} - -// GenerateDetailedCostReportClientCreateOperationResponse contains the response from method GenerateDetailedCostReportClient.CreateOperation. -type GenerateDetailedCostReportClientCreateOperationResponse struct { - GenerateDetailedCostReportOperationResult -} - -// GenerateDetailedCostReportOperationResultsClientGetResponse contains the response from method GenerateDetailedCostReportOperationResultsClient.Get. -type GenerateDetailedCostReportOperationResultsClientGetResponse struct { - GenerateDetailedCostReportOperationResult -} - -// GenerateDetailedCostReportOperationStatusClientGetResponse contains the response from method GenerateDetailedCostReportOperationStatusClient.Get. -type GenerateDetailedCostReportOperationStatusClientGetResponse struct { - GenerateDetailedCostReportOperationStatuses -} - -// GenerateReservationDetailsReportClientByBillingAccountIDResponse contains the response from method GenerateReservationDetailsReportClient.ByBillingAccountID. -type GenerateReservationDetailsReportClientByBillingAccountIDResponse struct { - OperationStatus -} - -// GenerateReservationDetailsReportClientByBillingProfileIDResponse contains the response from method GenerateReservationDetailsReportClient.ByBillingProfileID. -type GenerateReservationDetailsReportClientByBillingProfileIDResponse struct { - OperationStatus -} - -// OperationsClientListResponse contains the response from method OperationsClient.List. -type OperationsClientListResponse struct { - OperationListResult -} - -// QueryClientUsageByExternalCloudProviderTypeResponse contains the response from method QueryClient.UsageByExternalCloudProviderType. -type QueryClientUsageByExternalCloudProviderTypeResponse struct { - QueryResult -} - -// QueryClientUsageResponse contains the response from method QueryClient.Usage. -type QueryClientUsageResponse struct { - QueryResult -} - -// ViewsClientCreateOrUpdateByScopeResponse contains the response from method ViewsClient.CreateOrUpdateByScope. -type ViewsClientCreateOrUpdateByScopeResponse struct { - View -} - -// ViewsClientCreateOrUpdateResponse contains the response from method ViewsClient.CreateOrUpdate. -type ViewsClientCreateOrUpdateResponse struct { - View -} - -// ViewsClientDeleteByScopeResponse contains the response from method ViewsClient.DeleteByScope. -type ViewsClientDeleteByScopeResponse struct { - // placeholder for future response values -} - -// ViewsClientDeleteResponse contains the response from method ViewsClient.Delete. -type ViewsClientDeleteResponse struct { - // placeholder for future response values -} - -// ViewsClientGetByScopeResponse contains the response from method ViewsClient.GetByScope. -type ViewsClientGetByScopeResponse struct { - View -} - -// ViewsClientGetResponse contains the response from method ViewsClient.Get. -type ViewsClientGetResponse struct { - View -} - -// ViewsClientListByScopeResponse contains the response from method ViewsClient.ListByScope. -type ViewsClientListByScopeResponse struct { - ViewListResult -} - -// ViewsClientListResponse contains the response from method ViewsClient.List. -type ViewsClientListResponse struct { - ViewListResult -}