From 06791a622610183b237a411d2fd64cc29d7b7bd4 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 1 Nov 2022 03:56:24 +0000 Subject: [PATCH] CodeGen from PR 20958 in Azure/azure-rest-api-specs Merge 133feede74ce6f50c2a17798537de6d40a6495d9 into ddafcff4dae8cfbfd50b0af95ff65249932ce76b --- .../armcostmanagement/CHANGELOG.md | 271 + ...ated_alerts_client.go => alerts_client.go} | 17 +- .../armcostmanagement/autorest.md | 6 +- .../benefitrecommendations_client.go | 122 + .../benefitutilizationsummaries_client.go | 328 ++ ...zz_generated_constants.go => constants.go} | 438 +- ...ensions_client.go => dimensions_client.go} | 11 +- ...ed_exports_client.go => exports_client.go} | 29 +- ..._forecast_client.go => forecast_client.go} | 13 +- .../generatecostdetailsreport_client.go | 187 + ...o => generatedetailedcostreport_client.go} | 28 +- ...ailedcostreportoperationresults_client.go} | 61 +- ...tailedcostreportoperationstatus_client.go} | 18 +- ...eneratereservationdetailsreport_client.go} | 17 +- .../costmanagement/armcostmanagement/go.mod | 16 +- .../costmanagement/armcostmanagement/go.sum | 24 +- .../armcostmanagement/models.go | 2334 +++++++++ .../armcostmanagement/models_serde.go | 4482 +++++++++++++++++ ...rations_client.go => operations_client.go} | 6 +- .../armcostmanagement/polymorphic_helpers.go | 71 + .../armcostmanagement/pricesheet_client.go | 190 + ...erated_query_client.go => query_client.go} | 9 +- ...ed_response_types.go => response_types.go} | 110 +- .../scheduledactions_client.go | 712 +++ ...erated_time_rfc3339.go => time_rfc3339.go} | 1 + ...erated_views_client.go => views_client.go} | 35 +- ...ze_generated_example_alerts_client_test.go | 110 - ...enerated_example_dimensions_client_test.go | 76 - ...e_generated_example_exports_client_test.go | 182 - ..._generated_example_forecast_client_test.go | 141 - ..._generatedetailedcostreport_client_test.go | 47 - ...dcostreportoperationresults_client_test.go | 39 - ...edcostreportoperationstatus_client_test.go | 39 - ...atereservationdetailsreport_client_test.go | 9 - ...enerated_example_operations_client_test.go | 41 - .../ze_generated_example_query_client_test.go | 139 - .../ze_generated_example_views_client_test.go | 294 -- .../armcostmanagement/zz_generated_models.go | 1262 ----- .../zz_generated_models_serde.go | 612 --- 39 files changed, 9344 insertions(+), 3183 deletions(-) rename sdk/resourcemanager/costmanagement/armcostmanagement/{zz_generated_alerts_client.go => alerts_client.go} (97%) create mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/benefitrecommendations_client.go create mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/benefitutilizationsummaries_client.go rename sdk/resourcemanager/costmanagement/armcostmanagement/{zz_generated_constants.go => constants.go} (62%) rename sdk/resourcemanager/costmanagement/armcostmanagement/{zz_generated_dimensions_client.go => dimensions_client.go} (96%) rename sdk/resourcemanager/costmanagement/armcostmanagement/{zz_generated_exports_client.go => exports_client.go} (96%) rename sdk/resourcemanager/costmanagement/armcostmanagement/{zz_generated_forecast_client.go => forecast_client.go} (96%) create mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/generatecostdetailsreport_client.go rename sdk/resourcemanager/costmanagement/armcostmanagement/{zz_generated_generatedetailedcostreport_client.go => generatedetailedcostreport_client.go} (79%) rename sdk/resourcemanager/costmanagement/armcostmanagement/{zz_generated_generatedetailedcostreportoperationresults_client.go => generatedetailedcostreportoperationresults_client.go} (59%) rename sdk/resourcemanager/costmanagement/armcostmanagement/{zz_generated_generatedetailedcostreportoperationstatus_client.go => generatedetailedcostreportoperationstatus_client.go} (81%) rename sdk/resourcemanager/costmanagement/armcostmanagement/{zz_generated_generatereservationdetailsreport_client.go => generatereservationdetailsreport_client.go} (96%) create mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/models.go create mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/models_serde.go rename sdk/resourcemanager/costmanagement/armcostmanagement/{zz_generated_operations_client.go => operations_client.go} (96%) create mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/polymorphic_helpers.go create mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/pricesheet_client.go rename sdk/resourcemanager/costmanagement/armcostmanagement/{zz_generated_query_client.go => query_client.go} (97%) rename sdk/resourcemanager/costmanagement/armcostmanagement/{zz_generated_response_types.go => response_types.go} (54%) create mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/scheduledactions_client.go rename sdk/resourcemanager/costmanagement/armcostmanagement/{zz_generated_time_rfc3339.go => time_rfc3339.go} (99%) rename sdk/resourcemanager/costmanagement/armcostmanagement/{zz_generated_views_client.go => views_client.go} (96%) delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_alerts_client_test.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_dimensions_client_test.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_exports_client_test.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_forecast_client_test.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_generatedetailedcostreport_client_test.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_generatedetailedcostreportoperationresults_client_test.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_generatedetailedcostreportoperationstatus_client_test.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_generatereservationdetailsreport_client_test.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_operations_client_test.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_query_client_test.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/ze_generated_example_views_client_test.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_models.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_models_serde.go diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/CHANGELOG.md b/sdk/resourcemanager/costmanagement/armcostmanagement/CHANGELOG.md index 3bce11468810..c9e32020aab5 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/CHANGELOG.md +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/CHANGELOG.md @@ -1,5 +1,276 @@ # Release History +## 2.0.0 (2022-11-01) +### Breaking Changes + +- Type of `ForecastDefinition.TimePeriod` has been changed from `*QueryTimePeriod` to `*ForecastTimePeriod` +- Type of `ForecastDefinition.Timeframe` has been changed from `*ForecastTimeframeType` to `*ForecastTimeframe` +- Type of `ForecastDataset.Filter` has been changed from `*QueryFilter` to `*ForecastFilter` +- 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 `OperationListResult.Value` has been changed from `[]*Operation` to `[]*OperationForCostManagement` +- Type of `ExportExecutionListResult.Value` has been changed from `[]*ExportExecution` to `[]*ExportRun` +- Const `ForecastTimeframeTypeMonthToDate` has been removed +- Const `ForecastTimeframeTypeWeekToDate` has been removed +- Const `ForecastTimeframeTypeTheLastMonth` has been removed +- Const `ForecastTimeframeTypeBillingMonthToDate` has been removed +- Const `ForecastTimeframeTypeTheLastBillingMonth` has been removed +- Const `ForecastTimeframeTypeCustom` has been removed +- Type alias `ForecastTimeframeType` has been removed +- Function `PossibleForecastTimeframeTypeValues` has been removed +- Function `*GenerateDetailedCostReportOperationResultsClient.Get` has been removed +- Struct `ExportExecution` has been removed +- Struct `ExportExecutionProperties` has been removed +- Struct `GenerateDetailedCostReportOperationResultsClientGetOptions` has been removed +- Field `ID` of struct `Operation` 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 +- Field `ETag` of struct `Resource` has been removed +- Field `QueryResult` of struct `ForecastClientUsageResponse` has been removed +- Field `ETag` of struct `ProxyResource` has been removed +- Field `QueryResult` of struct `ForecastClientExternalCloudProviderUsageResponse` has been removed + +### Features Added + +- New const `ScheduledActionStatusExpired` +- New const `OriginUserSystem` +- New const `BenefitKindIncludedQuantity` +- New const `GrainParameterDaily` +- New const `ScheduleFrequencyWeekly` +- New const `GrainHourly` +- New const `ScheduleFrequencyDaily` +- New const `CheckNameAvailabilityReasonInvalid` +- New const `CostDetailsStatusTypeFailedCostDetailsStatusType` +- New const `TermP3Y` +- New const `ScheduledActionStatusEnabled` +- New const `WeeksOfMonthSecond` +- New const `CostDetailsStatusTypeNoDataFoundCostDetailsStatusType` +- New const `FileFormatCSV` +- New const `DaysOfWeekWednesday` +- New const `GrainDaily` +- New const `ActionTypeInternal` +- New const `GrainParameterMonthly` +- New const `WeeksOfMonthLast` +- New const `ForecastTimeframeCustom` +- New const `FunctionNameCost` +- New const `LookBackPeriodLast60Days` +- New const `GrainParameterHourly` +- New const `ScheduledActionKindEmail` +- New const `OriginUser` +- New const `OriginSystem` +- New const `CostDetailsDataFormatCSVCostDetailsDataFormat` +- New const `WeeksOfMonthThird` +- New const `ScheduledActionKindInsightAlert` +- New const `CostDetailsMetricTypeActualCostCostDetailsMetricType` +- New const `CostDetailsStatusTypeCompletedCostDetailsStatusType` +- New const `CreatedByTypeKey` +- New const `DaysOfWeekThursday` +- New const `FunctionNamePreTaxCost` +- New const `ScheduledActionStatusDisabled` +- New const `DaysOfWeekSunday` +- New const `BenefitKindReservation` +- New const `ForecastOperatorTypeIn` +- New const `GrainMonthly` +- New const `CreatedByTypeUser` +- New const `TermP1Y` +- New const `WeeksOfMonthFourth` +- New const `FunctionNameCostUSD` +- New const `CreatedByTypeApplication` +- New const `CostDetailsMetricTypeAmortizedCostCostDetailsMetricType` +- New const `DaysOfWeekSaturday` +- New const `CheckNameAvailabilityReasonAlreadyExists` +- New const `LookBackPeriodLast30Days` +- New const `LookBackPeriodLast7Days` +- New const `ScopeShared` +- New const `DaysOfWeekFriday` +- New const `BenefitKindSavingsPlan` +- New const `DaysOfWeekMonday` +- New const `DaysOfWeekTuesday` +- New const `FunctionNamePreTaxCostUSD` +- New const `CreatedByTypeManagedIdentity` +- New const `ScopeSingle` +- New const `WeeksOfMonthFirst` +- New const `ScheduleFrequencyMonthly` +- New type alias `ForecastTimeframe` +- New type alias `Origin` +- New type alias `ScheduleFrequency` +- New type alias `FunctionName` +- New type alias `ScheduledActionStatus` +- New type alias `Scope` +- New type alias `GrainParameter` +- New type alias `DaysOfWeek` +- New type alias `BenefitKind` +- New type alias `ScheduledActionKind` +- New type alias `CostDetailsDataFormat` +- New type alias `CheckNameAvailabilityReason` +- New type alias `ForecastOperatorType` +- New type alias `CostDetailsMetricType` +- New type alias `FileFormat` +- New type alias `CostDetailsStatusType` +- New type alias `Term` +- New type alias `CreatedByType` +- New type alias `Grain` +- New type alias `ActionType` +- New type alias `LookBackPeriod` +- New type alias `WeeksOfMonth` +- New function `*GenerateCostDetailsReportClient.BeginCreateOperation(context.Context, string, GenerateCostDetailsReportRequestDefinition, *GenerateCostDetailsReportClientBeginCreateOperationOptions) (*runtime.Poller[GenerateCostDetailsReportClientCreateOperationResponse], error)` +- New function `PossibleLookBackPeriodValues() []LookBackPeriod` +- New function `PossibleFunctionNameValues() []FunctionName` +- New function `*ScheduledActionsClient.DeleteByScope(context.Context, string, string, *ScheduledActionsClientDeleteByScopeOptions) (ScheduledActionsClientDeleteByScopeResponse, error)` +- New function `PossibleWeeksOfMonthValues() []WeeksOfMonth` +- New function `*ScheduledActionsClient.CheckNameAvailabilityByScope(context.Context, string, CheckNameAvailabilityRequest, *ScheduledActionsClientCheckNameAvailabilityByScopeOptions) (ScheduledActionsClientCheckNameAvailabilityByScopeResponse, error)` +- New function `*BenefitUtilizationSummariesClient.NewListByBillingProfileIDPager(string, string, *BenefitUtilizationSummariesClientListByBillingProfileIDOptions) *runtime.Pager[BenefitUtilizationSummariesClientListByBillingProfileIDResponse]` +- New function `PossibleForecastTimeframeValues() []ForecastTimeframe` +- New function `*ScheduledActionsClient.CreateOrUpdateByScope(context.Context, string, string, ScheduledAction, *ScheduledActionsClientCreateOrUpdateByScopeOptions) (ScheduledActionsClientCreateOrUpdateByScopeResponse, error)` +- New function `PossibleCostDetailsStatusTypeValues() []CostDetailsStatusType` +- New function `*SingleScopeBenefitRecommendationProperties.GetBenefitRecommendationProperties() *BenefitRecommendationProperties` +- New function `PossibleCostDetailsMetricTypeValues() []CostDetailsMetricType` +- New function `*PriceSheetClient.BeginDownloadByBillingProfile(context.Context, string, string, *PriceSheetClientBeginDownloadByBillingProfileOptions) (*runtime.Poller[PriceSheetClientDownloadByBillingProfileResponse], error)` +- New function `PossibleScheduledActionStatusValues() []ScheduledActionStatus` +- New function `*GenerateCostDetailsReportClient.BeginGetOperationResults(context.Context, string, string, *GenerateCostDetailsReportClientBeginGetOperationResultsOptions) (*runtime.Poller[GenerateCostDetailsReportClientGetOperationResultsResponse], error)` +- New function `*SavingsPlanUtilizationSummary.GetBenefitUtilizationSummary() *BenefitUtilizationSummary` +- New function `PossibleCostDetailsDataFormatValues() []CostDetailsDataFormat` +- New function `*ScheduledActionsClient.GetByScope(context.Context, string, string, *ScheduledActionsClientGetByScopeOptions) (ScheduledActionsClientGetByScopeResponse, error)` +- New function `*ScheduledActionsClient.NewListByScopePager(string, *ScheduledActionsClientListByScopeOptions) *runtime.Pager[ScheduledActionsClientListByScopeResponse]` +- New function `PossibleActionTypeValues() []ActionType` +- New function `NewGenerateCostDetailsReportClient(azcore.TokenCredential, *arm.ClientOptions) (*GenerateCostDetailsReportClient, error)` +- New function `*ScheduledActionsClient.Delete(context.Context, string, *ScheduledActionsClientDeleteOptions) (ScheduledActionsClientDeleteResponse, error)` +- New function `NewScheduledActionsClient(azcore.TokenCredential, *arm.ClientOptions) (*ScheduledActionsClient, error)` +- New function `*BenefitUtilizationSummariesClient.NewListByBillingAccountIDPager(string, *BenefitUtilizationSummariesClientListByBillingAccountIDOptions) *runtime.Pager[BenefitUtilizationSummariesClientListByBillingAccountIDResponse]` +- New function `PossibleBenefitKindValues() []BenefitKind` +- New function `*GenerateDetailedCostReportOperationResultsClient.BeginGet(context.Context, string, string, *GenerateDetailedCostReportOperationResultsClientBeginGetOptions) (*runtime.Poller[GenerateDetailedCostReportOperationResultsClientGetResponse], error)` +- New function `NewPriceSheetClient(azcore.TokenCredential, *arm.ClientOptions) (*PriceSheetClient, error)` +- New function `NewBenefitUtilizationSummariesClient(azcore.TokenCredential, *arm.ClientOptions) (*BenefitUtilizationSummariesClient, error)` +- New function `PossibleGrainParameterValues() []GrainParameter` +- New function `PossibleFileFormatValues() []FileFormat` +- New function `PossibleOriginValues() []Origin` +- New function `PossibleCreatedByTypeValues() []CreatedByType` +- New function `*BenefitUtilizationSummary.GetBenefitUtilizationSummary() *BenefitUtilizationSummary` +- New function `*IncludedQuantityUtilizationSummary.GetBenefitUtilizationSummary() *BenefitUtilizationSummary` +- New function `PossibleCheckNameAvailabilityReasonValues() []CheckNameAvailabilityReason` +- New function `*PriceSheetClient.BeginDownload(context.Context, string, string, string, *PriceSheetClientBeginDownloadOptions) (*runtime.Poller[PriceSheetClientDownloadResponse], error)` +- New function `*BenefitRecommendationsClient.NewListPager(string, *BenefitRecommendationsClientListOptions) *runtime.Pager[BenefitRecommendationsClientListResponse]` +- New function `*BenefitUtilizationSummariesClient.NewListBySavingsPlanIDPager(string, string, *BenefitUtilizationSummariesClientListBySavingsPlanIDOptions) *runtime.Pager[BenefitUtilizationSummariesClientListBySavingsPlanIDResponse]` +- New function `*SharedScopeBenefitRecommendationProperties.GetBenefitRecommendationProperties() *BenefitRecommendationProperties` +- New function `*ScheduledActionsClient.CreateOrUpdate(context.Context, string, ScheduledAction, *ScheduledActionsClientCreateOrUpdateOptions) (ScheduledActionsClientCreateOrUpdateResponse, error)` +- New function `*ScheduledActionsClient.Get(context.Context, string, *ScheduledActionsClientGetOptions) (ScheduledActionsClientGetResponse, error)` +- New function `*ScheduledActionsClient.CheckNameAvailability(context.Context, CheckNameAvailabilityRequest, *ScheduledActionsClientCheckNameAvailabilityOptions) (ScheduledActionsClientCheckNameAvailabilityResponse, error)` +- New function `*ScheduledActionsClient.RunByScope(context.Context, string, string, *ScheduledActionsClientRunByScopeOptions) (ScheduledActionsClientRunByScopeResponse, error)` +- New function `NewBenefitRecommendationsClient(azcore.TokenCredential, *arm.ClientOptions) (*BenefitRecommendationsClient, error)` +- New function `*ScheduledActionsClient.Run(context.Context, string, *ScheduledActionsClientRunOptions) (ScheduledActionsClientRunResponse, error)` +- New function `PossibleForecastOperatorTypeValues() []ForecastOperatorType` +- New function `PossibleGrainValues() []Grain` +- New function `PossibleScopeValues() []Scope` +- New function `*ScheduledActionsClient.NewListPager(*ScheduledActionsClientListOptions) *runtime.Pager[ScheduledActionsClientListResponse]` +- New function `PossibleScheduledActionKindValues() []ScheduledActionKind` +- New function `PossibleDaysOfWeekValues() []DaysOfWeek` +- New function `PossibleScheduleFrequencyValues() []ScheduleFrequency` +- New function `*BenefitRecommendationProperties.GetBenefitRecommendationProperties() *BenefitRecommendationProperties` +- New function `*BenefitUtilizationSummariesClient.NewListBySavingsPlanOrderPager(string, *BenefitUtilizationSummariesClientListBySavingsPlanOrderOptions) *runtime.Pager[BenefitUtilizationSummariesClientListBySavingsPlanOrderResponse]` +- New function `PossibleTermValues() []Term` +- New struct `AllSavingsBenefitDetails` +- New struct `AllSavingsList` +- New struct `BenefitRecommendationModel` +- New struct `BenefitRecommendationProperties` +- New struct `BenefitRecommendationsClient` +- New struct `BenefitRecommendationsClientListOptions` +- New struct `BenefitRecommendationsClientListResponse` +- New struct `BenefitRecommendationsListResult` +- New struct `BenefitResource` +- New struct `BenefitUtilizationSummariesClient` +- New struct `BenefitUtilizationSummariesClientListByBillingAccountIDOptions` +- New struct `BenefitUtilizationSummariesClientListByBillingAccountIDResponse` +- New struct `BenefitUtilizationSummariesClientListByBillingProfileIDOptions` +- New struct `BenefitUtilizationSummariesClientListByBillingProfileIDResponse` +- New struct `BenefitUtilizationSummariesClientListBySavingsPlanIDOptions` +- New struct `BenefitUtilizationSummariesClientListBySavingsPlanIDResponse` +- New struct `BenefitUtilizationSummariesClientListBySavingsPlanOrderOptions` +- New struct `BenefitUtilizationSummariesClientListBySavingsPlanOrderResponse` +- New struct `BenefitUtilizationSummariesListResult` +- New struct `BenefitUtilizationSummary` +- New struct `BenefitUtilizationSummaryProperties` +- New struct `BlobInfo` +- New struct `CheckNameAvailabilityRequest` +- New struct `CheckNameAvailabilityResponse` +- New struct `CostDetailsOperationResults` +- New struct `CostDetailsTimePeriod` +- New struct `ExportRun` +- New struct `ExportRunProperties` +- New struct `FileDestination` +- New struct `ForecastAggregation` +- New struct `ForecastColumn` +- New struct `ForecastComparisonExpression` +- New struct `ForecastDatasetConfiguration` +- New struct `ForecastFilter` +- New struct `ForecastProperties` +- New struct `ForecastResult` +- New struct `ForecastTimePeriod` +- New struct `GenerateCostDetailsReportClient` +- New struct `GenerateCostDetailsReportClientBeginCreateOperationOptions` +- New struct `GenerateCostDetailsReportClientBeginGetOperationResultsOptions` +- New struct `GenerateCostDetailsReportClientCreateOperationResponse` +- New struct `GenerateCostDetailsReportClientGetOperationResultsResponse` +- New struct `GenerateCostDetailsReportErrorResponse` +- New struct `GenerateCostDetailsReportRequestDefinition` +- New struct `GenerateDetailedCostReportOperationResultsClientBeginGetOptions` +- New struct `IncludedQuantityUtilizationSummary` +- New struct `IncludedQuantityUtilizationSummaryProperties` +- New struct `NotificationProperties` +- New struct `OperationForCostManagement` +- New struct `PriceSheetClient` +- New struct `PriceSheetClientBeginDownloadByBillingProfileOptions` +- New struct `PriceSheetClientBeginDownloadOptions` +- New struct `PriceSheetClientDownloadByBillingProfileResponse` +- New struct `PriceSheetClientDownloadResponse` +- 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 `ScheduledActionsClient` +- New struct `ScheduledActionsClientCheckNameAvailabilityByScopeOptions` +- New struct `ScheduledActionsClientCheckNameAvailabilityByScopeResponse` +- New struct `ScheduledActionsClientCheckNameAvailabilityOptions` +- New struct `ScheduledActionsClientCheckNameAvailabilityResponse` +- New struct `ScheduledActionsClientCreateOrUpdateByScopeOptions` +- New struct `ScheduledActionsClientCreateOrUpdateByScopeResponse` +- New struct `ScheduledActionsClientCreateOrUpdateOptions` +- New struct `ScheduledActionsClientCreateOrUpdateResponse` +- New struct `ScheduledActionsClientDeleteByScopeOptions` +- New struct `ScheduledActionsClientDeleteByScopeResponse` +- New struct `ScheduledActionsClientDeleteOptions` +- New struct `ScheduledActionsClientDeleteResponse` +- New struct `ScheduledActionsClientGetByScopeOptions` +- New struct `ScheduledActionsClientGetByScopeResponse` +- New struct `ScheduledActionsClientGetOptions` +- New struct `ScheduledActionsClientGetResponse` +- New struct `ScheduledActionsClientListByScopeOptions` +- New struct `ScheduledActionsClientListByScopeResponse` +- New struct `ScheduledActionsClientListOptions` +- New struct `ScheduledActionsClientListResponse` +- New struct `ScheduledActionsClientRunByScopeOptions` +- New struct `ScheduledActionsClientRunByScopeResponse` +- New struct `ScheduledActionsClientRunOptions` +- New struct `ScheduledActionsClientRunResponse` +- New struct `SharedScopeBenefitRecommendationProperties` +- New struct `SingleScopeBenefitRecommendationProperties` +- New struct `SystemData` +- New anonymous field `ForecastResult` in struct `ForecastClientUsageResponse` +- New field `IsDataAction` in struct `Operation` +- New field `Origin` in struct `Operation` +- New field `ActionType` in struct `Operation` +- New field `ExpiryTime` in struct `DownloadURL` +- New anonymous field `ForecastResult` in struct `ForecastClientExternalCloudProviderUsageResponse` + + ## 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 97% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_alerts_client.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/alerts_client.go index dbf434140de9..a2360e03961a 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 @@ -53,7 +54,7 @@ func NewAlertsClient(credential azcore.TokenCredential, options *arm.ClientOptio // Dismiss - Dismisses the specified alert // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-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 @@ -92,7 +93,7 @@ func (client *AlertsClient) dismissCreateRequest(ctx context.Context, scope stri return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -109,7 +110,7 @@ func (client *AlertsClient) dismissHandleResponse(resp *http.Response) (AlertsCl // Get - Gets the alert for the scope by alert ID. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-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 @@ -147,7 +148,7 @@ func (client *AlertsClient) getCreateRequest(ctx context.Context, scope string, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -164,7 +165,7 @@ func (client *AlertsClient) getHandleResponse(resp *http.Response) (AlertsClient // List - Lists the alerts for scope defined. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-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 @@ -200,7 +201,7 @@ func (client *AlertsClient) listCreateRequest(ctx context.Context, scope string, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -217,7 +218,7 @@ func (client *AlertsClient) listHandleResponse(resp *http.Response) (AlertsClien // ListExternal - Lists the Alerts for external cloud provider type defined. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-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 @@ -254,7 +255,7 @@ func (client *AlertsClient) listExternalCreateRequest(ctx context.Context, exter return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") 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..da31a4753629 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/autorest.md +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/cost-management/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/cost-management/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/cost-management/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 2.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/benefitrecommendations_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/benefitrecommendations_client.go new file mode 100644 index 000000000000..08e34aca9bb9 --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/benefitrecommendations_client.go @@ -0,0 +1,122 @@ +//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" + 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" + "strings" +) + +// BenefitRecommendationsClient contains the methods for the BenefitRecommendations group. +// Don't use this type directly, use NewBenefitRecommendationsClient() instead. +type BenefitRecommendationsClient struct { + host string + pl runtime.Pipeline +} + +// 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) { + 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 := &BenefitRecommendationsClient{ + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - List of recommendations for purchasing benefit (reservation or savings plan). +// Generated from API version 2022-10-01 +// billingScope - The scope associated with benefit recommendation details operations. This includes '/subscriptions/{subscriptionId}/' +// for subscription scope, +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' +// for BillingAccount scope, and +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile +// scope +// options - BenefitRecommendationsClientListOptions contains the optional parameters for the BenefitRecommendationsClient.List +// 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.pl.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.host, 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", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *BenefitRecommendationsClient) listHandleResponse(resp *http.Response) (BenefitRecommendationsClientListResponse, error) { + result := BenefitRecommendationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BenefitRecommendationsListResult); err != nil { + return BenefitRecommendationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/benefitutilizationsummaries_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/benefitutilizationsummaries_client.go new file mode 100644 index 000000000000..7044a1405e1a --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/benefitutilizationsummaries_client.go @@ -0,0 +1,328 @@ +//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" + 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" +) + +// BenefitUtilizationSummariesClient contains the methods for the BenefitUtilizationSummaries group. +// Don't use this type directly, use NewBenefitUtilizationSummariesClient() instead. +type BenefitUtilizationSummariesClient struct { + host string + pl runtime.Pipeline +} + +// 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) { + 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 := &BenefitUtilizationSummariesClient{ + host: ep, + pl: pl, + } + return client, nil +} + +// NewListByBillingAccountIDPager - Lists benefit utilization summaries for the provided billingAccount. This API provides +// benefit utilization summaries only for enrollment accounts. +// Generated from API version 2022-10-01 +// billingAccountID - Billing account ID +// options - BenefitUtilizationSummariesClientListByBillingAccountIDOptions contains the optional parameters for the BenefitUtilizationSummariesClient.ListByBillingAccountID +// 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.pl.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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + if options != nil && options.GrainParameter != nil { + reqQP.Set("grainParameter", string(*options.GrainParameter)) + } + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByBillingAccountIDHandleResponse handles the ListByBillingAccountID response. +func (client *BenefitUtilizationSummariesClient) listByBillingAccountIDHandleResponse(resp *http.Response) (BenefitUtilizationSummariesClientListByBillingAccountIDResponse, error) { + result := BenefitUtilizationSummariesClientListByBillingAccountIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BenefitUtilizationSummariesListResult); err != nil { + return BenefitUtilizationSummariesClientListByBillingAccountIDResponse{}, err + } + return result, nil +} + +// NewListByBillingProfileIDPager - Lists benefit utilization summaries for billingProfile. +// Generated from API version 2022-10-01 +// billingAccountID - Billing account ID +// billingProfileID - Billing profile ID. +// options - BenefitUtilizationSummariesClientListByBillingProfileIDOptions contains the optional parameters for the BenefitUtilizationSummariesClient.ListByBillingProfileID +// 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.pl.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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + if options != nil && options.GrainParameter != nil { + reqQP.Set("grainParameter", string(*options.GrainParameter)) + } + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByBillingProfileIDHandleResponse handles the ListByBillingProfileID response. +func (client *BenefitUtilizationSummariesClient) listByBillingProfileIDHandleResponse(resp *http.Response) (BenefitUtilizationSummariesClientListByBillingProfileIDResponse, error) { + result := BenefitUtilizationSummariesClientListByBillingProfileIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BenefitUtilizationSummariesListResult); err != nil { + return BenefitUtilizationSummariesClientListByBillingProfileIDResponse{}, err + } + return result, nil +} + +// NewListBySavingsPlanIDPager - Lists the savings plan utilization summaries for daily or monthly grain. +// Generated from API version 2022-10-01 +// savingsPlanOrderID - Savings plan order ID. +// savingsPlanID - Savings plan ID. +// options - BenefitUtilizationSummariesClientListBySavingsPlanIDOptions contains the optional parameters for the BenefitUtilizationSummariesClient.ListBySavingsPlanID +// 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.pl.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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.GrainParameter != nil { + reqQP.Set("grainParameter", string(*options.GrainParameter)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySavingsPlanIDHandleResponse handles the ListBySavingsPlanID response. +func (client *BenefitUtilizationSummariesClient) listBySavingsPlanIDHandleResponse(resp *http.Response) (BenefitUtilizationSummariesClientListBySavingsPlanIDResponse, error) { + result := BenefitUtilizationSummariesClientListBySavingsPlanIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BenefitUtilizationSummariesListResult); err != nil { + return BenefitUtilizationSummariesClientListBySavingsPlanIDResponse{}, err + } + return result, nil +} + +// NewListBySavingsPlanOrderPager - Lists the savings plan utilization summaries for daily or monthly grain. +// Generated from API version 2022-10-01 +// savingsPlanOrderID - Savings plan order ID. +// options - BenefitUtilizationSummariesClientListBySavingsPlanOrderOptions contains the optional parameters for the BenefitUtilizationSummariesClient.ListBySavingsPlanOrder +// 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.pl.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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.GrainParameter != nil { + reqQP.Set("grainParameter", string(*options.GrainParameter)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySavingsPlanOrderHandleResponse handles the ListBySavingsPlanOrder response. +func (client *BenefitUtilizationSummariesClient) listBySavingsPlanOrderHandleResponse(resp *http.Response) (BenefitUtilizationSummariesClientListBySavingsPlanOrderResponse, error) { + result := BenefitUtilizationSummariesClientListBySavingsPlanOrderResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BenefitUtilizationSummariesListResult); err != nil { + return BenefitUtilizationSummariesClientListBySavingsPlanOrderResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_constants.go b/sdk/resourcemanager/costmanagement/armcostmanagement/constants.go similarity index 62% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_constants.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/constants.go index 0ddb618dc87d..11843d3fa9fb 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_constants.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/constants.go @@ -5,12 +5,13 @@ // 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 = "v1.0.0" + moduleVersion = "v2.0.0" ) // AccumulatedType - Show costs accumulated over time. @@ -29,6 +30,20 @@ func PossibleAccumulatedTypeValues() []AccumulatedType { } } +// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + // AlertCategory - Alert category type AlertCategory string @@ -203,6 +218,27 @@ func PossibleAlertTypeValues() []AlertType { } } +// BenefitKind - Kind/type of the benefit. +type BenefitKind string + +const ( + // BenefitKindIncludedQuantity - Benefit is IncludedQuantity. + BenefitKindIncludedQuantity BenefitKind = "IncludedQuantity" + // BenefitKindReservation - Benefit is Reservation. + BenefitKindReservation BenefitKind = "Reservation" + // BenefitKindSavingsPlan - Benefit is SavingsPlan. + BenefitKindSavingsPlan BenefitKind = "SavingsPlan" +) + +// PossibleBenefitKindValues returns the possible values for the BenefitKind const type. +func PossibleBenefitKindValues() []BenefitKind { + return []BenefitKind{ + BenefitKindIncludedQuantity, + BenefitKindReservation, + BenefitKindSavingsPlan, + } +} + // ChartType - Chart type of the main view in Cost Analysis. Required. type ChartType string @@ -225,7 +261,123 @@ func PossibleChartTypeValues() []ChartType { } } -// ExecutionStatus - The last known status of the export execution. +// CheckNameAvailabilityReason - The reason why the given name is not available. +type CheckNameAvailabilityReason string + +const ( + CheckNameAvailabilityReasonAlreadyExists CheckNameAvailabilityReason = "AlreadyExists" + CheckNameAvailabilityReasonInvalid CheckNameAvailabilityReason = "Invalid" +) + +// PossibleCheckNameAvailabilityReasonValues returns the possible values for the CheckNameAvailabilityReason const type. +func PossibleCheckNameAvailabilityReasonValues() []CheckNameAvailabilityReason { + return []CheckNameAvailabilityReason{ + CheckNameAvailabilityReasonAlreadyExists, + CheckNameAvailabilityReasonInvalid, + } +} + +// CostDetailsDataFormat - The data format of the report +type CostDetailsDataFormat string + +const ( + // CostDetailsDataFormatCSVCostDetailsDataFormat - Csv data format. + CostDetailsDataFormatCSVCostDetailsDataFormat CostDetailsDataFormat = "Csv" +) + +// PossibleCostDetailsDataFormatValues returns the possible values for the CostDetailsDataFormat const type. +func PossibleCostDetailsDataFormatValues() []CostDetailsDataFormat { + return []CostDetailsDataFormat{ + CostDetailsDataFormatCSVCostDetailsDataFormat, + } +} + +// CostDetailsMetricType - The type of the detailed report. By default ActualCost is provided +type CostDetailsMetricType string + +const ( + // CostDetailsMetricTypeActualCostCostDetailsMetricType - Actual cost data. + CostDetailsMetricTypeActualCostCostDetailsMetricType CostDetailsMetricType = "ActualCost" + // CostDetailsMetricTypeAmortizedCostCostDetailsMetricType - Amortized cost data. + CostDetailsMetricTypeAmortizedCostCostDetailsMetricType CostDetailsMetricType = "AmortizedCost" +) + +// PossibleCostDetailsMetricTypeValues returns the possible values for the CostDetailsMetricType const type. +func PossibleCostDetailsMetricTypeValues() []CostDetailsMetricType { + return []CostDetailsMetricType{ + CostDetailsMetricTypeActualCostCostDetailsMetricType, + CostDetailsMetricTypeAmortizedCostCostDetailsMetricType, + } +} + +// CostDetailsStatusType - The status of the cost details operation +type CostDetailsStatusType string + +const ( + // CostDetailsStatusTypeCompletedCostDetailsStatusType - Operation is Completed. + CostDetailsStatusTypeCompletedCostDetailsStatusType CostDetailsStatusType = "Completed" + // CostDetailsStatusTypeFailedCostDetailsStatusType - Operation Failed. + CostDetailsStatusTypeFailedCostDetailsStatusType CostDetailsStatusType = "Failed" + // CostDetailsStatusTypeNoDataFoundCostDetailsStatusType - Operation is Completed and no cost data found. + CostDetailsStatusTypeNoDataFoundCostDetailsStatusType CostDetailsStatusType = "NoDataFound" +) + +// PossibleCostDetailsStatusTypeValues returns the possible values for the CostDetailsStatusType const type. +func PossibleCostDetailsStatusTypeValues() []CostDetailsStatusType { + return []CostDetailsStatusType{ + CostDetailsStatusTypeCompletedCostDetailsStatusType, + CostDetailsStatusTypeFailedCostDetailsStatusType, + CostDetailsStatusTypeNoDataFoundCostDetailsStatusType, + } +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// DaysOfWeek - Days of Week. +type DaysOfWeek string + +const ( + DaysOfWeekFriday DaysOfWeek = "Friday" + DaysOfWeekMonday DaysOfWeek = "Monday" + DaysOfWeekSaturday DaysOfWeek = "Saturday" + DaysOfWeekSunday DaysOfWeek = "Sunday" + DaysOfWeekThursday DaysOfWeek = "Thursday" + DaysOfWeekTuesday DaysOfWeek = "Tuesday" + DaysOfWeekWednesday DaysOfWeek = "Wednesday" +) + +// PossibleDaysOfWeekValues returns the possible values for the DaysOfWeek const type. +func PossibleDaysOfWeekValues() []DaysOfWeek { + return []DaysOfWeek{ + DaysOfWeekFriday, + DaysOfWeekMonday, + DaysOfWeekSaturday, + DaysOfWeekSunday, + DaysOfWeekThursday, + DaysOfWeekTuesday, + DaysOfWeekWednesday, + } +} + +// ExecutionStatus - The last known status of the export run. type ExecutionStatus string const ( @@ -251,7 +403,7 @@ func PossibleExecutionStatusValues() []ExecutionStatus { } } -// ExecutionType - The type of the export execution. +// ExecutionType - The type of the export run. type ExecutionType string const ( @@ -267,8 +419,7 @@ func PossibleExecutionTypeValues() []ExecutionType { } } -// 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. +// ExportType - The type of the query. type ExportType string const ( @@ -301,28 +452,45 @@ func PossibleExternalCloudProviderTypeValues() []ExternalCloudProviderType { } } -// ForecastTimeframeType - The time frame for pulling data for the forecast. If custom, then a specific time period must be -// provided. -type ForecastTimeframeType string +// FileFormat - Destination of the view data. Currently only CSV format is supported. +type FileFormat string const ( - ForecastTimeframeTypeBillingMonthToDate ForecastTimeframeType = "BillingMonthToDate" - ForecastTimeframeTypeCustom ForecastTimeframeType = "Custom" - ForecastTimeframeTypeMonthToDate ForecastTimeframeType = "MonthToDate" - ForecastTimeframeTypeTheLastBillingMonth ForecastTimeframeType = "TheLastBillingMonth" - ForecastTimeframeTypeTheLastMonth ForecastTimeframeType = "TheLastMonth" - ForecastTimeframeTypeWeekToDate ForecastTimeframeType = "WeekToDate" + FileFormatCSV FileFormat = "Csv" ) -// PossibleForecastTimeframeTypeValues returns the possible values for the ForecastTimeframeType const type. -func PossibleForecastTimeframeTypeValues() []ForecastTimeframeType { - return []ForecastTimeframeType{ - ForecastTimeframeTypeBillingMonthToDate, - ForecastTimeframeTypeCustom, - ForecastTimeframeTypeMonthToDate, - ForecastTimeframeTypeTheLastBillingMonth, - ForecastTimeframeTypeTheLastMonth, - ForecastTimeframeTypeWeekToDate, +// 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, } } @@ -358,6 +526,26 @@ func PossibleFormatTypeValues() []FormatType { } } +// FunctionName - The name of the column to aggregate. +type FunctionName string + +const ( + FunctionNameCost FunctionName = "Cost" + FunctionNameCostUSD FunctionName = "CostUSD" + FunctionNamePreTaxCost FunctionName = "PreTaxCost" + FunctionNamePreTaxCostUSD FunctionName = "PreTaxCostUSD" +) + +// PossibleFunctionNameValues returns the possible values for the FunctionName const type. +func PossibleFunctionNameValues() []FunctionName { + return []FunctionName{ + FunctionNameCost, + FunctionNameCostUSD, + FunctionNamePreTaxCost, + FunctionNamePreTaxCostUSD, + } +} + // FunctionType - The name of the aggregation function to use. type FunctionType string @@ -388,7 +576,48 @@ func PossibleGenerateDetailedCostReportMetricTypeValues() []GenerateDetailedCost } } -// GranularityType - The granularity of rows in the export. Currently only 'Daily' is supported. +// 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 forecast. type GranularityType string const ( @@ -418,6 +647,27 @@ func PossibleKpiTypeValues() []KpiType { } } +// LookBackPeriod - The number of days used to look back. +type LookBackPeriod string + +const ( + // LookBackPeriodLast30Days - 30 days used to look back. + LookBackPeriodLast30Days LookBackPeriod = "Last30Days" + // LookBackPeriodLast60Days - 60 days used to look back. + LookBackPeriodLast60Days LookBackPeriod = "Last60Days" + // LookBackPeriodLast7Days - 7 days used to look back. + LookBackPeriodLast7Days LookBackPeriod = "Last7Days" +) + +// PossibleLookBackPeriodValues returns the possible values for the LookBackPeriod const type. +func PossibleLookBackPeriodValues() []LookBackPeriod { + return []LookBackPeriod{ + LookBackPeriodLast30Days, + LookBackPeriodLast60Days, + LookBackPeriodLast7Days, + } +} + // MetricType - Metric to use when displaying costs. type MetricType string @@ -470,6 +720,25 @@ func PossibleOperatorTypeValues() []OperatorType { } } +// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type Origin string + +const ( + OriginSystem Origin = "system" + OriginUser Origin = "user" + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + // PivotType - Data type to show in view. type PivotType string @@ -681,6 +950,85 @@ func PossibleReservationReportSchemaValues() []ReservationReportSchema { } } +// ScheduleFrequency - Frequency of the schedule. +type ScheduleFrequency string + +const ( + // ScheduleFrequencyDaily - Cost analysis data will be emailed every day. + ScheduleFrequencyDaily ScheduleFrequency = "Daily" + // ScheduleFrequencyMonthly - Cost analysis data will be emailed every month. + ScheduleFrequencyMonthly ScheduleFrequency = "Monthly" + // ScheduleFrequencyWeekly - Cost analysis data will be emailed every week. + ScheduleFrequencyWeekly ScheduleFrequency = "Weekly" +) + +// PossibleScheduleFrequencyValues returns the possible values for the ScheduleFrequency const type. +func PossibleScheduleFrequencyValues() []ScheduleFrequency { + return []ScheduleFrequency{ + ScheduleFrequencyDaily, + ScheduleFrequencyMonthly, + ScheduleFrequencyWeekly, + } +} + +// ScheduledActionKind - Kind of the scheduled action. +type ScheduledActionKind string + +const ( + // ScheduledActionKindEmail - Cost analysis data will be emailed. + ScheduledActionKindEmail ScheduledActionKind = "Email" + // ScheduledActionKindInsightAlert - Cost anomaly information will be emailed. Available only on subscription scope at daily + // frequency. If no anomaly is detected on the resource, an email won't be sent. + ScheduledActionKindInsightAlert ScheduledActionKind = "InsightAlert" +) + +// PossibleScheduledActionKindValues returns the possible values for the ScheduledActionKind const type. +func PossibleScheduledActionKindValues() []ScheduledActionKind { + return []ScheduledActionKind{ + ScheduledActionKindEmail, + ScheduledActionKindInsightAlert, + } +} + +// ScheduledActionStatus - Status of the scheduled action. +type ScheduledActionStatus string + +const ( + // ScheduledActionStatusDisabled - Scheduled action is saved but will not be run. + ScheduledActionStatusDisabled ScheduledActionStatus = "Disabled" + // ScheduledActionStatusEnabled - Scheduled action is saved and will be run. + ScheduledActionStatusEnabled ScheduledActionStatus = "Enabled" + // ScheduledActionStatusExpired - Scheduled action is expired. + ScheduledActionStatusExpired ScheduledActionStatus = "Expired" +) + +// PossibleScheduledActionStatusValues returns the possible values for the ScheduledActionStatus const type. +func PossibleScheduledActionStatusValues() []ScheduledActionStatus { + return []ScheduledActionStatus{ + ScheduledActionStatusDisabled, + ScheduledActionStatusEnabled, + ScheduledActionStatusExpired, + } +} + +// Scope - Kind of the recommendation scope. +type Scope string + +const ( + // ScopeShared - Shared scope recommendation. + ScopeShared Scope = "Shared" + // ScopeSingle - Single scope recommendation. + ScopeSingle Scope = "Single" +) + +// PossibleScopeValues returns the possible values for the Scope const type. +func PossibleScopeValues() []Scope { + return []Scope{ + ScopeShared, + ScopeSingle, + } +} + // StatusType - The status of the export's schedule. If 'Inactive', the export's schedule is paused. type StatusType string @@ -697,7 +1045,25 @@ func PossibleStatusTypeValues() []StatusType { } } -// TimeframeType - The time frame for pulling data for the export. If custom, then a specific time period must be provided. +// Term - Grain which corresponds to value. +type Term string + +const ( + // TermP1Y - Benefit term is 1 year. + TermP1Y Term = "P1Y" + // TermP3Y - Benefit term is 3 years. + TermP3Y Term = "P3Y" +) + +// PossibleTermValues returns the possible values for the Term const type. +func PossibleTermValues() []Term { + return []Term{ + TermP1Y, + TermP3Y, + } +} + +// TimeframeType - The time frame for pulling data for the query. If custom, then a specific time period must be provided. type TimeframeType string const ( @@ -720,3 +1086,25 @@ func PossibleTimeframeTypeValues() []TimeframeType { TimeframeTypeWeekToDate, } } + +// WeeksOfMonth - Weeks of month. +type WeeksOfMonth string + +const ( + WeeksOfMonthFirst WeeksOfMonth = "First" + WeeksOfMonthFourth WeeksOfMonth = "Fourth" + WeeksOfMonthLast WeeksOfMonth = "Last" + WeeksOfMonthSecond WeeksOfMonth = "Second" + WeeksOfMonthThird WeeksOfMonth = "Third" +) + +// PossibleWeeksOfMonthValues returns the possible values for the WeeksOfMonth const type. +func PossibleWeeksOfMonthValues() []WeeksOfMonth { + return []WeeksOfMonth{ + WeeksOfMonthFirst, + WeeksOfMonthFourth, + WeeksOfMonthLast, + WeeksOfMonthSecond, + WeeksOfMonthThird, + } +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_dimensions_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/dimensions_client.go similarity index 96% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_dimensions_client.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/dimensions_client.go index 7e46848abf84..1f041d849946 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 @@ -53,8 +54,7 @@ func NewDimensionsClient(credential azcore.TokenCredential, options *arm.ClientO } // 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 +// Generated from API version 2022-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 @@ -99,7 +99,7 @@ func (client *DimensionsClient) byExternalCloudProviderTypeCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -127,8 +127,7 @@ 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 +// Generated from API version 2022-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, @@ -171,7 +170,7 @@ func (client *DimensionsClient) listCreateRequest(ctx context.Context, scope str return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") 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 96% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_exports_client.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/exports_client.go index d830dd68ce7e..165e5da41aed 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 @@ -55,7 +56,7 @@ 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 +// Generated from API version 2022-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 @@ -97,7 +98,7 @@ func (client *ExportsClient) createOrUpdateCreateRequest(ctx context.Context, sc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -114,7 +115,7 @@ func (client *ExportsClient) createOrUpdateHandleResponse(resp *http.Response) ( // Delete - The operation to delete a export. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-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 @@ -155,15 +156,15 @@ func (client *ExportsClient) deleteCreateRequest(ctx context.Context, scope stri return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// Execute - The operation to execute an export. +// Execute - The operation to run an export. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-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 @@ -204,7 +205,7 @@ func (client *ExportsClient) executeCreateRequest(ctx context.Context, scope str return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -212,7 +213,7 @@ func (client *ExportsClient) executeCreateRequest(ctx context.Context, scope str // Get - The operation to get the export for the defined scope by export name. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-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 @@ -253,7 +254,7 @@ func (client *ExportsClient) getCreateRequest(ctx context.Context, scope string, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -271,9 +272,9 @@ func (client *ExportsClient) getHandleResponse(resp *http.Response) (ExportsClie return result, nil } -// GetExecutionHistory - The operation to get the execution history of an export for the defined scope and export name. +// GetExecutionHistory - The operation to get the run history of an export for the defined scope and export name. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-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 @@ -315,7 +316,7 @@ func (client *ExportsClient) getExecutionHistoryCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -332,7 +333,7 @@ func (client *ExportsClient) getExecutionHistoryHandleResponse(resp *http.Respon // List - The operation to list all exports at the given scope. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-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 @@ -368,7 +369,7 @@ func (client *ExportsClient) listCreateRequest(ctx context.Context, scope string return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") 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 96% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_forecast_client.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/forecast_client.go index f55d42df15fb..910c54e8d2a6 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 @@ -53,7 +54,7 @@ func NewForecastClient(credential azcore.TokenCredential, options *arm.ClientOpt // ExternalCloudProviderUsage - Lists the forecast charges for external cloud provider type defined. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-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 @@ -95,7 +96,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", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -104,7 +105,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,7 +113,7 @@ func (client *ForecastClient) externalCloudProviderUsageHandleResponse(resp *htt // Usage - Lists the forecast charges for scope defined. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-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 @@ -152,7 +153,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", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -161,7 +162,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..83022a5fe792 --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/generatecostdetailsreport_client.go @@ -0,0 +1,187 @@ +//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" + 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" +) + +// GenerateCostDetailsReportClient contains the methods for the GenerateCostDetailsReport group. +// Don't use this type directly, use NewGenerateCostDetailsReportClient() instead. +type GenerateCostDetailsReportClient struct { + host string + pl runtime.Pipeline +} + +// 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) { + 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 := &GenerateCostDetailsReportClient{ + host: ep, + pl: pl, + } + 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 2022-10-01 +// scope - The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see +// https://aka.ms/costmgmt/scopes. +// parameters - Parameters supplied to the Create cost details operation. +// options - GenerateCostDetailsReportClientBeginCreateOperationOptions contains the optional parameters for the GenerateCostDetailsReportClient.BeginCreateOperation +// method. +func (client *GenerateCostDetailsReportClient) BeginCreateOperation(ctx context.Context, scope string, parameters GenerateCostDetailsReportRequestDefinition, options *GenerateCostDetailsReportClientBeginCreateOperationOptions) (*runtime.Poller[GenerateCostDetailsReportClientCreateOperationResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOperation(ctx, scope, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[GenerateCostDetailsReportClientCreateOperationResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[GenerateCostDetailsReportClientCreateOperationResponse](options.ResumeToken, client.pl, 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 2022-10-01 +func (client *GenerateCostDetailsReportClient) createOperation(ctx context.Context, scope string, parameters GenerateCostDetailsReportRequestDefinition, options *GenerateCostDetailsReportClientBeginCreateOperationOptions) (*http.Response, error) { + req, err := client.createOperationCreateRequest(ctx, scope, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginGetOperationResults - Get the result of the specified operation. This link is provided in the CostDetails creation +// request response Location header. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-10-01 +// scope - The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see +// https://aka.ms/costmgmt/scopes. +// operationID - The target operation Id. +// options - GenerateCostDetailsReportClientBeginGetOperationResultsOptions contains the optional parameters for the GenerateCostDetailsReportClient.BeginGetOperationResults +// method. +func (client *GenerateCostDetailsReportClient) BeginGetOperationResults(ctx context.Context, scope string, operationID string, options *GenerateCostDetailsReportClientBeginGetOperationResultsOptions) (*runtime.Poller[GenerateCostDetailsReportClientGetOperationResultsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.getOperationResults(ctx, scope, operationID, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[GenerateCostDetailsReportClientGetOperationResultsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[GenerateCostDetailsReportClientGetOperationResultsResponse](options.ResumeToken, client.pl, 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 2022-10-01 +func (client *GenerateCostDetailsReportClient) getOperationResults(ctx context.Context, scope string, operationID string, options *GenerateCostDetailsReportClientBeginGetOperationResultsOptions) (*http.Response, error) { + req, err := client.getOperationResultsCreateRequest(ctx, scope, operationID, options) + if err != nil { + return nil, err + } + resp, err := client.pl.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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + 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 79% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreport_client.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreport_client.go index a5f4fa2be155..83fe2f456fff 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 @@ -49,24 +50,15 @@ func NewGenerateDetailedCostReportClient(credential azcore.TokenCredential, opti return client, nil } -// BeginCreateOperation - Generates the detailed cost report for provided date range, billing period(Only enterprise customers) -// or Invoice Id asynchronously at a certain scope. Call returns a 202 with header +// BeginCreateOperation - Generates the detailed cost report for provided date range, billing period(only enterprise customers) +// or Invoice ID asynchronously at a certain scope. Call returns a 202 with header // Azure-Consumption-AsyncOperation providing a link to the operation created. A call on the operation will provide the status // and if the operation is completed the blob file where generated detailed // cost report is being stored. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// scope - The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for -// Billing Account scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount -// scope. Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for billingAccount -// scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile -// scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. +// Generated from API version 2022-10-01 +// scope - The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see +// https://aka.ms/costmgmt/scopes. // parameters - Parameters supplied to the Create detailed cost report operation. // options - GenerateDetailedCostReportClientBeginCreateOperationOptions contains the optional parameters for the GenerateDetailedCostReportClient.BeginCreateOperation // method. @@ -84,13 +76,13 @@ func (client *GenerateDetailedCostReportClient) BeginCreateOperation(ctx context } } -// CreateOperation - Generates the detailed cost report for provided date range, billing period(Only enterprise customers) -// or Invoice Id asynchronously at a certain scope. Call returns a 202 with header +// CreateOperation - Generates the detailed cost report for provided date range, billing period(only enterprise customers) +// or Invoice ID asynchronously at a certain scope. Call returns a 202 with header // Azure-Consumption-AsyncOperation providing a link to the operation created. A call on the operation will provide the status // and if the operation is completed the blob file where generated detailed // cost report is being stored. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-10-01 func (client *GenerateDetailedCostReportClient) createOperation(ctx context.Context, scope string, parameters GenerateDetailedCostReportDefinition, options *GenerateDetailedCostReportClientBeginCreateOperationOptions) (*http.Response, error) { req, err := client.createOperationCreateRequest(ctx, scope, parameters, options) if err != nil { @@ -115,7 +107,7 @@ func (client *GenerateDetailedCostReportClient) createOperationCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreportoperationresults_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreportoperationresults_client.go similarity index 59% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreportoperationresults_client.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreportoperationresults_client.go index 3a2fbfb7216f..a241e03042de 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreportoperationresults_client.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreportoperationresults_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 @@ -51,41 +52,48 @@ func NewGenerateDetailedCostReportOperationResultsClient(credential azcore.Token return client, nil } -// Get - Get the result of the specified operation. This link is provided in the GenerateDetailedCostReport creation request -// response header. +// BeginGet - Gets the result of the specified operation. The link with this operationId is provided as a response header +// of the initial request. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-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 +// scope - The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see +// https://aka.ms/costmgmt/scopes. +// options - GenerateDetailedCostReportOperationResultsClientBeginGetOptions contains the optional parameters for the GenerateDetailedCostReportOperationResultsClient.BeginGet // method. -func (client *GenerateDetailedCostReportOperationResultsClient) Get(ctx context.Context, operationID string, scope string, options *GenerateDetailedCostReportOperationResultsClientGetOptions) (GenerateDetailedCostReportOperationResultsClientGetResponse, error) { +func (client *GenerateDetailedCostReportOperationResultsClient) BeginGet(ctx context.Context, operationID string, scope string, options *GenerateDetailedCostReportOperationResultsClientBeginGetOptions) (*runtime.Poller[GenerateDetailedCostReportOperationResultsClientGetResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.get(ctx, operationID, scope, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[GenerateDetailedCostReportOperationResultsClientGetResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[GenerateDetailedCostReportOperationResultsClientGetResponse](options.ResumeToken, client.pl, 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 2022-10-01 +func (client *GenerateDetailedCostReportOperationResultsClient) get(ctx context.Context, operationID string, scope string, options *GenerateDetailedCostReportOperationResultsClientBeginGetOptions) (*http.Response, error) { req, err := client.getCreateRequest(ctx, operationID, scope, options) if err != nil { - return GenerateDetailedCostReportOperationResultsClientGetResponse{}, err + return nil, err } resp, err := client.pl.Do(req) if err != nil { - return GenerateDetailedCostReportOperationResultsClientGetResponse{}, err + return nil, err } if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return GenerateDetailedCostReportOperationResultsClientGetResponse{}, runtime.NewResponseError(resp) + return nil, runtime.NewResponseError(resp) } - return client.getHandleResponse(resp) + return resp, nil } // getCreateRequest creates the Get request. -func (client *GenerateDetailedCostReportOperationResultsClient) getCreateRequest(ctx context.Context, operationID string, scope string, options *GenerateDetailedCostReportOperationResultsClientGetOptions) (*policy.Request, error) { +func (client *GenerateDetailedCostReportOperationResultsClient) getCreateRequest(ctx context.Context, operationID string, scope string, options *GenerateDetailedCostReportOperationResultsClientBeginGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.CostManagement/operationResults/{operationId}" if operationID == "" { return nil, errors.New("parameter operationID cannot be empty") @@ -97,17 +105,8 @@ func (client *GenerateDetailedCostReportOperationResultsClient) getCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-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_generatedetailedcostreportoperationstatus_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreportoperationstatus_client.go similarity index 81% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreportoperationstatus_client.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/generatedetailedcostreportoperationstatus_client.go index a6e6d8cf7ec2..49ebec5f0389 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 @@ -54,19 +55,10 @@ 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 +// Generated from API version 2022-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. +// 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) { @@ -97,7 +89,7 @@ func (client *GenerateDetailedCostReportOperationStatusClient) getCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") 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 96% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatereservationdetailsreport_client.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/generatereservationdetailsreport_client.go index c7670ad08511..8335b16bd7be 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 @@ -55,7 +56,7 @@ 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 +// Generated from API version 2022-10-01 // billingAccountID - Enrollment ID (Legacy BillingAccount ID) // startDate - Start Date // endDate - End Date @@ -79,7 +80,7 @@ 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 2022-10-01 func (client *GenerateReservationDetailsReportClient) byBillingAccountID(ctx context.Context, billingAccountID string, startDate string, endDate string, options *GenerateReservationDetailsReportClientBeginByBillingAccountIDOptions) (*http.Response, error) { req, err := client.byBillingAccountIDCreateRequest(ctx, billingAccountID, startDate, endDate, options) if err != nil { @@ -109,7 +110,7 @@ func (client *GenerateReservationDetailsReportClient) byBillingAccountIDCreateRe reqQP := req.Raw().URL.Query() reqQP.Set("startDate", startDate) reqQP.Set("endDate", endDate) - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -119,9 +120,9 @@ 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 +// Generated from API version 2022-10-01 +// billingAccountID - Billing account ID +// billingProfileID - Billing profile ID. // startDate - Start Date // endDate - End Date // options - GenerateReservationDetailsReportClientBeginByBillingProfileIDOptions contains the optional parameters for the @@ -144,7 +145,7 @@ 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 2022-10-01 func (client *GenerateReservationDetailsReportClient) byBillingProfileID(ctx context.Context, billingAccountID string, billingProfileID string, startDate string, endDate string, options *GenerateReservationDetailsReportClientBeginByBillingProfileIDOptions) (*http.Response, error) { req, err := client.byBillingProfileIDCreateRequest(ctx, billingAccountID, billingProfileID, startDate, endDate, options) if err != nil { @@ -178,7 +179,7 @@ func (client *GenerateReservationDetailsReportClient) byBillingProfileIDCreateRe reqQP := req.Raw().URL.Query() reqQP.Set("startDate", startDate) reqQP.Set("endDate", endDate) - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") 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..6c6a4a6c9f04 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.0.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 + github.com/davecgh/go-spew v1.1.1 // 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 + 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..3afb578030a5 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/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= +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..c846485c6068 --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/models.go @@ -0,0 +1,2334 @@ +//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 []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"` +} + +// AllSavingsBenefitDetails - The properties of the benefit plan recommendation details for a saving. +type AllSavingsBenefitDetails struct { + // READ-ONLY; Estimated average utilization percentage at this commitment. + AverageUtilizationPercentage *float64 `json:"averageUtilizationPercentage,omitempty" azure:"ro"` + + // READ-ONLY; The exact cost of the estimated usage using plan. It's equal to (commitmentAmount * totalHours) + BenefitCost *float64 `json:"benefitCost,omitempty" azure:"ro"` + + // READ-ONLY; The commitment amount for the benefit. + CommitmentAmount *float64 `json:"commitmentAmount,omitempty" azure:"ro"` + + // READ-ONLY; Expected coverage at this commitment. + CoveragePercentage *float64 `json:"coveragePercentage,omitempty" azure:"ro"` + + // READ-ONLY; The difference between total cost and benefit cost. + OverageCost *float64 `json:"overageCost,omitempty" azure:"ro"` + + // READ-ONLY; The amount saved by purchasing the recommended quantity of benefit. + SavingsAmount *float64 `json:"savingsAmount,omitempty" azure:"ro"` + + // READ-ONLY; The savings in percentage by purchasing the recommended quantity of benefit. + SavingsPercentage *float64 `json:"savingsPercentage,omitempty" azure:"ro"` + + // READ-ONLY; The cost of the suggested commitment. + TotalCost *float64 `json:"totalCost,omitempty" azure:"ro"` + + // READ-ONLY; Wastage cost at this commitment. + WastageCost *float64 `json:"wastageCost,omitempty" azure:"ro"` +} + +// AllSavingsList - Result of listing benefit recommendations. +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. + 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 plan recommendation. + 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 plan recommendation. +type BenefitRecommendationProperties struct { + // REQUIRED; Scope of the benefit. For example, Single or Shared. + Scope *Scope `json:"scope,omitempty"` + + // Grain of the proposed commitment amount. For example, hourly, monthly etc. + CommitmentGranularity *Grain `json:"commitmentGranularity,omitempty"` + + // The number of days of usage used to look back for computing the recommendation. + 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"` + + // The additional details about the usage which are considered while computing benefit recommendations. + Usage *RecommendationUsageDetails `json:"usage,omitempty"` + + // READ-ONLY; The list of all benefit recommendations. + AllRecommendationDetails *AllSavingsList `json:"allRecommendationDetails,omitempty" azure:"ro"` + + // READ-ONLY; ARM SKU name. For example, StandardD1V2 for Reservations and ComputeSavingsPlan for SavingsPlan. + ArmSKUName *string `json:"armSkuName,omitempty" azure:"ro"` + + // READ-ONLY; The current cost without benefit corresponds to 'totalHours' property in a given 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 recommendation. + FirstConsumptionDate *time.Time `json:"firstConsumptionDate,omitempty" azure:"ro"` + + // READ-ONLY; The last usage date used for looking back for computing the recommendation. + 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.List 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'; kind with default value 'SavingsPlan'; properties/armSkuName + // with allowed values ['Compute', 'SQL'] - if mentioned kind SavingsPlan is applied implicitly; properties/subscriptionId; + // properties/resourceGroup + Filter *string + // May be used to order the recommendations by: properties/armSkuName. This implicitly filters the results by the corresponding + // benefit type. + 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.ListByBillingAccountID +// method. +type BenefitUtilizationSummariesClientListByBillingAccountIDOptions struct { + // Supports filtering by properties/benefitType, properties/benefitId, properties/benefitOrderId and properties/usageDate. + // properties/benefitType is defaulted to savingsPlan. + Filter *string + // Daily or monthly grain. + GrainParameter *GrainParameter +} + +// BenefitUtilizationSummariesClientListByBillingProfileIDOptions contains the optional parameters for the BenefitUtilizationSummariesClient.ListByBillingProfileID +// method. +type BenefitUtilizationSummariesClientListByBillingProfileIDOptions struct { + // Supports filtering by properties/benefitType, properties/benefitId, properties/benefitOrderId and properties/usageDate. + // properties/benefitType is defaulted to savingsPlan. + Filter *string + // Daily or monthly grain. + GrainParameter *GrainParameter +} + +// BenefitUtilizationSummariesClientListBySavingsPlanIDOptions contains the optional parameters for the BenefitUtilizationSummariesClient.ListBySavingsPlanID +// method. +type BenefitUtilizationSummariesClientListBySavingsPlanIDOptions struct { + // Supports filtering by properties/usageDate. + Filter *string + // Daily or monthly grain. + GrainParameter *GrainParameter +} + +// BenefitUtilizationSummariesClientListBySavingsPlanOrderOptions contains the optional parameters for the BenefitUtilizationSummariesClient.ListBySavingsPlanOrder +// method. +type BenefitUtilizationSummariesClientListBySavingsPlanOrderOptions struct { + // Supports filtering by properties/usageDate. + Filter *string + // Daily or monthly grain. + GrainParameter *GrainParameter +} + +// BenefitUtilizationSummariesListResult - Result of listing 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; Reservation, SavingsPlan or IncludedQuantity. + 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. For example, reservation or savings plan + BenefitType *BenefitKind `json:"benefitType,omitempty"` + + // READ-ONLY; ARM SKU name. For example, StandardD1V2 for reservations and ComputeSavingsPlan for savings plan. + ArmSKUName *string `json:"armSkuName,omitempty" azure:"ro"` + + // READ-ONLY; The benefit ID is the identifier of a benefit within a benefit order. + BenefitID *string `json:"benefitId,omitempty" azure:"ro"` + + // READ-ONLY; The benefit order ID is the identifier for a benefit purchase. Each benefit order ID represents a single purchase + // transaction. For example: A reservation order contains reservations. The reservation + // order specifies the VM size and region for the reservations. + BenefitOrderID *string `json:"benefitOrderId,omitempty" azure:"ro"` + + // READ-ONLY; Date corresponding to the utilization record. If the grain of data is monthly, it will be first day of 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"` +} + +// 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"` +} + +// 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"` + + // 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"` +} + +// 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"` +} + +// 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 [][]interface{} `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"` +} + +// 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; Reservation, SavingsPlan or IncludedQuantity. + 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. For example, reservation or savings plan + BenefitType *BenefitKind `json:"benefitType,omitempty"` + + // READ-ONLY; ARM SKU name. For example, StandardD1V2 for reservations and ComputeSavingsPlan for savings plan. + ArmSKUName *string `json:"armSkuName,omitempty" azure:"ro"` + + // READ-ONLY; The benefit ID is the identifier of a benefit within a benefit order. + BenefitID *string `json:"benefitId,omitempty" azure:"ro"` + + // READ-ONLY; The benefit order ID is the identifier for a benefit purchase. Each benefit order ID represents a single purchase + // transaction. For example: A reservation order contains reservations. The reservation + // order specifies the VM size and region for the reservations. + BenefitOrderID *string `json:"benefitOrderId,omitempty" azure:"ro"` + + // READ-ONLY; Date corresponding to the utilization record. If the grain of data is monthly, it will be first day of 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"` +} + +// 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.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"` +} + +// 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 [][]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"` +} + +// RecommendationUsageDetails - The additional details about the usage which are considered while computing benefit recommendations. +type RecommendationUsageDetails struct { + // The grain of the usage. For example, hourly or monthly etc. + UsageGrain *Grain `json:"usageGrain,omitempty"` + + // READ-ONLY; current cost without benefit i.e. charges at the specified grain. + 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 *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"` +} + +// 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; Reservation, SavingsPlan or IncludedQuantity. + 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. For example, reservation or savings plan + BenefitType *BenefitKind `json:"benefitType,omitempty"` + + // READ-ONLY; ARM SKU name. For example, StandardD1V2 for reservations and ComputeSavingsPlan for savings plan. + ArmSKUName *string `json:"armSkuName,omitempty" azure:"ro"` + + // READ-ONLY; This is the average utilization percentage for the benefit ID. + AvgUtilizationPercentage *float64 `json:"avgUtilizationPercentage,omitempty" azure:"ro"` + + // READ-ONLY; The benefit ID is the identifier of a benefit within a benefit order. + BenefitID *string `json:"benefitId,omitempty" azure:"ro"` + + // READ-ONLY; The benefit order ID is the identifier for a benefit purchase. Each benefit order ID represents a single purchase + // transaction. For example: A reservation order contains reservations. The reservation + // order specifies the VM size and region for the reservations. + BenefitOrderID *string `json:"benefitOrderId,omitempty" azure:"ro"` + + // READ-ONLY; This is the maximum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to + // 12/10/2017 and on that for hour 4, utilization was 100%, this field will return 100% for + // that day. + MaxUtilizationPercentage *float64 `json:"maxUtilizationPercentage,omitempty" azure:"ro"` + + // READ-ONLY; This is the minimum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to + // 12/10/2017 and on that for hour 4, utilization was 10%, this field will return 10% for that + // day + MinUtilizationPercentage *float64 `json:"minUtilizationPercentage,omitempty" azure:"ro"` + + // READ-ONLY; Date corresponding to the utilization record. If the grain of data is monthly, it will be first day of 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. + 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. + 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 { + // placeholder for future optional parameters +} + +// 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.ListByScope 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.List 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 plan recommendation when scope is 'Shared'. +type SharedScopeBenefitRecommendationProperties struct { + // REQUIRED; Scope of the benefit. For example, Single or Shared. + Scope *Scope `json:"scope,omitempty"` + + // Grain of the proposed commitment amount. For example, hourly, monthly etc. + CommitmentGranularity *Grain `json:"commitmentGranularity,omitempty"` + + // The number of days of usage used to look back for computing the recommendation. + 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"` + + // The additional details about the usage which are considered while computing benefit recommendations. + Usage *RecommendationUsageDetails `json:"usage,omitempty"` + + // READ-ONLY; The list of all benefit recommendations. + AllRecommendationDetails *AllSavingsList `json:"allRecommendationDetails,omitempty" azure:"ro"` + + // READ-ONLY; ARM SKU name. For example, StandardD1V2 for Reservations and ComputeSavingsPlan for SavingsPlan. + ArmSKUName *string `json:"armSkuName,omitempty" azure:"ro"` + + // READ-ONLY; The current cost without benefit corresponds to 'totalHours' property in a given 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 recommendation. + FirstConsumptionDate *time.Time `json:"firstConsumptionDate,omitempty" azure:"ro"` + + // READ-ONLY; The last usage date used for looking back for computing the recommendation. + 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 plan recommendation when scope is 'Single'. +type SingleScopeBenefitRecommendationProperties struct { + // REQUIRED; Scope of the benefit. For example, Single or Shared. + Scope *Scope `json:"scope,omitempty"` + + // Grain of the proposed commitment amount. For example, hourly, monthly etc. + CommitmentGranularity *Grain `json:"commitmentGranularity,omitempty"` + + // The number of days of usage used to look back for computing the recommendation. + 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"` + + // The additional details about the usage which are considered while computing benefit recommendations. + Usage *RecommendationUsageDetails `json:"usage,omitempty"` + + // READ-ONLY; The list of all benefit recommendations. + AllRecommendationDetails *AllSavingsList `json:"allRecommendationDetails,omitempty" azure:"ro"` + + // READ-ONLY; ARM SKU name. For example, StandardD1V2 for Reservations and ComputeSavingsPlan for SavingsPlan. + ArmSKUName *string `json:"armSkuName,omitempty" azure:"ro"` + + // READ-ONLY; The current cost without benefit corresponds to 'totalHours' property in a given 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 recommendation. + FirstConsumptionDate *time.Time `json:"firstConsumptionDate,omitempty" azure:"ro"` + + // READ-ONLY; The last usage date used for looking back for computing the recommendation. + 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.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/models_serde.go b/sdk/resourcemanager/costmanagement/armcostmanagement/models_serde.go new file mode 100644 index 000000000000..b01e7246d94a --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/models_serde.go @@ -0,0 +1,4482 @@ +//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]interface{}) + 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]interface{}) + 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]interface{}) + 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]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) +} + +// 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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 CheckNameAvailabilityRequest. +func (c CheckNameAvailabilityRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + 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]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 +} + +// MarshalJSON implements the json.Marshaller interface for type CostDetailsOperationResults. +func (c CostDetailsOperationResults) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + 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 Dimension. +func (d Dimension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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 ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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 Export. +func (e Export) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]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 ExportRun. +func (e ExportRun) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]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 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]interface{}) + 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]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 FileDestination. +func (f FileDestination) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]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) +} + +// 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + populate(objectMap, "eTag", f.ETag) + populate(objectMap, "id", f.ID) + populate(objectMap, "location", f.Location) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "sku", f.SKU) + populate(objectMap, "tags", f.Tags) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ForecastResult. +func (f *ForecastResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "eTag": + err = unpopulate(val, "ETag", &f.ETag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &f.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &f.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &f.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ForecastTimePeriod. +func (f ForecastTimePeriod) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + populate(objectMap, "enabled", k.Enabled) + populate(objectMap, "id", k.ID) + populate(objectMap, "type", k.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KpiProperties. +func (k *KpiProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &k.Enabled) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &k.ID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &k.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NotificationProperties. +func (n NotificationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]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) +} + +// 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]interface{}) + 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]interface{}) + 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]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) +} + +// 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]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 RecommendationUsageDetails. +func (r RecommendationUsageDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + 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]interface{}) + 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]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) +} + +// 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]interface{}) + 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]interface{}) + 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]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) +} + +// 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]interface{}) + 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]interface{}) + 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]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 +} + +// MarshalJSON implements the json.Marshaller interface for type ReportManifest. +func (r ReportManifest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]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_operations_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/operations_client.go similarity index 96% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_operations_client.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/operations_client.go index f34e2f76b719..2dadd61faea2 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 @@ -49,8 +50,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // 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 +// Generated from API version 2022-10-01 // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -88,7 +88,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") 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..8eb1ef45c0ab --- /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]interface{} + 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]interface{} + 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..941cbbe9292b --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/pricesheet_client.go @@ -0,0 +1,190 @@ +//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" + 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" +) + +// PriceSheetClient contains the methods for the PriceSheet group. +// Don't use this type directly, use NewPriceSheetClient() instead. +type PriceSheetClient struct { + host string + pl runtime.Pipeline +} + +// 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) { + 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 := &PriceSheetClient{ + host: ep, + pl: pl, + } + 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 2022-10-01 +// billingAccountName - The ID that uniquely identifies a billing account. +// billingProfileName - The ID that uniquely identifies a billing profile. +// invoiceName - The ID that uniquely identifies an invoice. +// options - PriceSheetClientBeginDownloadOptions contains the optional parameters for the PriceSheetClient.BeginDownload +// method. +func (client *PriceSheetClient) BeginDownload(ctx context.Context, billingAccountName string, billingProfileName string, invoiceName string, options *PriceSheetClientBeginDownloadOptions) (*runtime.Poller[PriceSheetClientDownloadResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.download(ctx, billingAccountName, billingProfileName, invoiceName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PriceSheetClientDownloadResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[PriceSheetClientDownloadResponse](options.ResumeToken, client.pl, 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 2022-10-01 +func (client *PriceSheetClient) download(ctx context.Context, billingAccountName string, billingProfileName string, invoiceName string, options *PriceSheetClientBeginDownloadOptions) (*http.Response, error) { + req, err := client.downloadCreateRequest(ctx, billingAccountName, billingProfileName, invoiceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginDownloadByBillingProfile - Gets a URL to download the current month's pricesheet for a billing profile. The operation +// is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer +// Agreement.Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated +// from a single csv file to a Zip file containing multiple csv files, each with +// max 200k records. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-10-01 +// billingAccountName - The ID that uniquely identifies a billing account. +// billingProfileName - The ID that uniquely identifies a billing profile. +// options - PriceSheetClientBeginDownloadByBillingProfileOptions contains the optional parameters for the PriceSheetClient.BeginDownloadByBillingProfile +// method. +func (client *PriceSheetClient) BeginDownloadByBillingProfile(ctx context.Context, billingAccountName string, billingProfileName string, options *PriceSheetClientBeginDownloadByBillingProfileOptions) (*runtime.Poller[PriceSheetClientDownloadByBillingProfileResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.downloadByBillingProfile(ctx, billingAccountName, billingProfileName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PriceSheetClientDownloadByBillingProfileResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[PriceSheetClientDownloadByBillingProfileResponse](options.ResumeToken, client.pl, 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 2022-10-01 +func (client *PriceSheetClient) downloadByBillingProfile(ctx context.Context, billingAccountName string, billingProfileName string, options *PriceSheetClientBeginDownloadByBillingProfileOptions) (*http.Response, error) { + req, err := client.downloadByBillingProfileCreateRequest(ctx, billingAccountName, billingProfileName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + 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 97% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_query_client.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/query_client.go index 33fb2aa9eb69..30388d3a12cc 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 @@ -53,7 +54,7 @@ func NewQueryClient(credential azcore.TokenCredential, options *arm.ClientOption // Usage - Query the usage data for scope defined. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-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 @@ -90,7 +91,7 @@ func (client *QueryClient) usageCreateRequest(ctx context.Context, scope string, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -107,7 +108,7 @@ func (client *QueryClient) usageHandleResponse(resp *http.Response) (QueryClient // UsageByExternalCloudProviderType - Query the usage data for external cloud provider type defined. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-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 @@ -146,7 +147,7 @@ func (client *QueryClient) usageByExternalCloudProviderTypeCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_response_types.go b/sdk/resourcemanager/costmanagement/armcostmanagement/response_types.go similarity index 54% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_response_types.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/response_types.go index 0f40aeaffec8..61fcd652f9d7 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_response_types.go +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/response_types.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 @@ -28,6 +29,31 @@ type AlertsClientListResponse struct { AlertsResult } +// BenefitRecommendationsClientListResponse contains the response from method BenefitRecommendationsClient.List. +type BenefitRecommendationsClientListResponse struct { + BenefitRecommendationsListResult +} + +// BenefitUtilizationSummariesClientListByBillingAccountIDResponse contains the response from method BenefitUtilizationSummariesClient.ListByBillingAccountID. +type BenefitUtilizationSummariesClientListByBillingAccountIDResponse struct { + BenefitUtilizationSummariesListResult +} + +// BenefitUtilizationSummariesClientListByBillingProfileIDResponse contains the response from method BenefitUtilizationSummariesClient.ListByBillingProfileID. +type BenefitUtilizationSummariesClientListByBillingProfileIDResponse struct { + BenefitUtilizationSummariesListResult +} + +// BenefitUtilizationSummariesClientListBySavingsPlanIDResponse contains the response from method BenefitUtilizationSummariesClient.ListBySavingsPlanID. +type BenefitUtilizationSummariesClientListBySavingsPlanIDResponse struct { + BenefitUtilizationSummariesListResult +} + +// BenefitUtilizationSummariesClientListBySavingsPlanOrderResponse contains the response from method BenefitUtilizationSummariesClient.ListBySavingsPlanOrder. +type BenefitUtilizationSummariesClientListBySavingsPlanOrderResponse struct { + BenefitUtilizationSummariesListResult +} + // DimensionsClientByExternalCloudProviderTypeResponse contains the response from method DimensionsClient.ByExternalCloudProviderType. type DimensionsClientByExternalCloudProviderTypeResponse struct { DimensionsListResult @@ -70,12 +96,22 @@ type ExportsClientListResponse struct { // ForecastClientExternalCloudProviderUsageResponse contains the response from method ForecastClient.ExternalCloudProviderUsage. type ForecastClientExternalCloudProviderUsageResponse struct { - QueryResult + ForecastResult } // ForecastClientUsageResponse contains the response from method ForecastClient.Usage. type ForecastClientUsageResponse struct { - QueryResult + ForecastResult +} + +// GenerateCostDetailsReportClientCreateOperationResponse contains the response from method GenerateCostDetailsReportClient.CreateOperation. +type GenerateCostDetailsReportClientCreateOperationResponse struct { + CostDetailsOperationResults +} + +// GenerateCostDetailsReportClientGetOperationResultsResponse contains the response from method GenerateCostDetailsReportClient.GetOperationResults. +type GenerateCostDetailsReportClientGetOperationResultsResponse struct { + CostDetailsOperationResults } // GenerateDetailedCostReportClientCreateOperationResponse contains the response from method GenerateDetailedCostReportClient.CreateOperation. @@ -108,6 +144,16 @@ type OperationsClientListResponse struct { OperationListResult } +// PriceSheetClientDownloadByBillingProfileResponse contains the response from method PriceSheetClient.DownloadByBillingProfile. +type PriceSheetClientDownloadByBillingProfileResponse struct { + DownloadURL +} + +// PriceSheetClientDownloadResponse contains the response from method PriceSheetClient.Download. +type PriceSheetClientDownloadResponse struct { + DownloadURL +} + // QueryClientUsageByExternalCloudProviderTypeResponse contains the response from method QueryClient.UsageByExternalCloudProviderType. type QueryClientUsageByExternalCloudProviderTypeResponse struct { QueryResult @@ -118,6 +164,66 @@ 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.ListByScope. +type ScheduledActionsClientListByScopeResponse struct { + ScheduledActionListResult +} + +// ScheduledActionsClientListResponse contains the response from method ScheduledActionsClient.List. +type ScheduledActionsClientListResponse struct { + ScheduledActionListResult +} + +// ScheduledActionsClientRunByScopeResponse contains the response from method ScheduledActionsClient.RunByScope. +type ScheduledActionsClientRunByScopeResponse struct { + // placeholder for future response values +} + +// ScheduledActionsClientRunResponse contains the response from method ScheduledActionsClient.Run. +type ScheduledActionsClientRunResponse struct { + // placeholder for future response values +} + // ViewsClientCreateOrUpdateByScopeResponse contains the response from method ViewsClient.CreateOrUpdateByScope. type ViewsClientCreateOrUpdateByScopeResponse struct { View diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/scheduledactions_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/scheduledactions_client.go new file mode 100644 index 000000000000..7ee383bebabe --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/scheduledactions_client.go @@ -0,0 +1,712 @@ +//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" + 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" +) + +// ScheduledActionsClient contains the methods for the ScheduledActions group. +// Don't use this type directly, use NewScheduledActionsClient() instead. +type ScheduledActionsClient struct { + host string + pl runtime.Pipeline +} + +// NewScheduledActionsClient creates a new instance of ScheduledActionsClient with the specified values. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewScheduledActionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ScheduledActionsClient, error) { + 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 := &ScheduledActionsClient{ + host: ep, + pl: pl, + } + 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 2022-10-01 +// checkNameAvailabilityRequest - Scheduled action to be created or updated. +// options - ScheduledActionsClientCheckNameAvailabilityOptions contains the optional parameters for the ScheduledActionsClient.CheckNameAvailability +// method. +func (client *ScheduledActionsClient) CheckNameAvailability(ctx context.Context, checkNameAvailabilityRequest CheckNameAvailabilityRequest, options *ScheduledActionsClientCheckNameAvailabilityOptions) (ScheduledActionsClientCheckNameAvailabilityResponse, error) { + req, err := client.checkNameAvailabilityCreateRequest(ctx, checkNameAvailabilityRequest, options) + if err != nil { + return ScheduledActionsClientCheckNameAvailabilityResponse{}, err + } + resp, err := client.pl.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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, checkNameAvailabilityRequest) +} + +// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. +func (client *ScheduledActionsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (ScheduledActionsClientCheckNameAvailabilityResponse, error) { + result := ScheduledActionsClientCheckNameAvailabilityResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResponse); err != nil { + return ScheduledActionsClientCheckNameAvailabilityResponse{}, err + } + return result, nil +} + +// CheckNameAvailabilityByScope - Checks availability and correctness of the name for a scheduled action within the given +// scope. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-10-01 +// scope - The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription +// scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for +// resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection +// scope, +// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account +// scope and +// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. +// Note: Insight Alerts are only available on subscription scope. +// checkNameAvailabilityRequest - Scheduled action to be created or updated. +// options - ScheduledActionsClientCheckNameAvailabilityByScopeOptions contains the optional parameters for the ScheduledActionsClient.CheckNameAvailabilityByScope +// method. +func (client *ScheduledActionsClient) CheckNameAvailabilityByScope(ctx context.Context, scope string, checkNameAvailabilityRequest CheckNameAvailabilityRequest, options *ScheduledActionsClientCheckNameAvailabilityByScopeOptions) (ScheduledActionsClientCheckNameAvailabilityByScopeResponse, error) { + req, err := client.checkNameAvailabilityByScopeCreateRequest(ctx, scope, checkNameAvailabilityRequest, options) + if err != nil { + return ScheduledActionsClientCheckNameAvailabilityByScopeResponse{}, err + } + resp, err := client.pl.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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, checkNameAvailabilityRequest) +} + +// checkNameAvailabilityByScopeHandleResponse handles the CheckNameAvailabilityByScope response. +func (client *ScheduledActionsClient) checkNameAvailabilityByScopeHandleResponse(resp *http.Response) (ScheduledActionsClientCheckNameAvailabilityByScopeResponse, error) { + result := ScheduledActionsClientCheckNameAvailabilityByScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResponse); err != nil { + return ScheduledActionsClientCheckNameAvailabilityByScopeResponse{}, err + } + return result, nil +} + +// CreateOrUpdate - Create or update a private scheduled action. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-10-01 +// name - Scheduled action name. +// scheduledAction - Scheduled action to be created or updated. +// options - ScheduledActionsClientCreateOrUpdateOptions contains the optional parameters for the ScheduledActionsClient.CreateOrUpdate +// method. +func (client *ScheduledActionsClient) CreateOrUpdate(ctx context.Context, name string, scheduledAction ScheduledAction, options *ScheduledActionsClientCreateOrUpdateOptions) (ScheduledActionsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, name, scheduledAction, options) + if err != nil { + return ScheduledActionsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + 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 2022-10-01 +// scope - The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription +// scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for +// resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection +// scope, +// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account +// scope and +// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. +// Note: Insight Alerts are only available on subscription scope. +// name - Scheduled action name. +// scheduledAction - Scheduled action to be created or updated. +// options - ScheduledActionsClientCreateOrUpdateByScopeOptions contains the optional parameters for the ScheduledActionsClient.CreateOrUpdateByScope +// method. +func (client *ScheduledActionsClient) CreateOrUpdateByScope(ctx context.Context, scope string, name string, scheduledAction ScheduledAction, options *ScheduledActionsClientCreateOrUpdateByScopeOptions) (ScheduledActionsClientCreateOrUpdateByScopeResponse, error) { + req, err := client.createOrUpdateByScopeCreateRequest(ctx, scope, name, scheduledAction, options) + if err != nil { + return ScheduledActionsClientCreateOrUpdateByScopeResponse{}, err + } + resp, err := client.pl.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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + 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 2022-10-01 +// name - Scheduled action name. +// options - ScheduledActionsClientDeleteOptions contains the optional parameters for the ScheduledActionsClient.Delete method. +func (client *ScheduledActionsClient) Delete(ctx context.Context, name string, options *ScheduledActionsClientDeleteOptions) (ScheduledActionsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, name, options) + if err != nil { + return ScheduledActionsClientDeleteResponse{}, err + } + resp, err := client.pl.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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// DeleteByScope - Delete a scheduled action within the given scope. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-10-01 +// scope - The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription +// scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for +// resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection +// scope, +// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account +// scope and +// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. +// Note: Insight Alerts are only available on subscription scope. +// name - Scheduled action name. +// options - ScheduledActionsClientDeleteByScopeOptions contains the optional parameters for the ScheduledActionsClient.DeleteByScope +// method. +func (client *ScheduledActionsClient) DeleteByScope(ctx context.Context, scope string, name string, options *ScheduledActionsClientDeleteByScopeOptions) (ScheduledActionsClientDeleteByScopeResponse, error) { + req, err := client.deleteByScopeCreateRequest(ctx, scope, name, options) + if err != nil { + return ScheduledActionsClientDeleteByScopeResponse{}, err + } + resp, err := client.pl.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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the private scheduled action by name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-10-01 +// name - Scheduled action name. +// options - ScheduledActionsClientGetOptions contains the optional parameters for the ScheduledActionsClient.Get method. +func (client *ScheduledActionsClient) Get(ctx context.Context, name string, options *ScheduledActionsClientGetOptions) (ScheduledActionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, name, options) + if err != nil { + return ScheduledActionsClientGetResponse{}, err + } + resp, err := client.pl.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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-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 *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 2022-10-01 +// scope - The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription +// scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for +// resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection +// scope, +// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account +// scope and +// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. +// Note: Insight Alerts are only available on subscription scope. +// name - Scheduled action name. +// options - ScheduledActionsClientGetByScopeOptions contains the optional parameters for the ScheduledActionsClient.GetByScope +// method. +func (client *ScheduledActionsClient) GetByScope(ctx context.Context, scope string, name string, options *ScheduledActionsClientGetByScopeOptions) (ScheduledActionsClientGetByScopeResponse, error) { + req, err := client.getByScopeCreateRequest(ctx, scope, name, options) + if err != nil { + return ScheduledActionsClientGetByScopeResponse{}, err + } + resp, err := client.pl.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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByScopeHandleResponse handles the GetByScope response. +func (client *ScheduledActionsClient) getByScopeHandleResponse(resp *http.Response) (ScheduledActionsClientGetByScopeResponse, error) { + result := ScheduledActionsClientGetByScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ScheduledAction); err != nil { + return ScheduledActionsClientGetByScopeResponse{}, err + } + return result, nil +} + +// NewListPager - List all private scheduled actions. +// Generated from API version 2022-10-01 +// options - ScheduledActionsClientListOptions contains the optional parameters for the ScheduledActionsClient.List 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.pl.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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ScheduledActionsClient) listHandleResponse(resp *http.Response) (ScheduledActionsClientListResponse, error) { + result := ScheduledActionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ScheduledActionListResult); err != nil { + return ScheduledActionsClientListResponse{}, err + } + return result, nil +} + +// NewListByScopePager - List all shared scheduled actions within the given scope. +// Generated from API version 2022-10-01 +// scope - The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription +// scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for +// resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection +// scope, +// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account +// scope and +// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. +// Note: Insight Alerts are only available on subscription scope. +// options - ScheduledActionsClientListByScopeOptions contains the optional parameters for the ScheduledActionsClient.ListByScope +// 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.pl.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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByScopeHandleResponse handles the ListByScope response. +func (client *ScheduledActionsClient) listByScopeHandleResponse(resp *http.Response) (ScheduledActionsClientListByScopeResponse, error) { + result := ScheduledActionsClientListByScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ScheduledActionListResult); err != nil { + return ScheduledActionsClientListByScopeResponse{}, err + } + return result, nil +} + +// Run - Processes a private scheduled action. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-10-01 +// name - Scheduled action name. +// options - ScheduledActionsClientRunOptions contains the optional parameters for the ScheduledActionsClient.Run method. +func (client *ScheduledActionsClient) Run(ctx context.Context, name string, options *ScheduledActionsClientRunOptions) (ScheduledActionsClientRunResponse, error) { + req, err := client.runCreateRequest(ctx, name, options) + if err != nil { + return ScheduledActionsClientRunResponse{}, err + } + resp, err := client.pl.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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// RunByScope - Runs a shared scheduled action within the given scope. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-10-01 +// scope - The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription +// scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for +// resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection +// scope, +// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account +// scope and +// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. +// Note: Insight Alerts are only available on subscription scope. +// name - Scheduled action name. +// options - ScheduledActionsClientRunByScopeOptions contains the optional parameters for the ScheduledActionsClient.RunByScope +// method. +func (client *ScheduledActionsClient) RunByScope(ctx context.Context, scope string, name string, options *ScheduledActionsClientRunByScopeOptions) (ScheduledActionsClientRunByScopeResponse, error) { + req, err := client.runByScopeCreateRequest(ctx, scope, name, options) + if err != nil { + return ScheduledActionsClientRunByScopeResponse{}, err + } + resp, err := client.pl.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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + 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 99% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/time_rfc3339.go index 3fccf88c1d9f..354f35ff7608 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 diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_views_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/views_client.go similarity index 96% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_views_client.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/views_client.go index 51a00b3475a9..56127a04e6c3 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 @@ -55,7 +56,7 @@ 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 +// Generated from API version 2022-10-01 // viewName - View name // parameters - Parameters supplied to the CreateOrUpdate View operation. // options - ViewsClientCreateOrUpdateOptions contains the optional parameters for the ViewsClient.CreateOrUpdate method. @@ -86,7 +87,7 @@ func (client *ViewsClient) createOrUpdateCreateRequest(ctx context.Context, view return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -105,7 +106,7 @@ 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 +// Generated from API version 2022-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}' @@ -154,7 +155,7 @@ func (client *ViewsClient) createOrUpdateByScopeCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -171,7 +172,7 @@ func (client *ViewsClient) createOrUpdateByScopeHandleResponse(resp *http.Respon // Delete - The operation to delete a view. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-10-01 // viewName - View name // options - ViewsClientDeleteOptions contains the optional parameters for the ViewsClient.Delete method. func (client *ViewsClient) Delete(ctx context.Context, viewName string, options *ViewsClientDeleteOptions) (ViewsClientDeleteResponse, error) { @@ -201,7 +202,7 @@ func (client *ViewsClient) deleteCreateRequest(ctx context.Context, viewName str return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -209,7 +210,7 @@ func (client *ViewsClient) deleteCreateRequest(ctx context.Context, viewName str // DeleteByScope - The operation to delete a view. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-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}' @@ -256,7 +257,7 @@ func (client *ViewsClient) deleteByScopeCreateRequest(ctx context.Context, scope return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -264,7 +265,7 @@ func (client *ViewsClient) deleteByScopeCreateRequest(ctx context.Context, scope // Get - Gets the view by view name. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-10-01 // viewName - View name // options - ViewsClientGetOptions contains the optional parameters for the ViewsClient.Get method. func (client *ViewsClient) Get(ctx context.Context, viewName string, options *ViewsClientGetOptions) (ViewsClientGetResponse, error) { @@ -294,7 +295,7 @@ func (client *ViewsClient) getCreateRequest(ctx context.Context, viewName string return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -311,7 +312,7 @@ func (client *ViewsClient) getHandleResponse(resp *http.Response) (ViewsClientGe // GetByScope - Gets the view for the defined scope by view name. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-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}' @@ -358,7 +359,7 @@ func (client *ViewsClient) getByScopeCreateRequest(ctx context.Context, scope st return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -374,8 +375,7 @@ 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 +// Generated from API version 2022-10-01 // options - ViewsClientListOptions contains the optional parameters for the ViewsClient.List method. func (client *ViewsClient) NewListPager(options *ViewsClientListOptions) *runtime.Pager[ViewsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ViewsClientListResponse]{ @@ -413,7 +413,7 @@ func (client *ViewsClient) listCreateRequest(ctx context.Context, options *Views return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -429,8 +429,7 @@ 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 +// Generated from API version 2022-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}' @@ -485,7 +484,7 @@ func (client *ViewsClient) listByScopeCreateRequest(ctx context.Context, scope s return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-10-01") 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_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 -}