From 39dcf51a4598dd0ee44cceab52eb35bbdca04895 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 12 Oct 2022 03:51:48 +0000 Subject: [PATCH] CodeGen from PR 20958 in Azure/azure-rest-api-specs Merge 8b46069ed8a19deaf9065e2017bf66a9c0435f82 into b25c293b86861309fb7806985f1fcfce24060f84 --- .../armcostmanagement/CHANGELOG.md | 533 +++++++ .../armcostmanagement/autorest.md | 6 +- .../armcostmanagement/constants.go | 261 ++++ .../generatecostdetailsreport_client.go | 205 +++ .../costmanagement/armcostmanagement/go.mod | 16 +- .../costmanagement/armcostmanagement/go.sum | 24 +- .../armcostmanagement/models.go | 557 ++++++++ .../armcostmanagement/models_serde.go | 1043 ++++++++++++++ ...rations_client.go => operations_client.go} | 2 +- .../armcostmanagement/pricesheet_client.go | 190 +++ .../armcostmanagement/response_types.go | 95 ++ .../scheduledactions_client.go | 713 ++++++++++ ...erated_time_rfc3339.go => time_rfc3339.go} | 1 + ...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 ---- .../zz_generated_alerts_client.go | 270 ---- .../zz_generated_constants.go | 722 ---------- .../zz_generated_dimensions_client.go | 199 --- .../zz_generated_exports_client.go | 387 ----- .../zz_generated_forecast_client.go | 168 --- ...rated_generatedetailedcostreport_client.go | 122 -- ...tailedcostreportoperationresults_client.go | 113 -- ...etailedcostreportoperationstatus_client.go | 113 -- ...generatereservationdetailsreport_client.go | 185 --- .../armcostmanagement/zz_generated_models.go | 1262 ----------------- .../zz_generated_models_serde.go | 612 -------- .../zz_generated_query_client.go | 162 --- .../zz_generated_response_types.go | 159 --- .../zz_generated_views_client.go | 501 ------- 38 files changed, 3609 insertions(+), 6129 deletions(-) create mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/constants.go create mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/generatecostdetailsreport_client.go 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} (98%) create mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/pricesheet_client.go create mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/response_types.go create mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/scheduledactions_client.go rename sdk/resourcemanager/costmanagement/armcostmanagement/{zz_generated_time_rfc3339.go => time_rfc3339.go} (99%) 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_alerts_client.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_constants.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_dimensions_client.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_exports_client.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_forecast_client.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreport_client.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreportoperationresults_client.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreportoperationstatus_client.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatereservationdetailsreport_client.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_models.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_models_serde.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_query_client.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_response_types.go delete mode 100644 sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_views_client.go diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/CHANGELOG.md b/sdk/resourcemanager/costmanagement/armcostmanagement/CHANGELOG.md index 3bce11468810..6b10f70f0fc0 100644 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/CHANGELOG.md +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/CHANGELOG.md @@ -1,5 +1,538 @@ # Release History +## 2.0.0 (2022-10-12) +### Breaking Changes + +- Type of `OperationListResult.Value` has been changed from `[]*Operation` to `[]*OperationForCostManagement` +- Const `AlertOperatorLessThan` has been removed +- Const `AlertTimeGrainTypeBillingAnnual` has been removed +- Const `ExecutionStatusDataNotAvailable` has been removed +- Const `ReportOperationStatusTypeQueued` has been removed +- Const `AlertStatusResolved` has been removed +- Const `RecurrenceTypeAnnually` has been removed +- Const `ExternalCloudProviderTypeExternalBillingAccounts` has been removed +- Const `AlertCriteriaCrossCloudNewDataAvailable` has been removed +- Const `TimeframeTypeCustom` has been removed +- Const `AlertStatusActive` has been removed +- Const `OperatorTypeContains` has been removed +- Const `AccumulatedTypeFalse` has been removed +- Const `AlertStatusNone` has been removed +- Const `AlertOperatorEqualTo` has been removed +- Const `AlertOperatorLessThanOrEqualTo` has been removed +- Const `ForecastTimeframeTypeWeekToDate` has been removed +- Const `ReportConfigColumnTypeTag` has been removed +- Const `ReportConfigColumnTypeDimension` has been removed +- Const `AlertCriteriaUsageThresholdExceeded` has been removed +- Const `ReservationReportSchemaReservationID` has been removed +- Const `ForecastTimeframeTypeTheLastMonth` has been removed +- Const `MetricTypeActualCost` has been removed +- Const `AlertStatusOverridden` has been removed +- Const `ForecastTimeframeTypeCustom` has been removed +- Const `ReservationReportSchemaReservationOrderID` has been removed +- Const `ExecutionStatusInProgress` has been removed +- Const `ReportGranularityTypeDaily` has been removed +- Const `ForecastTypeUsage` has been removed +- Const `ReservationReportSchemaUsageDate` has been removed +- Const `AlertCriteriaCostThresholdExceeded` has been removed +- Const `TimeframeTypeTheLastMonth` has been removed +- Const `AlertCriteriaInvoiceDueDateReached` has been removed +- Const `AlertTypeBudget` has been removed +- Const `AlertSourceUser` has been removed +- Const `GenerateDetailedCostReportMetricTypeActualCost` has been removed +- Const `TimeframeTypeWeekToDate` has been removed +- Const `AlertCriteriaForecastUsageThresholdExceeded` has been removed +- Const `QueryOperatorTypeIn` has been removed +- Const `ReservationReportSchemaInstanceFlexibilityGroup` has been removed +- Const `ReportOperationStatusTypeNoDataFound` has been removed +- Const `AlertTypeCredit` has been removed +- Const `AlertTimeGrainTypeMonthly` has been removed +- Const `AlertTypeGeneral` has been removed +- Const `RecurrenceTypeMonthly` has been removed +- Const `ChartTypeLine` has been removed +- Const `TimeframeTypeTheLastBillingMonth` has been removed +- Const `ExecutionStatusFailed` has been removed +- Const `FormatTypeCSV` has been removed +- Const `AlertTimeGrainTypeQuarterly` has been removed +- Const `PivotTypeTagKey` has been removed +- Const `AlertCriteriaCreditThresholdApproaching` has been removed +- Const `ReportConfigSortingTypeDescending` has been removed +- Const `ExecutionStatusTimeout` has been removed +- Const `AlertCategoryUsage` has been removed +- Const `AlertTimeGrainTypeBillingQuarter` has been removed +- Const `AlertCriteriaCreditThresholdReached` has been removed +- Const `OperationStatusTypeCompleted` has been removed +- Const `GenerateDetailedCostReportMetricTypeAmortizedCost` has been removed +- Const `TimeframeTypeBillingMonthToDate` has been removed +- Const `PivotTypeDimension` has been removed +- Const `AccumulatedTypeTrue` has been removed +- Const `ReportConfigSortingTypeAscending` has been removed +- Const `ReportTypeUsage` has been removed +- Const `ChartTypeArea` has been removed +- Const `OperationStatusTypeFailed` has been removed +- Const `ReportTimeframeTypeYearToDate` has been removed +- Const `AlertCriteriaQuotaThresholdReached` has been removed +- Const `MetricTypeAHUB` has been removed +- Const `StatusTypeInactive` has been removed +- Const `AlertStatusDismissed` has been removed +- Const `AlertTypeBudgetForecast` has been removed +- Const `AlertCategorySystem` has been removed +- Const `ReservationReportSchemaUsedHours` has been removed +- Const `AlertTypeInvoice` has been removed +- Const `StatusTypeActive` has been removed +- Const `ChartTypeStackedColumn` has been removed +- Const `KpiTypeForecast` has been removed +- Const `KpiTypeBudget` has been removed +- Const `ExecutionStatusQueued` has been removed +- Const `AlertCriteriaGeneralThresholdError` has been removed +- Const `ReportOperationStatusTypeInProgress` has been removed +- Const `FunctionTypeSum` has been removed +- Const `ExportTypeUsage` has been removed +- Const `ExportTypeAmortizedCost` has been removed +- Const `ReportOperationStatusTypeCompleted` has been removed +- Const `ReportTimeframeTypeMonthToDate` has been removed +- Const `ExecutionStatusNewDataNotAvailable` has been removed +- Const `ReservationReportSchemaReservedHours` has been removed +- Const `AlertSourcePreset` has been removed +- Const `ReservationReportSchemaInstanceID` has been removed +- Const `ExecutionStatusCompleted` has been removed +- Const `AlertCriteriaMultiCurrency` has been removed +- Const `ReportGranularityTypeMonthly` has been removed +- Const `AlertTypeQuota` has been removed +- Const `ForecastTimeframeTypeTheLastBillingMonth` has been removed +- Const `ReservationReportSchemaSKUName` has been removed +- Const `OperatorTypeIn` has been removed +- Const `AlertTimeGrainTypeNone` has been removed +- Const `AlertTypeXCloud` has been removed +- Const `AlertCategoryCost` has been removed +- Const `ReportTimeframeTypeCustom` has been removed +- Const `QueryColumnTypeDimension` has been removed +- Const `AlertCriteriaInvoiceDueDateApproaching` has been removed +- Const `ExternalCloudProviderTypeExternalSubscriptions` has been removed +- Const `ForecastTypeActualCost` has been removed +- Const `ReportOperationStatusTypeReadyToDownload` has been removed +- Const `ReservationReportSchemaInstanceFlexibilityRatio` has been removed +- Const `ReportOperationStatusTypeTimedOut` has been removed +- Const `RecurrenceTypeDaily` has been removed +- Const `TimeframeTypeMonthToDate` has been removed +- Const `ReservationReportSchemaTotalReservedQuantity` has been removed +- Const `AlertCriteriaCrossCloudCollectionError` has been removed +- Const `AlertOperatorGreaterThan` has been removed +- Const `ExecutionTypeScheduled` has been removed +- Const `ReportTimeframeTypeWeekToDate` has been removed +- Const `AlertCategoryBilling` has been removed +- Const `ReportOperationStatusTypeFailed` has been removed +- Const `OperationStatusTypeRunning` has been removed +- Const `AlertOperatorNone` has been removed +- Const `AlertCriteriaQuotaThresholdApproaching` has been removed +- Const `ForecastTypeAmortizedCost` has been removed +- Const `ReservationReportSchemaKind` has been removed +- Const `ForecastTimeframeTypeMonthToDate` has been removed +- Const `ExecutionTypeOnDemand` has been removed +- Const `AlertCriteriaForecastCostThresholdExceeded` has been removed +- Const `ForecastTimeframeTypeBillingMonthToDate` has been removed +- Const `AlertOperatorGreaterThanOrEqualTo` has been removed +- Const `MetricTypeAmortizedCost` has been removed +- Const `RecurrenceTypeWeekly` has been removed +- Const `AlertTimeGrainTypeAnnually` has been removed +- Const `GranularityTypeDaily` has been removed +- Const `ExportTypeActualCost` has been removed +- Const `AlertTimeGrainTypeBillingMonth` has been removed +- Const `QueryColumnTypeTag` has been removed +- Const `ChartTypeTable` has been removed +- Const `ChartTypeGroupedColumn` has been removed +- Type alias `AccumulatedType` has been removed +- Type alias `PivotType` has been removed +- Type alias `AlertOperator` has been removed +- Type alias `AlertTimeGrainType` has been removed +- Type alias `ExportType` has been removed +- Type alias `OperationStatusType` has been removed +- Type alias `ExecutionStatus` has been removed +- Type alias `QueryColumnType` has been removed +- Type alias `AlertStatus` has been removed +- Type alias `GranularityType` has been removed +- Type alias `ReportType` has been removed +- Type alias `RecurrenceType` has been removed +- Type alias `ChartType` has been removed +- Type alias `ReservationReportSchema` has been removed +- Type alias `ForecastTimeframeType` has been removed +- Type alias `QueryOperatorType` has been removed +- Type alias `GenerateDetailedCostReportMetricType` has been removed +- Type alias `TimeframeType` has been removed +- Type alias `FunctionType` has been removed +- Type alias `ReportConfigColumnType` has been removed +- Type alias `ReportTimeframeType` has been removed +- Type alias `ExecutionType` has been removed +- Type alias `KpiType` has been removed +- Type alias `MetricType` has been removed +- Type alias `ReportOperationStatusType` has been removed +- Type alias `ReportConfigSortingType` has been removed +- Type alias `AlertSource` has been removed +- Type alias `ExternalCloudProviderType` has been removed +- Type alias `OperatorType` has been removed +- Type alias `ReportGranularityType` has been removed +- Type alias `AlertCategory` has been removed +- Type alias `AlertType` has been removed +- Type alias `FormatType` has been removed +- Type alias `AlertCriteria` has been removed +- Type alias `StatusType` has been removed +- Type alias `ForecastType` has been removed +- Function `PossibleStatusTypeValues` has been removed +- Function `NewViewsClient` has been removed +- Function `PossibleAlertTimeGrainTypeValues` has been removed +- Function `PossibleAlertCategoryValues` has been removed +- Function `*AlertsClient.List` has been removed +- Function `*GenerateReservationDetailsReportClient.BeginByBillingAccountID` has been removed +- Function `*ExportsClient.Get` has been removed +- Function `PossibleReportTypeValues` has been removed +- Function `PossibleExecutionStatusValues` has been removed +- Function `*DimensionsClient.NewByExternalCloudProviderTypePager` has been removed +- Function `NewForecastClient` has been removed +- Function `*ViewsClient.Get` has been removed +- Function `PossibleAccumulatedTypeValues` has been removed +- Function `PossibleReportConfigSortingTypeValues` has been removed +- Function `PossibleFormatTypeValues` has been removed +- Function `PossibleReportTimeframeTypeValues` has been removed +- Function `PossibleAlertCriteriaValues` has been removed +- Function `PossibleForecastTimeframeTypeValues` has been removed +- Function `PossibleAlertOperatorValues` has been removed +- Function `PossibleTimeframeTypeValues` has been removed +- Function `NewAlertsClient` has been removed +- Function `*ViewsClient.CreateOrUpdateByScope` has been removed +- Function `PossibleExternalCloudProviderTypeValues` has been removed +- Function `*GenerateReservationDetailsReportClient.BeginByBillingProfileID` has been removed +- Function `*ExportsClient.GetExecutionHistory` has been removed +- Function `PossibleAlertStatusValues` has been removed +- Function `*QueryClient.Usage` has been removed +- Function `*ViewsClient.GetByScope` has been removed +- Function `PossibleReservationReportSchemaValues` has been removed +- Function `PossibleKpiTypeValues` has been removed +- Function `NewGenerateDetailedCostReportOperationResultsClient` has been removed +- Function `*AlertsClient.Dismiss` has been removed +- Function `*GenerateDetailedCostReportOperationResultsClient.Get` has been removed +- Function `*QueryClient.UsageByExternalCloudProviderType` has been removed +- Function `PossibleFunctionTypeValues` has been removed +- Function `NewGenerateReservationDetailsReportClient` has been removed +- Function `PossibleOperatorTypeValues` has been removed +- Function `PossibleGenerateDetailedCostReportMetricTypeValues` has been removed +- Function `PossibleAlertSourceValues` has been removed +- Function `*ViewsClient.CreateOrUpdate` has been removed +- Function `PossibleReportOperationStatusTypeValues` has been removed +- Function `PossibleExecutionTypeValues` has been removed +- Function `*ViewsClient.NewListByScopePager` has been removed +- Function `PossibleExportTypeValues` has been removed +- Function `PossibleMetricTypeValues` has been removed +- Function `PossibleAlertTypeValues` has been removed +- Function `PossiblePivotTypeValues` has been removed +- Function `NewQueryClient` has been removed +- Function `NewDimensionsClient` has been removed +- Function `*ExportsClient.Execute` has been removed +- Function `*ForecastClient.ExternalCloudProviderUsage` has been removed +- Function `*ExportsClient.List` has been removed +- Function `PossibleChartTypeValues` has been removed +- Function `*ViewsClient.DeleteByScope` has been removed +- Function `*ExportsClient.Delete` has been removed +- Function `PossibleForecastTypeValues` has been removed +- Function `PossibleQueryColumnTypeValues` has been removed +- Function `PossibleGranularityTypeValues` has been removed +- Function `PossibleRecurrenceTypeValues` has been removed +- Function `NewExportsClient` has been removed +- Function `*ViewsClient.NewListPager` has been removed +- Function `*GenerateDetailedCostReportClient.BeginCreateOperation` has been removed +- Function `*AlertsClient.Get` has been removed +- Function `NewGenerateDetailedCostReportClient` has been removed +- Function `PossibleReportConfigColumnTypeValues` has been removed +- Function `*ExportsClient.CreateOrUpdate` has been removed +- Function `PossibleOperationStatusTypeValues` has been removed +- Function `*GenerateDetailedCostReportOperationStatusClient.Get` has been removed +- Function `*AlertsClient.ListExternal` has been removed +- Function `PossibleReportGranularityTypeValues` has been removed +- Function `*ForecastClient.Usage` has been removed +- Function `*DimensionsClient.NewListPager` has been removed +- Function `NewGenerateDetailedCostReportOperationStatusClient` has been removed +- Function `*ViewsClient.Delete` has been removed +- Function `PossibleQueryOperatorTypeValues` has been removed +- Struct `Alert` has been removed +- Struct `AlertProperties` has been removed +- Struct `AlertPropertiesDefinition` has been removed +- Struct `AlertPropertiesDetails` has been removed +- Struct `AlertsClient` has been removed +- Struct `AlertsClientDismissOptions` has been removed +- Struct `AlertsClientDismissResponse` has been removed +- Struct `AlertsClientGetOptions` has been removed +- Struct `AlertsClientGetResponse` has been removed +- Struct `AlertsClientListExternalOptions` has been removed +- Struct `AlertsClientListExternalResponse` has been removed +- Struct `AlertsClientListOptions` has been removed +- Struct `AlertsClientListResponse` has been removed +- Struct `AlertsResult` has been removed +- Struct `CommonExportProperties` has been removed +- Struct `Dimension` has been removed +- Struct `DimensionProperties` has been removed +- Struct `DimensionsClient` has been removed +- Struct `DimensionsClientByExternalCloudProviderTypeOptions` has been removed +- Struct `DimensionsClientByExternalCloudProviderTypeResponse` has been removed +- Struct `DimensionsClientListOptions` has been removed +- Struct `DimensionsClientListResponse` has been removed +- Struct `DimensionsListResult` has been removed +- Struct `DismissAlertPayload` has been removed +- Struct `Export` has been removed +- Struct `ExportDataset` has been removed +- Struct `ExportDatasetConfiguration` has been removed +- Struct `ExportDefinition` has been removed +- Struct `ExportDeliveryDestination` has been removed +- Struct `ExportDeliveryInfo` has been removed +- Struct `ExportExecution` has been removed +- Struct `ExportExecutionListResult` has been removed +- Struct `ExportExecutionProperties` has been removed +- Struct `ExportListResult` has been removed +- Struct `ExportProperties` has been removed +- Struct `ExportRecurrencePeriod` has been removed +- Struct `ExportSchedule` has been removed +- Struct `ExportTimePeriod` has been removed +- Struct `ExportsClient` has been removed +- Struct `ExportsClientCreateOrUpdateOptions` has been removed +- Struct `ExportsClientCreateOrUpdateResponse` has been removed +- Struct `ExportsClientDeleteOptions` has been removed +- Struct `ExportsClientDeleteResponse` has been removed +- Struct `ExportsClientExecuteOptions` has been removed +- Struct `ExportsClientExecuteResponse` has been removed +- Struct `ExportsClientGetExecutionHistoryOptions` has been removed +- Struct `ExportsClientGetExecutionHistoryResponse` has been removed +- Struct `ExportsClientGetOptions` has been removed +- Struct `ExportsClientGetResponse` has been removed +- Struct `ExportsClientListOptions` has been removed +- Struct `ExportsClientListResponse` has been removed +- Struct `ForecastClient` has been removed +- Struct `ForecastClientExternalCloudProviderUsageOptions` has been removed +- Struct `ForecastClientExternalCloudProviderUsageResponse` has been removed +- Struct `ForecastClientUsageOptions` has been removed +- Struct `ForecastClientUsageResponse` has been removed +- Struct `ForecastDataset` has been removed +- Struct `ForecastDefinition` has been removed +- Struct `GenerateDetailedCostReportClient` has been removed +- Struct `GenerateDetailedCostReportClientBeginCreateOperationOptions` has been removed +- Struct `GenerateDetailedCostReportClientCreateOperationResponse` has been removed +- Struct `GenerateDetailedCostReportDefinition` has been removed +- Struct `GenerateDetailedCostReportErrorResponse` has been removed +- Struct `GenerateDetailedCostReportOperationResult` has been removed +- Struct `GenerateDetailedCostReportOperationResultsClient` has been removed +- Struct `GenerateDetailedCostReportOperationResultsClientGetOptions` has been removed +- Struct `GenerateDetailedCostReportOperationResultsClientGetResponse` has been removed +- Struct `GenerateDetailedCostReportOperationStatusClient` has been removed +- Struct `GenerateDetailedCostReportOperationStatusClientGetOptions` has been removed +- Struct `GenerateDetailedCostReportOperationStatusClientGetResponse` has been removed +- Struct `GenerateDetailedCostReportOperationStatuses` has been removed +- Struct `GenerateDetailedCostReportTimePeriod` has been removed +- Struct `GenerateReservationDetailsReportClient` has been removed +- Struct `GenerateReservationDetailsReportClientBeginByBillingAccountIDOptions` has been removed +- Struct `GenerateReservationDetailsReportClientBeginByBillingProfileIDOptions` has been removed +- Struct `GenerateReservationDetailsReportClientByBillingAccountIDResponse` has been removed +- Struct `GenerateReservationDetailsReportClientByBillingProfileIDResponse` has been removed +- Struct `KpiProperties` has been removed +- Struct `OperationStatus` has been removed +- Struct `PivotProperties` has been removed +- Struct `QueryAggregation` has been removed +- Struct `QueryClient` has been removed +- Struct `QueryClientUsageByExternalCloudProviderTypeOptions` has been removed +- Struct `QueryClientUsageByExternalCloudProviderTypeResponse` has been removed +- Struct `QueryClientUsageOptions` has been removed +- Struct `QueryClientUsageResponse` has been removed +- Struct `QueryColumn` has been removed +- Struct `QueryComparisonExpression` has been removed +- Struct `QueryDataset` has been removed +- Struct `QueryDatasetConfiguration` has been removed +- Struct `QueryDefinition` has been removed +- Struct `QueryFilter` has been removed +- Struct `QueryGrouping` has been removed +- Struct `QueryProperties` has been removed +- Struct `QueryResult` has been removed +- Struct `QueryTimePeriod` has been removed +- Struct `ReportConfigAggregation` has been removed +- Struct `ReportConfigComparisonExpression` has been removed +- Struct `ReportConfigDataset` has been removed +- Struct `ReportConfigDatasetConfiguration` has been removed +- Struct `ReportConfigDefinition` has been removed +- Struct `ReportConfigFilter` has been removed +- Struct `ReportConfigGrouping` has been removed +- Struct `ReportConfigSorting` has been removed +- Struct `ReportConfigTimePeriod` has been removed +- Struct `ReportURL` has been removed +- Struct `Status` has been removed +- Struct `View` has been removed +- Struct `ViewListResult` has been removed +- Struct `ViewProperties` has been removed +- Struct `ViewsClient` has been removed +- Struct `ViewsClientCreateOrUpdateByScopeOptions` has been removed +- Struct `ViewsClientCreateOrUpdateByScopeResponse` has been removed +- Struct `ViewsClientCreateOrUpdateOptions` has been removed +- Struct `ViewsClientCreateOrUpdateResponse` has been removed +- Struct `ViewsClientDeleteByScopeOptions` has been removed +- Struct `ViewsClientDeleteByScopeResponse` has been removed +- Struct `ViewsClientDeleteOptions` has been removed +- Struct `ViewsClientDeleteResponse` has been removed +- Struct `ViewsClientGetByScopeOptions` has been removed +- Struct `ViewsClientGetByScopeResponse` has been removed +- Struct `ViewsClientGetOptions` has been removed +- Struct `ViewsClientGetResponse` has been removed +- Struct `ViewsClientListByScopeOptions` has been removed +- Struct `ViewsClientListByScopeResponse` has been removed +- Struct `ViewsClientListOptions` has been removed +- Struct `ViewsClientListResponse` has been removed +- Field `DownloadURL` of struct `DownloadURL` has been removed +- Field `ValidTill` of struct `DownloadURL` has been removed +- Field `Tags` of struct `Resource` has been removed +- Field `ETag` of struct `Resource` has been removed +- Field `Location` of struct `Resource` has been removed +- Field `SKU` of struct `Resource` has been removed +- Field `ETag` of struct `ProxyResource` has been removed +- Field `ID` of struct `Operation` has been removed + +### Features Added + +- New const `DaysOfWeekTuesday` +- New const `DaysOfWeekThursday` +- New const `WeeksOfMonthLast` +- New const `ScheduleFrequencyDaily` +- New const `CostDetailsMetricTypeActualCostCostDetailsMetricType` +- New const `CostDetailsStatusTypeNoDataFoundCostDetailsStatusType` +- New const `CreatedByTypeUser` +- New const `ScheduledActionKindInsightAlert` +- New const `DaysOfWeekSunday` +- New const `CostDetailsStatusTypeCompletedCostDetailsStatusType` +- New const `WeeksOfMonthFourth` +- New const `ScheduleFrequencyWeekly` +- New const `CreatedByTypeApplication` +- New const `ActionTypeInternal` +- New const `WeeksOfMonthFirst` +- New const `ScheduledActionStatusEnabled` +- New const `CostDetailsDataFormatCSVCostDetailsDataFormat` +- New const `CostDetailsStatusTypeFailedCostDetailsStatusType` +- New const `ScheduledActionKindEmail` +- New const `CheckNameAvailabilityReasonAlreadyExists` +- New const `ScheduledActionStatusDisabled` +- New const `CreatedByTypeKey` +- New const `DaysOfWeekWednesday` +- New const `OriginUser` +- New const `OriginSystem` +- New const `ScheduledActionStatusExpired` +- New const `CheckNameAvailabilityReasonInvalid` +- New const `DaysOfWeekSaturday` +- New const `WeeksOfMonthSecond` +- New const `DaysOfWeekFriday` +- New const `ScheduleFrequencyMonthly` +- New const `CostDetailsMetricTypeAmortizedCostCostDetailsMetricType` +- New const `CreatedByTypeManagedIdentity` +- New const `FileFormatCSV` +- New const `OriginUserSystem` +- New const `DaysOfWeekMonday` +- New const `WeeksOfMonthThird` +- New type alias `FileFormat` +- New type alias `ScheduleFrequency` +- New type alias `ScheduledActionStatus` +- New type alias `CostDetailsDataFormat` +- New type alias `WeeksOfMonth` +- New type alias `CostDetailsMetricType` +- New type alias `CreatedByType` +- New type alias `ScheduledActionKind` +- New type alias `DaysOfWeek` +- New type alias `ActionType` +- New type alias `CheckNameAvailabilityReason` +- New type alias `CostDetailsStatusType` +- New type alias `Origin` +- New function `*ScheduledActionsClient.NewListPager(*ScheduledActionsClientListOptions) *runtime.Pager[ScheduledActionsClientListResponse]` +- New function `NewGenerateCostDetailsReportClient(azcore.TokenCredential, *arm.ClientOptions) (*GenerateCostDetailsReportClient, error)` +- New function `*ScheduledActionsClient.GetByScope(context.Context, string, string, *ScheduledActionsClientGetByScopeOptions) (ScheduledActionsClientGetByScopeResponse, error)` +- New function `*ScheduledActionsClient.NewListByScopePager(string, *ScheduledActionsClientListByScopeOptions) *runtime.Pager[ScheduledActionsClientListByScopeResponse]` +- New function `PossibleOriginValues() []Origin` +- New function `*ScheduledActionsClient.CreateOrUpdateByScope(context.Context, string, string, ScheduledAction, *ScheduledActionsClientCreateOrUpdateByScopeOptions) (ScheduledActionsClientCreateOrUpdateByScopeResponse, error)` +- New function `*PriceSheetClient.BeginDownloadByBillingProfile(context.Context, string, string, *PriceSheetClientBeginDownloadByBillingProfileOptions) (*runtime.Poller[PriceSheetClientDownloadByBillingProfileResponse], error)` +- New function `PossibleScheduleFrequencyValues() []ScheduleFrequency` +- New function `NewScheduledActionsClient(azcore.TokenCredential, *arm.ClientOptions) (*ScheduledActionsClient, error)` +- New function `PossibleScheduledActionStatusValues() []ScheduledActionStatus` +- New function `PossibleCostDetailsStatusTypeValues() []CostDetailsStatusType` +- New function `*ScheduledActionsClient.ExecuteByScope(context.Context, string, string, *ScheduledActionsClientExecuteByScopeOptions) (ScheduledActionsClientExecuteByScopeResponse, error)` +- New function `PossibleCostDetailsMetricTypeValues() []CostDetailsMetricType` +- New function `*PriceSheetClient.BeginDownload(context.Context, string, string, string, *PriceSheetClientBeginDownloadOptions) (*runtime.Poller[PriceSheetClientDownloadResponse], error)` +- New function `NewPriceSheetClient(azcore.TokenCredential, *arm.ClientOptions) (*PriceSheetClient, error)` +- New function `PossibleActionTypeValues() []ActionType` +- New function `*ScheduledActionsClient.CheckNameAvailabilityByScope(context.Context, string, CheckNameAvailabilityRequest, *ScheduledActionsClientCheckNameAvailabilityByScopeOptions) (ScheduledActionsClientCheckNameAvailabilityByScopeResponse, error)` +- New function `*ScheduledActionsClient.CreateOrUpdate(context.Context, string, ScheduledAction, *ScheduledActionsClientCreateOrUpdateOptions) (ScheduledActionsClientCreateOrUpdateResponse, error)` +- New function `PossibleCheckNameAvailabilityReasonValues() []CheckNameAvailabilityReason` +- New function `PossibleFileFormatValues() []FileFormat` +- New function `PossibleCreatedByTypeValues() []CreatedByType` +- New function `*ScheduledActionsClient.Delete(context.Context, string, *ScheduledActionsClientDeleteOptions) (ScheduledActionsClientDeleteResponse, error)` +- New function `PossibleWeeksOfMonthValues() []WeeksOfMonth` +- New function `*ScheduledActionsClient.Get(context.Context, string, *ScheduledActionsClientGetOptions) (ScheduledActionsClientGetResponse, error)` +- New function `*GenerateCostDetailsReportClient.BeginGetOperationResults(context.Context, string, string, *GenerateCostDetailsReportClientBeginGetOperationResultsOptions) (*runtime.Poller[GenerateCostDetailsReportClientGetOperationResultsResponse], error)` +- New function `*GenerateCostDetailsReportClient.BeginCreateOperation(context.Context, string, GenerateCostDetailsReportRequestDefinition, *GenerateCostDetailsReportClientBeginCreateOperationOptions) (*runtime.Poller[GenerateCostDetailsReportClientCreateOperationResponse], error)` +- New function `PossibleDaysOfWeekValues() []DaysOfWeek` +- New function `*ScheduledActionsClient.DeleteByScope(context.Context, string, string, *ScheduledActionsClientDeleteByScopeOptions) (ScheduledActionsClientDeleteByScopeResponse, error)` +- New function `PossibleCostDetailsDataFormatValues() []CostDetailsDataFormat` +- New function `*ScheduledActionsClient.Execute(context.Context, string, *ScheduledActionsClientExecuteOptions) (ScheduledActionsClientExecuteResponse, error)` +- New function `PossibleScheduledActionKindValues() []ScheduledActionKind` +- New function `*ScheduledActionsClient.CheckNameAvailability(context.Context, CheckNameAvailabilityRequest, *ScheduledActionsClientCheckNameAvailabilityOptions) (ScheduledActionsClientCheckNameAvailabilityResponse, error)` +- New struct `BlobInfo` +- New struct `CheckNameAvailabilityRequest` +- New struct `CheckNameAvailabilityResponse` +- New struct `CostDetailsOperationResults` +- New struct `CostDetailsTimePeriod` +- New struct `FileDestination` +- New struct `GenerateCostDetailsReportClient` +- New struct `GenerateCostDetailsReportClientBeginCreateOperationOptions` +- New struct `GenerateCostDetailsReportClientBeginGetOperationResultsOptions` +- New struct `GenerateCostDetailsReportClientCreateOperationResponse` +- New struct `GenerateCostDetailsReportClientGetOperationResultsResponse` +- New struct `GenerateCostDetailsReportErrorResponse` +- New struct `GenerateCostDetailsReportRequestDefinition` +- New struct `NotificationProperties` +- New struct `OperationForCostManagement` +- New struct `PriceSheetClient` +- New struct `PriceSheetClientBeginDownloadByBillingProfileOptions` +- New struct `PriceSheetClientBeginDownloadOptions` +- New struct `PriceSheetClientDownloadByBillingProfileResponse` +- New struct `PriceSheetClientDownloadResponse` +- New struct `ReportManifest` +- New struct `RequestContext` +- 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 `ScheduledActionsClientExecuteByScopeOptions` +- New struct `ScheduledActionsClientExecuteByScopeResponse` +- New struct `ScheduledActionsClientExecuteOptions` +- New struct `ScheduledActionsClientExecuteResponse` +- 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 `SystemData` +- New field `ActionType` in struct `Operation` +- New field `IsDataAction` in struct `Operation` +- New field `Origin` in struct `Operation` +- New field `SystemData` in struct `Resource` +- New field `ExpiryTime` in struct `DownloadURL` +- New field `URL` in struct `DownloadURL` +- New field `SystemData` in struct `ProxyResource` + + ## 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/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/constants.go b/sdk/resourcemanager/costmanagement/armcostmanagement/constants.go new file mode 100644 index 000000000000..aa7a7fa08cdd --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/constants.go @@ -0,0 +1,261 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcostmanagement + +const ( + moduleName = "armcostmanagement" + moduleVersion = "v2.0.0" +) + +// 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, + } +} + +// 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, + } +} + +// FileFormat - Destination of the view data. Currently only CSV format is supported. +type FileFormat string + +const ( + FileFormatCSV FileFormat = "Csv" +) + +// PossibleFileFormatValues returns the possible values for the FileFormat const type. +func PossibleFileFormatValues() []FileFormat { + return []FileFormat{ + FileFormatCSV, + } +} + +// 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, + } +} + +// 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 executed. + ScheduledActionStatusDisabled ScheduledActionStatus = "Disabled" + // ScheduledActionStatusEnabled - Scheduled action is saved and will be executed. + 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, + } +} + +// 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/generatecostdetailsreport_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/generatecostdetailsreport_client.go new file mode 100644 index 000000000000..121eb648950a --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/generatecostdetailsreport_client.go @@ -0,0 +1,205 @@ +//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 scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' for subscription +// scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for +// Billing Account scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' +// for EnrollmentAccount +// scope. Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for billingAccount +// scope, +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile +// scope, +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' +// for invoiceSection scope, and +// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. +// parameters - Parameters supplied to the Create 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 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. +// 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/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..3099d2d15e89 --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/models.go @@ -0,0 +1,557 @@ +//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" + +// 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"` +} + +// 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"` +} + +// DownloadURL - A secure URL that can be used to download a an entity until the URL expires. +type DownloadURL struct { + // READ-ONLY; The time in UTC when the download URL will expire. + ExpiryTime *time.Time `json:"expiryTime,omitempty" azure:"ro"` + + // READ-ONLY; The URL to the ZIP file. This Zip file will consists of multiple CSV files + URL *string `json:"url,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"` +} + +// 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"` +} + +// 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"` +} + +// 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"` +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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; Azure Resource Manager metadata containing createdBy and modifiedBy information. + 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"` +} + +// 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"` +} + +// 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; Azure Resource Manager metadata containing createdBy and modifiedBy information. + 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"` +} + +// 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; Azure Resource Manager metadata containing createdBy and modifiedBy information. + 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; Azure Resource Manager metadata containing createdBy and modifiedBy information. + 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 +} + +// ScheduledActionsClientExecuteByScopeOptions contains the optional parameters for the ScheduledActionsClient.ExecuteByScope +// method. +type ScheduledActionsClientExecuteByScopeOptions struct { + // placeholder for future optional parameters +} + +// ScheduledActionsClientExecuteOptions contains the optional parameters for the ScheduledActionsClient.Execute method. +type ScheduledActionsClientExecuteOptions 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 +} + +// 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"` +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/models_serde.go b/sdk/resourcemanager/costmanagement/armcostmanagement/models_serde.go new file mode 100644 index 000000000000..41e02e1707be --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/models_serde.go @@ -0,0 +1,1043 @@ +//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 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 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 DownloadURL. +func (d DownloadURL) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "expiryTime", d.ExpiryTime) + populate(objectMap, "url", d.URL) + 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 "expiryTime": + err = unpopulateTimeRFC3339(val, "ExpiryTime", &d.ExpiryTime) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &d.URL) + 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 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 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 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 ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "systemData", p.SystemData) + 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 "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + 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 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 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, "systemData", r.SystemData) + 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 "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + 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 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 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 +} + +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 98% rename from sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_operations_client.go rename to sdk/resourcemanager/costmanagement/armcostmanagement/operations_client.go index f34e2f76b719..974acc9062f5 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,7 +50,6 @@ 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 // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { 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/response_types.go b/sdk/resourcemanager/costmanagement/armcostmanagement/response_types.go new file mode 100644 index 000000000000..9b6a30b6843e --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/response_types.go @@ -0,0 +1,95 @@ +//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 + +// GenerateCostDetailsReportClientCreateOperationResponse contains the response from method GenerateCostDetailsReportClient.CreateOperation. +type GenerateCostDetailsReportClientCreateOperationResponse struct { + CostDetailsOperationResults +} + +// GenerateCostDetailsReportClientGetOperationResultsResponse contains the response from method GenerateCostDetailsReportClient.GetOperationResults. +type GenerateCostDetailsReportClientGetOperationResultsResponse struct { + CostDetailsOperationResults +} + +// OperationsClientListResponse contains the response from method OperationsClient.List. +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 +} + +// 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 +} + +// ScheduledActionsClientExecuteByScopeResponse contains the response from method ScheduledActionsClient.ExecuteByScope. +type ScheduledActionsClientExecuteByScopeResponse struct { + // placeholder for future response values +} + +// ScheduledActionsClientExecuteResponse contains the response from method ScheduledActionsClient.Execute. +type ScheduledActionsClientExecuteResponse 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 +} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/scheduledactions_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/scheduledactions_client.go new file mode 100644 index 000000000000..3bcee3de98d7 --- /dev/null +++ b/sdk/resourcemanager/costmanagement/armcostmanagement/scheduledactions_client.go @@ -0,0 +1,713 @@ +//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 +} + +// Execute - Execute 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 - ScheduledActionsClientExecuteOptions contains the optional parameters for the ScheduledActionsClient.Execute +// method. +func (client *ScheduledActionsClient) Execute(ctx context.Context, name string, options *ScheduledActionsClientExecuteOptions) (ScheduledActionsClientExecuteResponse, error) { + req, err := client.executeCreateRequest(ctx, name, options) + if err != nil { + return ScheduledActionsClientExecuteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ScheduledActionsClientExecuteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScheduledActionsClientExecuteResponse{}, runtime.NewResponseError(resp) + } + return ScheduledActionsClientExecuteResponse{}, nil +} + +// executeCreateRequest creates the Execute request. +func (client *ScheduledActionsClient) executeCreateRequest(ctx context.Context, name string, options *ScheduledActionsClientExecuteOptions) (*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 +} + +// ExecuteByScope - Execute 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 - ScheduledActionsClientExecuteByScopeOptions contains the optional parameters for the ScheduledActionsClient.ExecuteByScope +// method. +func (client *ScheduledActionsClient) ExecuteByScope(ctx context.Context, scope string, name string, options *ScheduledActionsClientExecuteByScopeOptions) (ScheduledActionsClientExecuteByScopeResponse, error) { + req, err := client.executeByScopeCreateRequest(ctx, scope, name, options) + if err != nil { + return ScheduledActionsClientExecuteByScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ScheduledActionsClientExecuteByScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScheduledActionsClientExecuteByScopeResponse{}, runtime.NewResponseError(resp) + } + return ScheduledActionsClientExecuteByScopeResponse{}, nil +} + +// executeByScopeCreateRequest creates the ExecuteByScope request. +func (client *ScheduledActionsClient) executeByScopeCreateRequest(ctx context.Context, scope string, name string, options *ScheduledActionsClientExecuteByScopeOptions) (*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 +} + +// 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 +} 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/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_alerts_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_alerts_client.go deleted file mode 100644 index dbf434140de9..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_alerts_client.go +++ /dev/null @@ -1,270 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcostmanagement - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// AlertsClient contains the methods for the Alerts group. -// Don't use this type directly, use NewAlertsClient() instead. -type AlertsClient struct { - host string - pl runtime.Pipeline -} - -// NewAlertsClient creates a new instance of AlertsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewAlertsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &AlertsClient{ - host: ep, - pl: pl, - } - return client, nil -} - -// Dismiss - Dismisses the specified alert -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// scope - The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for -// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount -// scope, -// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// alertID - Alert ID -// parameters - Parameters supplied to the Dismiss Alert operation. -// options - AlertsClientDismissOptions contains the optional parameters for the AlertsClient.Dismiss method. -func (client *AlertsClient) Dismiss(ctx context.Context, scope string, alertID string, parameters DismissAlertPayload, options *AlertsClientDismissOptions) (AlertsClientDismissResponse, error) { - req, err := client.dismissCreateRequest(ctx, scope, alertID, parameters, options) - if err != nil { - return AlertsClientDismissResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return AlertsClientDismissResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AlertsClientDismissResponse{}, runtime.NewResponseError(resp) - } - return client.dismissHandleResponse(resp) -} - -// dismissCreateRequest creates the Dismiss request. -func (client *AlertsClient) dismissCreateRequest(ctx context.Context, scope string, alertID string, parameters DismissAlertPayload, options *AlertsClientDismissOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - urlPath = strings.ReplaceAll(urlPath, "{alertId}", alertID) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// dismissHandleResponse handles the Dismiss response. -func (client *AlertsClient) dismissHandleResponse(resp *http.Response) (AlertsClientDismissResponse, error) { - result := AlertsClientDismissResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Alert); err != nil { - return AlertsClientDismissResponse{}, err - } - return result, nil -} - -// Get - Gets the alert for the scope by alert ID. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// scope - The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for -// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount -// scope, -// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// alertID - Alert ID -// options - AlertsClientGetOptions contains the optional parameters for the AlertsClient.Get method. -func (client *AlertsClient) Get(ctx context.Context, scope string, alertID string, options *AlertsClientGetOptions) (AlertsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, scope, alertID, options) - if err != nil { - return AlertsClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return AlertsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AlertsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *AlertsClient) getCreateRequest(ctx context.Context, scope string, alertID string, options *AlertsClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - urlPath = strings.ReplaceAll(urlPath, "{alertId}", alertID) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *AlertsClient) getHandleResponse(resp *http.Response) (AlertsClientGetResponse, error) { - result := AlertsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Alert); err != nil { - return AlertsClientGetResponse{}, err - } - return result, nil -} - -// List - Lists the alerts for scope defined. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// scope - The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for -// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount -// scope, -// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// options - AlertsClientListOptions contains the optional parameters for the AlertsClient.List method. -func (client *AlertsClient) List(ctx context.Context, scope string, options *AlertsClientListOptions) (AlertsClientListResponse, error) { - req, err := client.listCreateRequest(ctx, scope, options) - if err != nil { - return AlertsClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return AlertsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AlertsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) -} - -// listCreateRequest creates the List request. -func (client *AlertsClient) listCreateRequest(ctx context.Context, scope string, options *AlertsClientListOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.CostManagement/alerts" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *AlertsClient) listHandleResponse(resp *http.Response) (AlertsClientListResponse, error) { - result := AlertsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AlertsResult); err != nil { - return AlertsClientListResponse{}, err - } - return result, nil -} - -// ListExternal - Lists the Alerts for external cloud provider type defined. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// externalCloudProviderType - The external cloud provider type associated with dimension/query operations. This includes -// 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. -// externalCloudProviderID - This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for -// consolidated account used with dimension/query operations. -// options - AlertsClientListExternalOptions contains the optional parameters for the AlertsClient.ListExternal method. -func (client *AlertsClient) ListExternal(ctx context.Context, externalCloudProviderType ExternalCloudProviderType, externalCloudProviderID string, options *AlertsClientListExternalOptions) (AlertsClientListExternalResponse, error) { - req, err := client.listExternalCreateRequest(ctx, externalCloudProviderType, externalCloudProviderID, options) - if err != nil { - return AlertsClientListExternalResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return AlertsClientListExternalResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AlertsClientListExternalResponse{}, runtime.NewResponseError(resp) - } - return client.listExternalHandleResponse(resp) -} - -// listExternalCreateRequest creates the ListExternal request. -func (client *AlertsClient) listExternalCreateRequest(ctx context.Context, externalCloudProviderType ExternalCloudProviderType, externalCloudProviderID string, options *AlertsClientListExternalOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts" - if externalCloudProviderType == "" { - return nil, errors.New("parameter externalCloudProviderType cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{externalCloudProviderType}", url.PathEscape(string(externalCloudProviderType))) - if externalCloudProviderID == "" { - return nil, errors.New("parameter externalCloudProviderID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{externalCloudProviderId}", url.PathEscape(externalCloudProviderID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listExternalHandleResponse handles the ListExternal response. -func (client *AlertsClient) listExternalHandleResponse(resp *http.Response) (AlertsClientListExternalResponse, error) { - result := AlertsClientListExternalResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AlertsResult); err != nil { - return AlertsClientListExternalResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_constants.go b/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_constants.go deleted file mode 100644 index 0ddb618dc87d..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_constants.go +++ /dev/null @@ -1,722 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcostmanagement - -const ( - moduleName = "armcostmanagement" - moduleVersion = "v1.0.0" -) - -// AccumulatedType - Show costs accumulated over time. -type AccumulatedType string - -const ( - AccumulatedTypeFalse AccumulatedType = "false" - AccumulatedTypeTrue AccumulatedType = "true" -) - -// PossibleAccumulatedTypeValues returns the possible values for the AccumulatedType const type. -func PossibleAccumulatedTypeValues() []AccumulatedType { - return []AccumulatedType{ - AccumulatedTypeFalse, - AccumulatedTypeTrue, - } -} - -// AlertCategory - Alert category -type AlertCategory string - -const ( - AlertCategoryBilling AlertCategory = "Billing" - AlertCategoryCost AlertCategory = "Cost" - AlertCategorySystem AlertCategory = "System" - AlertCategoryUsage AlertCategory = "Usage" -) - -// PossibleAlertCategoryValues returns the possible values for the AlertCategory const type. -func PossibleAlertCategoryValues() []AlertCategory { - return []AlertCategory{ - AlertCategoryBilling, - AlertCategoryCost, - AlertCategorySystem, - AlertCategoryUsage, - } -} - -// AlertCriteria - Criteria that triggered alert -type AlertCriteria string - -const ( - AlertCriteriaCostThresholdExceeded AlertCriteria = "CostThresholdExceeded" - AlertCriteriaCreditThresholdApproaching AlertCriteria = "CreditThresholdApproaching" - AlertCriteriaCreditThresholdReached AlertCriteria = "CreditThresholdReached" - AlertCriteriaCrossCloudCollectionError AlertCriteria = "CrossCloudCollectionError" - AlertCriteriaCrossCloudNewDataAvailable AlertCriteria = "CrossCloudNewDataAvailable" - AlertCriteriaForecastCostThresholdExceeded AlertCriteria = "ForecastCostThresholdExceeded" - AlertCriteriaForecastUsageThresholdExceeded AlertCriteria = "ForecastUsageThresholdExceeded" - AlertCriteriaGeneralThresholdError AlertCriteria = "GeneralThresholdError" - AlertCriteriaInvoiceDueDateApproaching AlertCriteria = "InvoiceDueDateApproaching" - AlertCriteriaInvoiceDueDateReached AlertCriteria = "InvoiceDueDateReached" - AlertCriteriaMultiCurrency AlertCriteria = "MultiCurrency" - AlertCriteriaQuotaThresholdApproaching AlertCriteria = "QuotaThresholdApproaching" - AlertCriteriaQuotaThresholdReached AlertCriteria = "QuotaThresholdReached" - AlertCriteriaUsageThresholdExceeded AlertCriteria = "UsageThresholdExceeded" -) - -// PossibleAlertCriteriaValues returns the possible values for the AlertCriteria const type. -func PossibleAlertCriteriaValues() []AlertCriteria { - return []AlertCriteria{ - AlertCriteriaCostThresholdExceeded, - AlertCriteriaCreditThresholdApproaching, - AlertCriteriaCreditThresholdReached, - AlertCriteriaCrossCloudCollectionError, - AlertCriteriaCrossCloudNewDataAvailable, - AlertCriteriaForecastCostThresholdExceeded, - AlertCriteriaForecastUsageThresholdExceeded, - AlertCriteriaGeneralThresholdError, - AlertCriteriaInvoiceDueDateApproaching, - AlertCriteriaInvoiceDueDateReached, - AlertCriteriaMultiCurrency, - AlertCriteriaQuotaThresholdApproaching, - AlertCriteriaQuotaThresholdReached, - AlertCriteriaUsageThresholdExceeded, - } -} - -// AlertOperator - operator used to compare currentSpend with amount -type AlertOperator string - -const ( - AlertOperatorEqualTo AlertOperator = "EqualTo" - AlertOperatorGreaterThan AlertOperator = "GreaterThan" - AlertOperatorGreaterThanOrEqualTo AlertOperator = "GreaterThanOrEqualTo" - AlertOperatorLessThan AlertOperator = "LessThan" - AlertOperatorLessThanOrEqualTo AlertOperator = "LessThanOrEqualTo" - AlertOperatorNone AlertOperator = "None" -) - -// PossibleAlertOperatorValues returns the possible values for the AlertOperator const type. -func PossibleAlertOperatorValues() []AlertOperator { - return []AlertOperator{ - AlertOperatorEqualTo, - AlertOperatorGreaterThan, - AlertOperatorGreaterThanOrEqualTo, - AlertOperatorLessThan, - AlertOperatorLessThanOrEqualTo, - AlertOperatorNone, - } -} - -// AlertSource - Source of alert -type AlertSource string - -const ( - AlertSourcePreset AlertSource = "Preset" - AlertSourceUser AlertSource = "User" -) - -// PossibleAlertSourceValues returns the possible values for the AlertSource const type. -func PossibleAlertSourceValues() []AlertSource { - return []AlertSource{ - AlertSourcePreset, - AlertSourceUser, - } -} - -// AlertStatus - alert status -type AlertStatus string - -const ( - AlertStatusActive AlertStatus = "Active" - AlertStatusDismissed AlertStatus = "Dismissed" - AlertStatusNone AlertStatus = "None" - AlertStatusOverridden AlertStatus = "Overridden" - AlertStatusResolved AlertStatus = "Resolved" -) - -// PossibleAlertStatusValues returns the possible values for the AlertStatus const type. -func PossibleAlertStatusValues() []AlertStatus { - return []AlertStatus{ - AlertStatusActive, - AlertStatusDismissed, - AlertStatusNone, - AlertStatusOverridden, - AlertStatusResolved, - } -} - -// AlertTimeGrainType - Type of timegrain cadence -type AlertTimeGrainType string - -const ( - AlertTimeGrainTypeAnnually AlertTimeGrainType = "Annually" - AlertTimeGrainTypeBillingAnnual AlertTimeGrainType = "BillingAnnual" - AlertTimeGrainTypeBillingMonth AlertTimeGrainType = "BillingMonth" - AlertTimeGrainTypeBillingQuarter AlertTimeGrainType = "BillingQuarter" - AlertTimeGrainTypeMonthly AlertTimeGrainType = "Monthly" - AlertTimeGrainTypeNone AlertTimeGrainType = "None" - AlertTimeGrainTypeQuarterly AlertTimeGrainType = "Quarterly" -) - -// PossibleAlertTimeGrainTypeValues returns the possible values for the AlertTimeGrainType const type. -func PossibleAlertTimeGrainTypeValues() []AlertTimeGrainType { - return []AlertTimeGrainType{ - AlertTimeGrainTypeAnnually, - AlertTimeGrainTypeBillingAnnual, - AlertTimeGrainTypeBillingMonth, - AlertTimeGrainTypeBillingQuarter, - AlertTimeGrainTypeMonthly, - AlertTimeGrainTypeNone, - AlertTimeGrainTypeQuarterly, - } -} - -// AlertType - type of alert -type AlertType string - -const ( - AlertTypeBudget AlertType = "Budget" - AlertTypeBudgetForecast AlertType = "BudgetForecast" - AlertTypeCredit AlertType = "Credit" - AlertTypeGeneral AlertType = "General" - AlertTypeInvoice AlertType = "Invoice" - AlertTypeQuota AlertType = "Quota" - AlertTypeXCloud AlertType = "xCloud" -) - -// PossibleAlertTypeValues returns the possible values for the AlertType const type. -func PossibleAlertTypeValues() []AlertType { - return []AlertType{ - AlertTypeBudget, - AlertTypeBudgetForecast, - AlertTypeCredit, - AlertTypeGeneral, - AlertTypeInvoice, - AlertTypeQuota, - AlertTypeXCloud, - } -} - -// ChartType - Chart type of the main view in Cost Analysis. Required. -type ChartType string - -const ( - ChartTypeArea ChartType = "Area" - ChartTypeGroupedColumn ChartType = "GroupedColumn" - ChartTypeLine ChartType = "Line" - ChartTypeStackedColumn ChartType = "StackedColumn" - ChartTypeTable ChartType = "Table" -) - -// PossibleChartTypeValues returns the possible values for the ChartType const type. -func PossibleChartTypeValues() []ChartType { - return []ChartType{ - ChartTypeArea, - ChartTypeGroupedColumn, - ChartTypeLine, - ChartTypeStackedColumn, - ChartTypeTable, - } -} - -// ExecutionStatus - The last known status of the export execution. -type ExecutionStatus string - -const ( - ExecutionStatusCompleted ExecutionStatus = "Completed" - ExecutionStatusDataNotAvailable ExecutionStatus = "DataNotAvailable" - ExecutionStatusFailed ExecutionStatus = "Failed" - ExecutionStatusInProgress ExecutionStatus = "InProgress" - ExecutionStatusNewDataNotAvailable ExecutionStatus = "NewDataNotAvailable" - ExecutionStatusQueued ExecutionStatus = "Queued" - ExecutionStatusTimeout ExecutionStatus = "Timeout" -) - -// PossibleExecutionStatusValues returns the possible values for the ExecutionStatus const type. -func PossibleExecutionStatusValues() []ExecutionStatus { - return []ExecutionStatus{ - ExecutionStatusCompleted, - ExecutionStatusDataNotAvailable, - ExecutionStatusFailed, - ExecutionStatusInProgress, - ExecutionStatusNewDataNotAvailable, - ExecutionStatusQueued, - ExecutionStatusTimeout, - } -} - -// ExecutionType - The type of the export execution. -type ExecutionType string - -const ( - ExecutionTypeOnDemand ExecutionType = "OnDemand" - ExecutionTypeScheduled ExecutionType = "Scheduled" -) - -// PossibleExecutionTypeValues returns the possible values for the ExecutionType const type. -func PossibleExecutionTypeValues() []ExecutionType { - return []ExecutionType{ - ExecutionTypeOnDemand, - ExecutionTypeScheduled, - } -} - -// ExportType - The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that -// do not yet provide data for charges or amortization for service reservations. -type ExportType string - -const ( - ExportTypeActualCost ExportType = "ActualCost" - ExportTypeAmortizedCost ExportType = "AmortizedCost" - ExportTypeUsage ExportType = "Usage" -) - -// PossibleExportTypeValues returns the possible values for the ExportType const type. -func PossibleExportTypeValues() []ExportType { - return []ExportType{ - ExportTypeActualCost, - ExportTypeAmortizedCost, - ExportTypeUsage, - } -} - -type ExternalCloudProviderType string - -const ( - ExternalCloudProviderTypeExternalBillingAccounts ExternalCloudProviderType = "externalBillingAccounts" - ExternalCloudProviderTypeExternalSubscriptions ExternalCloudProviderType = "externalSubscriptions" -) - -// PossibleExternalCloudProviderTypeValues returns the possible values for the ExternalCloudProviderType const type. -func PossibleExternalCloudProviderTypeValues() []ExternalCloudProviderType { - return []ExternalCloudProviderType{ - ExternalCloudProviderTypeExternalBillingAccounts, - ExternalCloudProviderTypeExternalSubscriptions, - } -} - -// ForecastTimeframeType - The time frame for pulling data for the forecast. If custom, then a specific time period must be -// provided. -type ForecastTimeframeType string - -const ( - ForecastTimeframeTypeBillingMonthToDate ForecastTimeframeType = "BillingMonthToDate" - ForecastTimeframeTypeCustom ForecastTimeframeType = "Custom" - ForecastTimeframeTypeMonthToDate ForecastTimeframeType = "MonthToDate" - ForecastTimeframeTypeTheLastBillingMonth ForecastTimeframeType = "TheLastBillingMonth" - ForecastTimeframeTypeTheLastMonth ForecastTimeframeType = "TheLastMonth" - ForecastTimeframeTypeWeekToDate ForecastTimeframeType = "WeekToDate" -) - -// PossibleForecastTimeframeTypeValues returns the possible values for the ForecastTimeframeType const type. -func PossibleForecastTimeframeTypeValues() []ForecastTimeframeType { - return []ForecastTimeframeType{ - ForecastTimeframeTypeBillingMonthToDate, - ForecastTimeframeTypeCustom, - ForecastTimeframeTypeMonthToDate, - ForecastTimeframeTypeTheLastBillingMonth, - ForecastTimeframeTypeTheLastMonth, - ForecastTimeframeTypeWeekToDate, - } -} - -// ForecastType - The type of the forecast. -type ForecastType string - -const ( - ForecastTypeActualCost ForecastType = "ActualCost" - ForecastTypeAmortizedCost ForecastType = "AmortizedCost" - ForecastTypeUsage ForecastType = "Usage" -) - -// PossibleForecastTypeValues returns the possible values for the ForecastType const type. -func PossibleForecastTypeValues() []ForecastType { - return []ForecastType{ - ForecastTypeActualCost, - ForecastTypeAmortizedCost, - ForecastTypeUsage, - } -} - -// FormatType - The format of the export being delivered. Currently only 'Csv' is supported. -type FormatType string - -const ( - FormatTypeCSV FormatType = "Csv" -) - -// PossibleFormatTypeValues returns the possible values for the FormatType const type. -func PossibleFormatTypeValues() []FormatType { - return []FormatType{ - FormatTypeCSV, - } -} - -// FunctionType - The name of the aggregation function to use. -type FunctionType string - -const ( - FunctionTypeSum FunctionType = "Sum" -) - -// PossibleFunctionTypeValues returns the possible values for the FunctionType const type. -func PossibleFunctionTypeValues() []FunctionType { - return []FunctionType{ - FunctionTypeSum, - } -} - -// GenerateDetailedCostReportMetricType - The type of the detailed report. By default ActualCost is provided -type GenerateDetailedCostReportMetricType string - -const ( - GenerateDetailedCostReportMetricTypeActualCost GenerateDetailedCostReportMetricType = "ActualCost" - GenerateDetailedCostReportMetricTypeAmortizedCost GenerateDetailedCostReportMetricType = "AmortizedCost" -) - -// PossibleGenerateDetailedCostReportMetricTypeValues returns the possible values for the GenerateDetailedCostReportMetricType const type. -func PossibleGenerateDetailedCostReportMetricTypeValues() []GenerateDetailedCostReportMetricType { - return []GenerateDetailedCostReportMetricType{ - GenerateDetailedCostReportMetricTypeActualCost, - GenerateDetailedCostReportMetricTypeAmortizedCost, - } -} - -// GranularityType - The granularity of rows in the export. Currently only 'Daily' is supported. -type GranularityType string - -const ( - GranularityTypeDaily GranularityType = "Daily" -) - -// PossibleGranularityTypeValues returns the possible values for the GranularityType const type. -func PossibleGranularityTypeValues() []GranularityType { - return []GranularityType{ - GranularityTypeDaily, - } -} - -// KpiType - KPI type (Forecast, Budget). -type KpiType string - -const ( - KpiTypeBudget KpiType = "Budget" - KpiTypeForecast KpiType = "Forecast" -) - -// PossibleKpiTypeValues returns the possible values for the KpiType const type. -func PossibleKpiTypeValues() []KpiType { - return []KpiType{ - KpiTypeBudget, - KpiTypeForecast, - } -} - -// MetricType - Metric to use when displaying costs. -type MetricType string - -const ( - MetricTypeAHUB MetricType = "AHUB" - MetricTypeActualCost MetricType = "ActualCost" - MetricTypeAmortizedCost MetricType = "AmortizedCost" -) - -// PossibleMetricTypeValues returns the possible values for the MetricType const type. -func PossibleMetricTypeValues() []MetricType { - return []MetricType{ - MetricTypeAHUB, - MetricTypeActualCost, - MetricTypeAmortizedCost, - } -} - -// OperationStatusType - The status of the long running operation. -type OperationStatusType string - -const ( - OperationStatusTypeCompleted OperationStatusType = "Completed" - OperationStatusTypeFailed OperationStatusType = "Failed" - OperationStatusTypeRunning OperationStatusType = "Running" -) - -// PossibleOperationStatusTypeValues returns the possible values for the OperationStatusType const type. -func PossibleOperationStatusTypeValues() []OperationStatusType { - return []OperationStatusType{ - OperationStatusTypeCompleted, - OperationStatusTypeFailed, - OperationStatusTypeRunning, - } -} - -// OperatorType - The operator to use for comparison. -type OperatorType string - -const ( - OperatorTypeContains OperatorType = "Contains" - OperatorTypeIn OperatorType = "In" -) - -// PossibleOperatorTypeValues returns the possible values for the OperatorType const type. -func PossibleOperatorTypeValues() []OperatorType { - return []OperatorType{ - OperatorTypeContains, - OperatorTypeIn, - } -} - -// PivotType - Data type to show in view. -type PivotType string - -const ( - PivotTypeDimension PivotType = "Dimension" - PivotTypeTagKey PivotType = "TagKey" -) - -// PossiblePivotTypeValues returns the possible values for the PivotType const type. -func PossiblePivotTypeValues() []PivotType { - return []PivotType{ - PivotTypeDimension, - PivotTypeTagKey, - } -} - -// QueryColumnType - The type of the column in the export. -type QueryColumnType string - -const ( - QueryColumnTypeDimension QueryColumnType = "Dimension" - QueryColumnTypeTag QueryColumnType = "Tag" -) - -// PossibleQueryColumnTypeValues returns the possible values for the QueryColumnType const type. -func PossibleQueryColumnTypeValues() []QueryColumnType { - return []QueryColumnType{ - QueryColumnTypeDimension, - QueryColumnTypeTag, - } -} - -// QueryOperatorType - The operator to use for comparison. -type QueryOperatorType string - -const ( - QueryOperatorTypeIn QueryOperatorType = "In" -) - -// PossibleQueryOperatorTypeValues returns the possible values for the QueryOperatorType const type. -func PossibleQueryOperatorTypeValues() []QueryOperatorType { - return []QueryOperatorType{ - QueryOperatorTypeIn, - } -} - -// RecurrenceType - The schedule recurrence. -type RecurrenceType string - -const ( - RecurrenceTypeAnnually RecurrenceType = "Annually" - RecurrenceTypeDaily RecurrenceType = "Daily" - RecurrenceTypeMonthly RecurrenceType = "Monthly" - RecurrenceTypeWeekly RecurrenceType = "Weekly" -) - -// PossibleRecurrenceTypeValues returns the possible values for the RecurrenceType const type. -func PossibleRecurrenceTypeValues() []RecurrenceType { - return []RecurrenceType{ - RecurrenceTypeAnnually, - RecurrenceTypeDaily, - RecurrenceTypeMonthly, - RecurrenceTypeWeekly, - } -} - -// ReportConfigColumnType - The type of the column in the report. -type ReportConfigColumnType string - -const ( - ReportConfigColumnTypeDimension ReportConfigColumnType = "Dimension" - ReportConfigColumnTypeTag ReportConfigColumnType = "Tag" -) - -// PossibleReportConfigColumnTypeValues returns the possible values for the ReportConfigColumnType const type. -func PossibleReportConfigColumnTypeValues() []ReportConfigColumnType { - return []ReportConfigColumnType{ - ReportConfigColumnTypeDimension, - ReportConfigColumnTypeTag, - } -} - -// ReportConfigSortingType - Direction of sort. -type ReportConfigSortingType string - -const ( - ReportConfigSortingTypeAscending ReportConfigSortingType = "Ascending" - ReportConfigSortingTypeDescending ReportConfigSortingType = "Descending" -) - -// PossibleReportConfigSortingTypeValues returns the possible values for the ReportConfigSortingType const type. -func PossibleReportConfigSortingTypeValues() []ReportConfigSortingType { - return []ReportConfigSortingType{ - ReportConfigSortingTypeAscending, - ReportConfigSortingTypeDescending, - } -} - -// ReportGranularityType - The granularity of rows in the report. -type ReportGranularityType string - -const ( - ReportGranularityTypeDaily ReportGranularityType = "Daily" - ReportGranularityTypeMonthly ReportGranularityType = "Monthly" -) - -// PossibleReportGranularityTypeValues returns the possible values for the ReportGranularityType const type. -func PossibleReportGranularityTypeValues() []ReportGranularityType { - return []ReportGranularityType{ - ReportGranularityTypeDaily, - ReportGranularityTypeMonthly, - } -} - -// ReportOperationStatusType - The status of the long running operation. -type ReportOperationStatusType string - -const ( - ReportOperationStatusTypeCompleted ReportOperationStatusType = "Completed" - ReportOperationStatusTypeFailed ReportOperationStatusType = "Failed" - ReportOperationStatusTypeInProgress ReportOperationStatusType = "InProgress" - ReportOperationStatusTypeNoDataFound ReportOperationStatusType = "NoDataFound" - ReportOperationStatusTypeQueued ReportOperationStatusType = "Queued" - ReportOperationStatusTypeReadyToDownload ReportOperationStatusType = "ReadyToDownload" - ReportOperationStatusTypeTimedOut ReportOperationStatusType = "TimedOut" -) - -// PossibleReportOperationStatusTypeValues returns the possible values for the ReportOperationStatusType const type. -func PossibleReportOperationStatusTypeValues() []ReportOperationStatusType { - return []ReportOperationStatusType{ - ReportOperationStatusTypeCompleted, - ReportOperationStatusTypeFailed, - ReportOperationStatusTypeInProgress, - ReportOperationStatusTypeNoDataFound, - ReportOperationStatusTypeQueued, - ReportOperationStatusTypeReadyToDownload, - ReportOperationStatusTypeTimedOut, - } -} - -// ReportTimeframeType - The time frame for pulling data for the report. If custom, then a specific time period must be provided. -type ReportTimeframeType string - -const ( - ReportTimeframeTypeCustom ReportTimeframeType = "Custom" - ReportTimeframeTypeMonthToDate ReportTimeframeType = "MonthToDate" - ReportTimeframeTypeWeekToDate ReportTimeframeType = "WeekToDate" - ReportTimeframeTypeYearToDate ReportTimeframeType = "YearToDate" -) - -// PossibleReportTimeframeTypeValues returns the possible values for the ReportTimeframeType const type. -func PossibleReportTimeframeTypeValues() []ReportTimeframeType { - return []ReportTimeframeType{ - ReportTimeframeTypeCustom, - ReportTimeframeTypeMonthToDate, - ReportTimeframeTypeWeekToDate, - ReportTimeframeTypeYearToDate, - } -} - -// ReportType - The type of the report. Usage represents actual usage, forecast represents forecasted data and UsageAndForecast -// represents both usage and forecasted data. Actual usage and forecasted data can be -// differentiated based on dates. -type ReportType string - -const ( - ReportTypeUsage ReportType = "Usage" -) - -// PossibleReportTypeValues returns the possible values for the ReportType const type. -func PossibleReportTypeValues() []ReportType { - return []ReportType{ - ReportTypeUsage, - } -} - -// ReservationReportSchema - The CSV file from the reportUrl blob link consists of reservation usage data with the following -// schema at daily granularity -type ReservationReportSchema string - -const ( - ReservationReportSchemaInstanceFlexibilityGroup ReservationReportSchema = "InstanceFlexibilityGroup" - ReservationReportSchemaInstanceFlexibilityRatio ReservationReportSchema = "InstanceFlexibilityRatio" - ReservationReportSchemaInstanceID ReservationReportSchema = "InstanceId" - ReservationReportSchemaKind ReservationReportSchema = "Kind" - ReservationReportSchemaReservationID ReservationReportSchema = "ReservationId" - ReservationReportSchemaReservationOrderID ReservationReportSchema = "ReservationOrderId" - ReservationReportSchemaReservedHours ReservationReportSchema = "ReservedHours" - ReservationReportSchemaSKUName ReservationReportSchema = "SkuName" - ReservationReportSchemaTotalReservedQuantity ReservationReportSchema = "TotalReservedQuantity" - ReservationReportSchemaUsageDate ReservationReportSchema = "UsageDate" - ReservationReportSchemaUsedHours ReservationReportSchema = "UsedHours" -) - -// PossibleReservationReportSchemaValues returns the possible values for the ReservationReportSchema const type. -func PossibleReservationReportSchemaValues() []ReservationReportSchema { - return []ReservationReportSchema{ - ReservationReportSchemaInstanceFlexibilityGroup, - ReservationReportSchemaInstanceFlexibilityRatio, - ReservationReportSchemaInstanceID, - ReservationReportSchemaKind, - ReservationReportSchemaReservationID, - ReservationReportSchemaReservationOrderID, - ReservationReportSchemaReservedHours, - ReservationReportSchemaSKUName, - ReservationReportSchemaTotalReservedQuantity, - ReservationReportSchemaUsageDate, - ReservationReportSchemaUsedHours, - } -} - -// StatusType - The status of the export's schedule. If 'Inactive', the export's schedule is paused. -type StatusType string - -const ( - StatusTypeActive StatusType = "Active" - StatusTypeInactive StatusType = "Inactive" -) - -// PossibleStatusTypeValues returns the possible values for the StatusType const type. -func PossibleStatusTypeValues() []StatusType { - return []StatusType{ - StatusTypeActive, - StatusTypeInactive, - } -} - -// TimeframeType - The time frame for pulling data for the export. If custom, then a specific time period must be provided. -type TimeframeType string - -const ( - TimeframeTypeBillingMonthToDate TimeframeType = "BillingMonthToDate" - TimeframeTypeCustom TimeframeType = "Custom" - TimeframeTypeMonthToDate TimeframeType = "MonthToDate" - TimeframeTypeTheLastBillingMonth TimeframeType = "TheLastBillingMonth" - TimeframeTypeTheLastMonth TimeframeType = "TheLastMonth" - TimeframeTypeWeekToDate TimeframeType = "WeekToDate" -) - -// PossibleTimeframeTypeValues returns the possible values for the TimeframeType const type. -func PossibleTimeframeTypeValues() []TimeframeType { - return []TimeframeType{ - TimeframeTypeBillingMonthToDate, - TimeframeTypeCustom, - TimeframeTypeMonthToDate, - TimeframeTypeTheLastBillingMonth, - TimeframeTypeTheLastMonth, - TimeframeTypeWeekToDate, - } -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_dimensions_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_dimensions_client.go deleted file mode 100644 index 7e46848abf84..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_dimensions_client.go +++ /dev/null @@ -1,199 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcostmanagement - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strconv" - "strings" -) - -// DimensionsClient contains the methods for the Dimensions group. -// Don't use this type directly, use NewDimensionsClient() instead. -type DimensionsClient struct { - host string - pl runtime.Pipeline -} - -// NewDimensionsClient creates a new instance of DimensionsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewDimensionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*DimensionsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &DimensionsClient{ - host: ep, - pl: pl, - } - return client, nil -} - -// NewByExternalCloudProviderTypePager - Lists the dimensions by the external cloud provider type. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// externalCloudProviderType - The external cloud provider type associated with dimension/query operations. This includes -// 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. -// externalCloudProviderID - This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for -// consolidated account used with dimension/query operations. -// options - DimensionsClientByExternalCloudProviderTypeOptions contains the optional parameters for the DimensionsClient.ByExternalCloudProviderType -// method. -func (client *DimensionsClient) NewByExternalCloudProviderTypePager(externalCloudProviderType ExternalCloudProviderType, externalCloudProviderID string, options *DimensionsClientByExternalCloudProviderTypeOptions) *runtime.Pager[DimensionsClientByExternalCloudProviderTypeResponse] { - return runtime.NewPager(runtime.PagingHandler[DimensionsClientByExternalCloudProviderTypeResponse]{ - More: func(page DimensionsClientByExternalCloudProviderTypeResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *DimensionsClientByExternalCloudProviderTypeResponse) (DimensionsClientByExternalCloudProviderTypeResponse, error) { - req, err := client.byExternalCloudProviderTypeCreateRequest(ctx, externalCloudProviderType, externalCloudProviderID, options) - if err != nil { - return DimensionsClientByExternalCloudProviderTypeResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return DimensionsClientByExternalCloudProviderTypeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DimensionsClientByExternalCloudProviderTypeResponse{}, runtime.NewResponseError(resp) - } - return client.byExternalCloudProviderTypeHandleResponse(resp) - }, - }) -} - -// byExternalCloudProviderTypeCreateRequest creates the ByExternalCloudProviderType request. -func (client *DimensionsClient) byExternalCloudProviderTypeCreateRequest(ctx context.Context, externalCloudProviderType ExternalCloudProviderType, externalCloudProviderID string, options *DimensionsClientByExternalCloudProviderTypeOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions" - if externalCloudProviderType == "" { - return nil, errors.New("parameter externalCloudProviderType cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{externalCloudProviderType}", url.PathEscape(string(externalCloudProviderType))) - if externalCloudProviderID == "" { - return nil, errors.New("parameter externalCloudProviderID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{externalCloudProviderId}", url.PathEscape(externalCloudProviderID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Expand != nil { - reqQP.Set("$expand", *options.Expand) - } - if options != nil && options.Skiptoken != nil { - reqQP.Set("$skiptoken", *options.Skiptoken) - } - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// byExternalCloudProviderTypeHandleResponse handles the ByExternalCloudProviderType response. -func (client *DimensionsClient) byExternalCloudProviderTypeHandleResponse(resp *http.Response) (DimensionsClientByExternalCloudProviderTypeResponse, error) { - result := DimensionsClientByExternalCloudProviderTypeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DimensionsListResult); err != nil { - return DimensionsClientByExternalCloudProviderTypeResponse{}, err - } - return result, nil -} - -// NewListPager - Lists the dimensions by the defined scope. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// scope - The scope associated with dimension operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for -// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount -// scope, -// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// options - DimensionsClientListOptions contains the optional parameters for the DimensionsClient.List method. -func (client *DimensionsClient) NewListPager(scope string, options *DimensionsClientListOptions) *runtime.Pager[DimensionsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[DimensionsClientListResponse]{ - More: func(page DimensionsClientListResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *DimensionsClientListResponse) (DimensionsClientListResponse, error) { - req, err := client.listCreateRequest(ctx, scope, options) - if err != nil { - return DimensionsClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return DimensionsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DimensionsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - }) -} - -// listCreateRequest creates the List request. -func (client *DimensionsClient) listCreateRequest(ctx context.Context, scope string, options *DimensionsClientListOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.CostManagement/dimensions" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Expand != nil { - reqQP.Set("$expand", *options.Expand) - } - if options != nil && options.Skiptoken != nil { - reqQP.Set("$skiptoken", *options.Skiptoken) - } - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *DimensionsClient) listHandleResponse(resp *http.Response) (DimensionsClientListResponse, error) { - result := DimensionsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DimensionsListResult); err != nil { - return DimensionsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_exports_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_exports_client.go deleted file mode 100644 index d830dd68ce7e..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_exports_client.go +++ /dev/null @@ -1,387 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcostmanagement - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ExportsClient contains the methods for the Exports group. -// Don't use this type directly, use NewExportsClient() instead. -type ExportsClient struct { - host string - pl runtime.Pipeline -} - -// NewExportsClient creates a new instance of ExportsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewExportsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ExportsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &ExportsClient{ - host: ep, - pl: pl, - } - return client, nil -} - -// CreateOrUpdate - The operation to create or update a export. Update operation requires latest eTag to be set in the request. -// You may obtain the latest eTag by performing a get operation. Create operation does not -// require eTag. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for -// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount -// scope, -// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// exportName - Export Name. -// parameters - Parameters supplied to the CreateOrUpdate Export operation. -// options - ExportsClientCreateOrUpdateOptions contains the optional parameters for the ExportsClient.CreateOrUpdate method. -func (client *ExportsClient) CreateOrUpdate(ctx context.Context, scope string, exportName string, parameters Export, options *ExportsClientCreateOrUpdateOptions) (ExportsClientCreateOrUpdateResponse, error) { - req, err := client.createOrUpdateCreateRequest(ctx, scope, exportName, parameters, options) - if err != nil { - return ExportsClientCreateOrUpdateResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ExportsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return ExportsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) - } - return client.createOrUpdateHandleResponse(resp) -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ExportsClient) createOrUpdateCreateRequest(ctx context.Context, scope string, exportName string, parameters Export, options *ExportsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if exportName == "" { - return nil, errors.New("parameter exportName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{exportName}", url.PathEscape(exportName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *ExportsClient) createOrUpdateHandleResponse(resp *http.Response) (ExportsClientCreateOrUpdateResponse, error) { - result := ExportsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Export); err != nil { - return ExportsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - The operation to delete a export. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for -// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount -// scope, -// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// exportName - Export Name. -// options - ExportsClientDeleteOptions contains the optional parameters for the ExportsClient.Delete method. -func (client *ExportsClient) Delete(ctx context.Context, scope string, exportName string, options *ExportsClientDeleteOptions) (ExportsClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, scope, exportName, options) - if err != nil { - return ExportsClientDeleteResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ExportsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ExportsClientDeleteResponse{}, runtime.NewResponseError(resp) - } - return ExportsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ExportsClient) deleteCreateRequest(ctx context.Context, scope string, exportName string, options *ExportsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if exportName == "" { - return nil, errors.New("parameter exportName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{exportName}", url.PathEscape(exportName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Execute - The operation to execute an export. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for -// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount -// scope, -// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// exportName - Export Name. -// options - ExportsClientExecuteOptions contains the optional parameters for the ExportsClient.Execute method. -func (client *ExportsClient) Execute(ctx context.Context, scope string, exportName string, options *ExportsClientExecuteOptions) (ExportsClientExecuteResponse, error) { - req, err := client.executeCreateRequest(ctx, scope, exportName, options) - if err != nil { - return ExportsClientExecuteResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ExportsClientExecuteResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ExportsClientExecuteResponse{}, runtime.NewResponseError(resp) - } - return ExportsClientExecuteResponse{}, nil -} - -// executeCreateRequest creates the Execute request. -func (client *ExportsClient) executeCreateRequest(ctx context.Context, scope string, exportName string, options *ExportsClientExecuteOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/run" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if exportName == "" { - return nil, errors.New("parameter exportName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{exportName}", url.PathEscape(exportName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - The operation to get the export for the defined scope by export name. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for -// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount -// scope, -// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// exportName - Export Name. -// options - ExportsClientGetOptions contains the optional parameters for the ExportsClient.Get method. -func (client *ExportsClient) Get(ctx context.Context, scope string, exportName string, options *ExportsClientGetOptions) (ExportsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, scope, exportName, options) - if err != nil { - return ExportsClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ExportsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ExportsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *ExportsClient) getCreateRequest(ctx context.Context, scope string, exportName string, options *ExportsClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if exportName == "" { - return nil, errors.New("parameter exportName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{exportName}", url.PathEscape(exportName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") - if options != nil && options.Expand != nil { - reqQP.Set("$expand", *options.Expand) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ExportsClient) getHandleResponse(resp *http.Response) (ExportsClientGetResponse, error) { - result := ExportsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Export); err != nil { - return ExportsClientGetResponse{}, err - } - return result, nil -} - -// GetExecutionHistory - The operation to get the execution history of an export for the defined scope and export name. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for -// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount -// scope, -// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// exportName - Export Name. -// options - ExportsClientGetExecutionHistoryOptions contains the optional parameters for the ExportsClient.GetExecutionHistory -// method. -func (client *ExportsClient) GetExecutionHistory(ctx context.Context, scope string, exportName string, options *ExportsClientGetExecutionHistoryOptions) (ExportsClientGetExecutionHistoryResponse, error) { - req, err := client.getExecutionHistoryCreateRequest(ctx, scope, exportName, options) - if err != nil { - return ExportsClientGetExecutionHistoryResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ExportsClientGetExecutionHistoryResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ExportsClientGetExecutionHistoryResponse{}, runtime.NewResponseError(resp) - } - return client.getExecutionHistoryHandleResponse(resp) -} - -// getExecutionHistoryCreateRequest creates the GetExecutionHistory request. -func (client *ExportsClient) getExecutionHistoryCreateRequest(ctx context.Context, scope string, exportName string, options *ExportsClientGetExecutionHistoryOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/runHistory" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if exportName == "" { - return nil, errors.New("parameter exportName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{exportName}", url.PathEscape(exportName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getExecutionHistoryHandleResponse handles the GetExecutionHistory response. -func (client *ExportsClient) getExecutionHistoryHandleResponse(resp *http.Response) (ExportsClientGetExecutionHistoryResponse, error) { - result := ExportsClientGetExecutionHistoryResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ExportExecutionListResult); err != nil { - return ExportsClientGetExecutionHistoryResponse{}, err - } - return result, nil -} - -// List - The operation to list all exports at the given scope. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// scope - The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for -// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount -// scope, -// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// options - ExportsClientListOptions contains the optional parameters for the ExportsClient.List method. -func (client *ExportsClient) List(ctx context.Context, scope string, options *ExportsClientListOptions) (ExportsClientListResponse, error) { - req, err := client.listCreateRequest(ctx, scope, options) - if err != nil { - return ExportsClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ExportsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ExportsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) -} - -// listCreateRequest creates the List request. -func (client *ExportsClient) listCreateRequest(ctx context.Context, scope string, options *ExportsClientListOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.CostManagement/exports" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") - if options != nil && options.Expand != nil { - reqQP.Set("$expand", *options.Expand) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *ExportsClient) listHandleResponse(resp *http.Response) (ExportsClientListResponse, error) { - result := ExportsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ExportListResult); err != nil { - return ExportsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_forecast_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_forecast_client.go deleted file mode 100644 index f55d42df15fb..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_forecast_client.go +++ /dev/null @@ -1,168 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcostmanagement - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ForecastClient contains the methods for the Forecast group. -// Don't use this type directly, use NewForecastClient() instead. -type ForecastClient struct { - host string - pl runtime.Pipeline -} - -// NewForecastClient creates a new instance of ForecastClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewForecastClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ForecastClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &ForecastClient{ - host: ep, - pl: pl, - } - return client, nil -} - -// ExternalCloudProviderUsage - Lists the forecast charges for external cloud provider type defined. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// externalCloudProviderType - The external cloud provider type associated with dimension/query operations. This includes -// 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. -// externalCloudProviderID - This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for -// consolidated account used with dimension/query operations. -// parameters - Parameters supplied to the CreateOrUpdate Forecast Config operation. -// options - ForecastClientExternalCloudProviderUsageOptions contains the optional parameters for the ForecastClient.ExternalCloudProviderUsage -// method. -func (client *ForecastClient) ExternalCloudProviderUsage(ctx context.Context, externalCloudProviderType ExternalCloudProviderType, externalCloudProviderID string, parameters ForecastDefinition, options *ForecastClientExternalCloudProviderUsageOptions) (ForecastClientExternalCloudProviderUsageResponse, error) { - req, err := client.externalCloudProviderUsageCreateRequest(ctx, externalCloudProviderType, externalCloudProviderID, parameters, options) - if err != nil { - return ForecastClientExternalCloudProviderUsageResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ForecastClientExternalCloudProviderUsageResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ForecastClientExternalCloudProviderUsageResponse{}, runtime.NewResponseError(resp) - } - return client.externalCloudProviderUsageHandleResponse(resp) -} - -// externalCloudProviderUsageCreateRequest creates the ExternalCloudProviderUsage request. -func (client *ForecastClient) externalCloudProviderUsageCreateRequest(ctx context.Context, externalCloudProviderType ExternalCloudProviderType, externalCloudProviderID string, parameters ForecastDefinition, options *ForecastClientExternalCloudProviderUsageOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast" - if externalCloudProviderType == "" { - return nil, errors.New("parameter externalCloudProviderType cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{externalCloudProviderType}", url.PathEscape(string(externalCloudProviderType))) - if externalCloudProviderID == "" { - return nil, errors.New("parameter externalCloudProviderID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{externalCloudProviderId}", url.PathEscape(externalCloudProviderID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2021-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// 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 { - return ForecastClientExternalCloudProviderUsageResponse{}, err - } - return result, nil -} - -// Usage - Lists the forecast charges for scope defined. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// scope - The scope associated with forecast operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for -// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount -// scope, -// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// parameters - Parameters supplied to the CreateOrUpdate Forecast Config operation. -// options - ForecastClientUsageOptions contains the optional parameters for the ForecastClient.Usage method. -func (client *ForecastClient) Usage(ctx context.Context, scope string, parameters ForecastDefinition, options *ForecastClientUsageOptions) (ForecastClientUsageResponse, error) { - req, err := client.usageCreateRequest(ctx, scope, parameters, options) - if err != nil { - return ForecastClientUsageResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ForecastClientUsageResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return ForecastClientUsageResponse{}, runtime.NewResponseError(resp) - } - return client.usageHandleResponse(resp) -} - -// usageCreateRequest creates the Usage request. -func (client *ForecastClient) usageCreateRequest(ctx context.Context, scope string, parameters ForecastDefinition, options *ForecastClientUsageOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.CostManagement/forecast" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2021-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// 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 { - return ForecastClientUsageResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreport_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreport_client.go deleted file mode 100644 index a5f4fa2be155..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreport_client.go +++ /dev/null @@ -1,122 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcostmanagement - -import ( - "context" - "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" -) - -// GenerateDetailedCostReportClient contains the methods for the GenerateDetailedCostReport group. -// Don't use this type directly, use NewGenerateDetailedCostReportClient() instead. -type GenerateDetailedCostReportClient struct { - host string - pl runtime.Pipeline -} - -// NewGenerateDetailedCostReportClient creates a new instance of GenerateDetailedCostReportClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewGenerateDetailedCostReportClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GenerateDetailedCostReportClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &GenerateDetailedCostReportClient{ - host: ep, - pl: pl, - } - 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 -// Azure-Consumption-AsyncOperation providing a link to the operation created. A call on the operation will provide the status -// and if the operation is completed the blob file where generated detailed -// cost report is being stored. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// scope - The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for -// Billing Account scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount -// scope. Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for billingAccount -// scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile -// scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// parameters - Parameters supplied to the Create detailed cost report operation. -// options - GenerateDetailedCostReportClientBeginCreateOperationOptions contains the optional parameters for the GenerateDetailedCostReportClient.BeginCreateOperation -// method. -func (client *GenerateDetailedCostReportClient) BeginCreateOperation(ctx context.Context, scope string, parameters GenerateDetailedCostReportDefinition, options *GenerateDetailedCostReportClientBeginCreateOperationOptions) (*runtime.Poller[GenerateDetailedCostReportClientCreateOperationResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOperation(ctx, scope, parameters, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[GenerateDetailedCostReportClientCreateOperationResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[GenerateDetailedCostReportClientCreateOperationResponse](options.ResumeToken, client.pl, nil) - } -} - -// CreateOperation - Generates the detailed cost report for provided date range, billing period(Only enterprise customers) -// or Invoice Id asynchronously at a certain scope. Call returns a 202 with header -// 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 -func (client *GenerateDetailedCostReportClient) createOperation(ctx context.Context, scope string, parameters GenerateDetailedCostReportDefinition, options *GenerateDetailedCostReportClientBeginCreateOperationOptions) (*http.Response, error) { - req, err := client.createOperationCreateRequest(ctx, scope, parameters, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - 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 *GenerateDetailedCostReportClient) createOperationCreateRequest(ctx context.Context, scope string, parameters GenerateDetailedCostReportDefinition, options *GenerateDetailedCostReportClientBeginCreateOperationOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreportoperationresults_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreportoperationresults_client.go deleted file mode 100644 index 3a2fbfb7216f..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreportoperationresults_client.go +++ /dev/null @@ -1,113 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcostmanagement - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// GenerateDetailedCostReportOperationResultsClient contains the methods for the GenerateDetailedCostReportOperationResults group. -// Don't use this type directly, use NewGenerateDetailedCostReportOperationResultsClient() instead. -type GenerateDetailedCostReportOperationResultsClient struct { - host string - pl runtime.Pipeline -} - -// NewGenerateDetailedCostReportOperationResultsClient creates a new instance of GenerateDetailedCostReportOperationResultsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewGenerateDetailedCostReportOperationResultsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GenerateDetailedCostReportOperationResultsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &GenerateDetailedCostReportOperationResultsClient{ - host: ep, - pl: pl, - } - return client, nil -} - -// Get - Get the result of the specified operation. This link is provided in the GenerateDetailedCostReport creation request -// response header. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// operationID - The target operation Id. -// scope - The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for -// Billing Account scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount -// scope. Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for billingAccount -// scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile -// scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// options - GenerateDetailedCostReportOperationResultsClientGetOptions contains the optional parameters for the GenerateDetailedCostReportOperationResultsClient.Get -// method. -func (client *GenerateDetailedCostReportOperationResultsClient) Get(ctx context.Context, operationID string, scope string, options *GenerateDetailedCostReportOperationResultsClientGetOptions) (GenerateDetailedCostReportOperationResultsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, operationID, scope, options) - if err != nil { - return GenerateDetailedCostReportOperationResultsClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return GenerateDetailedCostReportOperationResultsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return GenerateDetailedCostReportOperationResultsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *GenerateDetailedCostReportOperationResultsClient) getCreateRequest(ctx context.Context, operationID string, scope string, options *GenerateDetailedCostReportOperationResultsClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.CostManagement/operationResults/{operationId}" - if operationID == "" { - return nil, errors.New("parameter operationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *GenerateDetailedCostReportOperationResultsClient) getHandleResponse(resp *http.Response) (GenerateDetailedCostReportOperationResultsClientGetResponse, error) { - result := GenerateDetailedCostReportOperationResultsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GenerateDetailedCostReportOperationResult); err != nil { - return GenerateDetailedCostReportOperationResultsClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreportoperationstatus_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreportoperationstatus_client.go deleted file mode 100644 index a6e6d8cf7ec2..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatedetailedcostreportoperationstatus_client.go +++ /dev/null @@ -1,113 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcostmanagement - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// GenerateDetailedCostReportOperationStatusClient contains the methods for the GenerateDetailedCostReportOperationStatus group. -// Don't use this type directly, use NewGenerateDetailedCostReportOperationStatusClient() instead. -type GenerateDetailedCostReportOperationStatusClient struct { - host string - pl runtime.Pipeline -} - -// NewGenerateDetailedCostReportOperationStatusClient creates a new instance of GenerateDetailedCostReportOperationStatusClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewGenerateDetailedCostReportOperationStatusClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GenerateDetailedCostReportOperationStatusClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &GenerateDetailedCostReportOperationStatusClient{ - host: ep, - pl: pl, - } - return client, nil -} - -// Get - Get the status of the specified operation. This link is provided in the GenerateDetailedCostReport creation request -// response header. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// operationID - The target operation Id. -// scope - The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for -// Billing Account scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount -// scope. Also, Modern Commerce Account scopes are '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for billingAccount -// scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile -// scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// options - GenerateDetailedCostReportOperationStatusClientGetOptions contains the optional parameters for the GenerateDetailedCostReportOperationStatusClient.Get -// method. -func (client *GenerateDetailedCostReportOperationStatusClient) Get(ctx context.Context, operationID string, scope string, options *GenerateDetailedCostReportOperationStatusClientGetOptions) (GenerateDetailedCostReportOperationStatusClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, operationID, scope, options) - if err != nil { - return GenerateDetailedCostReportOperationStatusClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return GenerateDetailedCostReportOperationStatusClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return GenerateDetailedCostReportOperationStatusClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *GenerateDetailedCostReportOperationStatusClient) getCreateRequest(ctx context.Context, operationID string, scope string, options *GenerateDetailedCostReportOperationStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.CostManagement/operationStatus/{operationId}" - if operationID == "" { - return nil, errors.New("parameter operationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *GenerateDetailedCostReportOperationStatusClient) getHandleResponse(resp *http.Response) (GenerateDetailedCostReportOperationStatusClientGetResponse, error) { - result := GenerateDetailedCostReportOperationStatusClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GenerateDetailedCostReportOperationStatuses); err != nil { - return GenerateDetailedCostReportOperationStatusClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatereservationdetailsreport_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatereservationdetailsreport_client.go deleted file mode 100644 index c7670ad08511..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_generatereservationdetailsreport_client.go +++ /dev/null @@ -1,185 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcostmanagement - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// GenerateReservationDetailsReportClient contains the methods for the GenerateReservationDetailsReport group. -// Don't use this type directly, use NewGenerateReservationDetailsReportClient() instead. -type GenerateReservationDetailsReportClient struct { - host string - pl runtime.Pipeline -} - -// NewGenerateReservationDetailsReportClient creates a new instance of GenerateReservationDetailsReportClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewGenerateReservationDetailsReportClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GenerateReservationDetailsReportClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &GenerateReservationDetailsReportClient{ - host: ep, - pl: pl, - } - return client, nil -} - -// BeginByBillingAccountID - Generates the reservations details report for provided date range asynchronously based on enrollment -// id. The Reservation usage details can be viewed only by certain enterprise roles. For more details -// on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// billingAccountID - Enrollment ID (Legacy BillingAccount ID) -// startDate - Start Date -// endDate - End Date -// options - GenerateReservationDetailsReportClientBeginByBillingAccountIDOptions contains the optional parameters for the -// GenerateReservationDetailsReportClient.BeginByBillingAccountID method. -func (client *GenerateReservationDetailsReportClient) BeginByBillingAccountID(ctx context.Context, billingAccountID string, startDate string, endDate string, options *GenerateReservationDetailsReportClientBeginByBillingAccountIDOptions) (*runtime.Poller[GenerateReservationDetailsReportClientByBillingAccountIDResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.byBillingAccountID(ctx, billingAccountID, startDate, endDate, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[GenerateReservationDetailsReportClientByBillingAccountIDResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[GenerateReservationDetailsReportClientByBillingAccountIDResponse](options.ResumeToken, client.pl, nil) - } -} - -// ByBillingAccountID - Generates the reservations details report for provided date range asynchronously based on enrollment -// 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 -func (client *GenerateReservationDetailsReportClient) byBillingAccountID(ctx context.Context, billingAccountID string, startDate string, endDate string, options *GenerateReservationDetailsReportClientBeginByBillingAccountIDOptions) (*http.Response, error) { - req, err := client.byBillingAccountIDCreateRequest(ctx, billingAccountID, startDate, endDate, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// byBillingAccountIDCreateRequest creates the ByBillingAccountID request. -func (client *GenerateReservationDetailsReportClient) byBillingAccountIDCreateRequest(ctx context.Context, billingAccountID string, startDate string, endDate string, options *GenerateReservationDetailsReportClientBeginByBillingAccountIDOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport" - if billingAccountID == "" { - return nil, errors.New("parameter billingAccountID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{billingAccountId}", url.PathEscape(billingAccountID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("startDate", startDate) - reqQP.Set("endDate", endDate) - reqQP.Set("api-version", "2021-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// BeginByBillingProfileID - Generates the reservations details report for provided date range asynchronously by billing profile. -// The Reservation usage details can be viewed by only certain enterprise roles by default. For more -// details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// billingAccountID - BillingAccount ID -// billingProfileID - BillingProfile ID -// startDate - Start Date -// endDate - End Date -// options - GenerateReservationDetailsReportClientBeginByBillingProfileIDOptions contains the optional parameters for the -// GenerateReservationDetailsReportClient.BeginByBillingProfileID method. -func (client *GenerateReservationDetailsReportClient) BeginByBillingProfileID(ctx context.Context, billingAccountID string, billingProfileID string, startDate string, endDate string, options *GenerateReservationDetailsReportClientBeginByBillingProfileIDOptions) (*runtime.Poller[GenerateReservationDetailsReportClientByBillingProfileIDResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.byBillingProfileID(ctx, billingAccountID, billingProfileID, startDate, endDate, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[GenerateReservationDetailsReportClientByBillingProfileIDResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[GenerateReservationDetailsReportClientByBillingProfileIDResponse](options.ResumeToken, client.pl, nil) - } -} - -// ByBillingProfileID - Generates the reservations details report for provided date range asynchronously by billing profile. -// 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 -func (client *GenerateReservationDetailsReportClient) byBillingProfileID(ctx context.Context, billingAccountID string, billingProfileID string, startDate string, endDate string, options *GenerateReservationDetailsReportClientBeginByBillingProfileIDOptions) (*http.Response, error) { - req, err := client.byBillingProfileIDCreateRequest(ctx, billingAccountID, billingProfileID, startDate, endDate, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// byBillingProfileIDCreateRequest creates the ByBillingProfileID request. -func (client *GenerateReservationDetailsReportClient) byBillingProfileIDCreateRequest(ctx context.Context, billingAccountID string, billingProfileID string, startDate string, endDate string, options *GenerateReservationDetailsReportClientBeginByBillingProfileIDOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport" - if billingAccountID == "" { - return nil, errors.New("parameter billingAccountID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{billingAccountId}", url.PathEscape(billingAccountID)) - if billingProfileID == "" { - return nil, errors.New("parameter billingProfileID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{billingProfileId}", url.PathEscape(billingProfileID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("startDate", startDate) - reqQP.Set("endDate", endDate) - reqQP.Set("api-version", "2021-10-01") - 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_models.go b/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_models.go deleted file mode 100644 index 9ba5a9006989..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_models.go +++ /dev/null @@ -1,1262 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcostmanagement - -import "time" - -// Alert - An individual alert. -type Alert struct { - // eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating - // the latest version or not. - ETag *string `json:"eTag,omitempty"` - - // Alert properties. - Properties *AlertProperties `json:"properties,omitempty"` - - // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// AlertProperties - Alert properties. -type AlertProperties struct { - // dateTime in which alert was closed - CloseTime *string `json:"closeTime,omitempty"` - - // related budget - CostEntityID *string `json:"costEntityId,omitempty"` - - // dateTime in which alert was created - CreationTime *string `json:"creationTime,omitempty"` - - // defines the type of alert - Definition *AlertPropertiesDefinition `json:"definition,omitempty"` - - // Alert description - Description *string `json:"description,omitempty"` - - // Alert details - Details *AlertPropertiesDetails `json:"details,omitempty"` - - // dateTime in which alert was last modified - ModificationTime *string `json:"modificationTime,omitempty"` - - // Source of alert - Source *AlertSource `json:"source,omitempty"` - - // alert status - Status *AlertStatus `json:"status,omitempty"` - - // dateTime in which the alert status was last modified - StatusModificationTime *string `json:"statusModificationTime,omitempty"` - - // User who last modified the alert - StatusModificationUserName *string `json:"statusModificationUserName,omitempty"` -} - -// AlertPropertiesDefinition - defines the type of alert -type AlertPropertiesDefinition struct { - // Alert category - Category *AlertCategory `json:"category,omitempty"` - - // Criteria that triggered alert - Criteria *AlertCriteria `json:"criteria,omitempty"` - - // type of alert - Type *AlertType `json:"type,omitempty"` -} - -// AlertPropertiesDetails - Alert details -type AlertPropertiesDetails struct { - // budget threshold amount - Amount *float64 `json:"amount,omitempty"` - - // company name - CompanyName *string `json:"companyName,omitempty"` - - // list of emails to contact - ContactEmails []*string `json:"contactEmails,omitempty"` - - // list of action groups to broadcast to - ContactGroups []*string `json:"contactGroups,omitempty"` - - // list of contact roles - ContactRoles []*string `json:"contactRoles,omitempty"` - - // current spend - CurrentSpend *float64 `json:"currentSpend,omitempty"` - - // department name - DepartmentName *string `json:"departmentName,omitempty"` - - // datetime of enrollmentEndDate - EnrollmentEndDate *string `json:"enrollmentEndDate,omitempty"` - - // enrollment number - EnrollmentNumber *string `json:"enrollmentNumber,omitempty"` - - // datetime of enrollmentStartDate - EnrollmentStartDate *string `json:"enrollmentStartDate,omitempty"` - - // invoicing threshold - InvoicingThreshold *float64 `json:"invoicingThreshold,omitempty"` - - // array of meters to filter by - MeterFilter []interface{} `json:"meterFilter,omitempty"` - - // operator used to compare currentSpend with amount - Operator *AlertOperator `json:"operator,omitempty"` - - // overriding alert - OverridingAlert *string `json:"overridingAlert,omitempty"` - - // datetime of periodStartDate - PeriodStartDate *string `json:"periodStartDate,omitempty"` - - // array of resources to filter by - ResourceFilter []interface{} `json:"resourceFilter,omitempty"` - - // array of resourceGroups to filter by - ResourceGroupFilter []interface{} `json:"resourceGroupFilter,omitempty"` - - // tags to filter by - TagFilter interface{} `json:"tagFilter,omitempty"` - - // notification threshold percentage as a decimal which activated this alert - Threshold *float64 `json:"threshold,omitempty"` - - // Type of timegrain cadence - TimeGrainType *AlertTimeGrainType `json:"timeGrainType,omitempty"` - - // notificationId that triggered this alert - TriggeredBy *string `json:"triggeredBy,omitempty"` - - // unit of currency being used - Unit *string `json:"unit,omitempty"` -} - -// AlertsClientDismissOptions contains the optional parameters for the AlertsClient.Dismiss method. -type AlertsClientDismissOptions struct { - // placeholder for future optional parameters -} - -// AlertsClientGetOptions contains the optional parameters for the AlertsClient.Get method. -type AlertsClientGetOptions struct { - // placeholder for future optional parameters -} - -// AlertsClientListExternalOptions contains the optional parameters for the AlertsClient.ListExternal method. -type AlertsClientListExternalOptions struct { - // placeholder for future optional parameters -} - -// AlertsClientListOptions contains the optional parameters for the AlertsClient.List method. -type AlertsClientListOptions struct { - // placeholder for future optional parameters -} - -// AlertsResult - Result of alerts. -type AlertsResult struct { - // READ-ONLY; URL to get the next set of alerts results if there are any. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` - - // READ-ONLY; List of alerts. - Value []*Alert `json:"value,omitempty" azure:"ro"` -} - -// CommonExportProperties - The common properties of the export. -type CommonExportProperties struct { - // REQUIRED; Has the definition for the export. - Definition *ExportDefinition `json:"definition,omitempty"` - - // REQUIRED; Has delivery information for the export. - DeliveryInfo *ExportDeliveryInfo `json:"deliveryInfo,omitempty"` - - // The format of the export being delivered. Currently only 'Csv' is supported. - Format *FormatType `json:"format,omitempty"` - - // If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. - // Note: this option is currently available only for modern commerce scopes. - PartitionData *bool `json:"partitionData,omitempty"` - - // If requested, has the most recent execution history for the export. - RunHistory *ExportExecutionListResult `json:"runHistory,omitempty"` - - // READ-ONLY; If the export has an active schedule, provides an estimate of the next execution time. - NextRunTimeEstimate *time.Time `json:"nextRunTimeEstimate,omitempty" azure:"ro"` -} - -// Dimension - List of Dimension. -type Dimension struct { - // Dimension properties. - Properties *DimensionProperties `json:"properties,omitempty"` - - // READ-ONLY; ETag of the resource. - ETag *string `json:"eTag,omitempty" azure:"ro"` - - // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Location of the resource. - Location *string `json:"location,omitempty" azure:"ro"` - - // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; SKU of the resource. - SKU *string `json:"sku,omitempty" azure:"ro"` - - // READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` - - // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// DimensionProperties - Dimension properties. -type DimensionProperties struct { - // Dimension data. - Data []*string `json:"data,omitempty"` - - // READ-ONLY; Dimension category. - Category *string `json:"category,omitempty" azure:"ro"` - - // READ-ONLY; Dimension description. - Description *string `json:"description,omitempty" azure:"ro"` - - // READ-ONLY; Filter enabled. - FilterEnabled *bool `json:"filterEnabled,omitempty" azure:"ro"` - - // READ-ONLY; Grouping enabled. - GroupingEnabled *bool `json:"groupingEnabled,omitempty" azure:"ro"` - - // READ-ONLY; The link (url) to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` - - // READ-ONLY; Total number of data for the dimension. - Total *int32 `json:"total,omitempty" azure:"ro"` - - // READ-ONLY; Usage end. - UsageEnd *time.Time `json:"usageEnd,omitempty" azure:"ro"` - - // READ-ONLY; Usage start. - UsageStart *time.Time `json:"usageStart,omitempty" azure:"ro"` -} - -// DimensionsClientByExternalCloudProviderTypeOptions contains the optional parameters for the DimensionsClient.ByExternalCloudProviderType -// method. -type DimensionsClientByExternalCloudProviderTypeOptions struct { - // May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions. - Expand *string - // May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators - // are 'eq','lt', 'gt', 'le', 'ge'. - Filter *string - // Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, - // the value of the nextLink element will include a skiptoken parameter that - // specifies a starting point to use for subsequent calls. - Skiptoken *string - // May be used to limit the number of results to the most recent N dimension data. - Top *int32 -} - -// DimensionsClientListOptions contains the optional parameters for the DimensionsClient.List method. -type DimensionsClientListOptions struct { - // May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions. - Expand *string - // May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators - // are 'eq','lt', 'gt', 'le', 'ge'. - Filter *string - // Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, - // the value of the nextLink element will include a skiptoken parameter that - // specifies a starting point to use for subsequent calls. - Skiptoken *string - // May be used to limit the number of results to the most recent N dimension data. - Top *int32 -} - -// DimensionsListResult - Result of listing dimensions. It contains a list of available dimensions. -type DimensionsListResult struct { - // READ-ONLY; The list of dimensions. - Value []*Dimension `json:"value,omitempty" azure:"ro"` -} - -// DismissAlertPayload - The request payload to update an alert -type DismissAlertPayload struct { - // Alert properties. - Properties *AlertProperties `json:"properties,omitempty"` -} - -// DownloadURL - The URL to download the generated report. -type DownloadURL struct { - // The URL to download the generated report. - DownloadURL *string `json:"downloadUrl,omitempty"` - - // The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. - ValidTill *time.Time `json:"validTill,omitempty"` -} - -// ErrorDetails - The details of the error. -type ErrorDetails struct { - // READ-ONLY; Error code. - Code *string `json:"code,omitempty" azure:"ro"` - - // READ-ONLY; Error message indicating why the operation failed. - Message *string `json:"message,omitempty" azure:"ro"` -} - -// ErrorResponse - Error response indicates that the service is not able to process the incoming request. The reason is provided -// in the error message. -// Some Error responses: -// * 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" -// header. -// -// * 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" -// header. -type ErrorResponse struct { - // The details of the error. - Error *ErrorDetails `json:"error,omitempty"` -} - -// Export - An export resource. -type Export struct { - // eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating - // the latest version or not. - ETag *string `json:"eTag,omitempty"` - - // The properties of the export. - Properties *ExportProperties `json:"properties,omitempty"` - - // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ExportDataset - The definition for data in the export. -type ExportDataset struct { - // The export dataset configuration. - Configuration *ExportDatasetConfiguration `json:"configuration,omitempty"` - - // The granularity of rows in the export. Currently only 'Daily' is supported. - Granularity *GranularityType `json:"granularity,omitempty"` -} - -// ExportDatasetConfiguration - The export dataset configuration. Allows columns to be selected for the export. If not provided -// then the export will include all available columns. -type ExportDatasetConfiguration struct { - // Array of column names to be included in the export. If not provided then the export will include all available columns. - // The available columns can vary by customer channel (see examples). - Columns []*string `json:"columns,omitempty"` -} - -// ExportDefinition - The definition of an export. -type ExportDefinition struct { - // REQUIRED; The time frame for pulling data for the export. If custom, then a specific time period must be provided. - Timeframe *TimeframeType `json:"timeframe,omitempty"` - - // REQUIRED; The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that do - // not yet provide data for charges or amortization for service reservations. - Type *ExportType `json:"type,omitempty"` - - // The definition for data in the export. - DataSet *ExportDataset `json:"dataSet,omitempty"` - - // Has time period for pulling data for the export. - TimePeriod *ExportTimePeriod `json:"timePeriod,omitempty"` -} - -// ExportDeliveryDestination - This represents the blob storage account location where exports of costs will be delivered. -// There are two ways to configure the destination. The approach recommended for most customers is to specify -// the resourceId of the storage account. This requires a one-time registration of the account's subscription with the Microsoft.CostManagementExports -// resource provider in order to give Cost Management -// services access to the storage. When creating an export in the Azure portal this registration is performed automatically -// but API users may need to register the subscription explicitly (for more -// information see https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-supported-services ). Another -// way to configure the destination is available ONLY to Partners with a -// Microsoft Partner Agreement plan who are global admins of their billing account. These Partners, instead of specifying -// the resourceId of a storage account, can specify the storage account name along -// with a SAS token for the account. This allows exports of costs to a storage account in any tenant. The SAS token should -// be created for the blob service with Service/Container/Object resource types and -// with Read/Write/Delete/List/Add/Create permissions (for more information see https://docs.microsoft.com/en-us/azure/cost-management-billing/costs/export-cost-data-storage-account-sas-key -// ). -type ExportDeliveryDestination struct { - // REQUIRED; The name of the container where exports will be uploaded. If the container does not exist it will be created. - Container *string `json:"container,omitempty"` - - // The resource id of the storage account where exports will be delivered. This is not required if a sasToken and storageAccount - // are specified. - ResourceID *string `json:"resourceId,omitempty"` - - // The name of the directory where exports will be uploaded. - RootFolderPath *string `json:"rootFolderPath,omitempty"` - - // A SAS token for the storage account. For a restricted set of Azure customers this together with storageAccount can be specified - // instead of resourceId. Note: the value returned by the API for this - // property will always be obfuscated. Returning this same obfuscated value will not result in the SAS token being updated. - // To update this value a new SAS token must be specified. - SasToken *string `json:"sasToken,omitempty"` - - // The storage account where exports will be uploaded. For a restricted set of Azure customers this together with sasToken - // can be specified instead of resourceId. - StorageAccount *string `json:"storageAccount,omitempty"` -} - -// ExportDeliveryInfo - The delivery information associated with a export. -type ExportDeliveryInfo struct { - // REQUIRED; Has destination for the export being delivered. - Destination *ExportDeliveryDestination `json:"destination,omitempty"` -} - -// ExportExecution - An export execution. -type ExportExecution struct { - // eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating - // the latest version or not. - ETag *string `json:"eTag,omitempty"` - - // The properties of the export execution. - Properties *ExportExecutionProperties `json:"properties,omitempty"` - - // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ExportExecutionListResult - Result of listing the execution history of an export. -type ExportExecutionListResult struct { - // READ-ONLY; A list of export executions. - Value []*ExportExecution `json:"value,omitempty" azure:"ro"` -} - -// ExportExecutionProperties - The properties of the export execution. -type ExportExecutionProperties struct { - // The details of any error. - Error *ErrorDetails `json:"error,omitempty"` - - // The type of the export execution. - ExecutionType *ExecutionType `json:"executionType,omitempty"` - - // The name of the exported file. - FileName *string `json:"fileName,omitempty"` - - // The time when the export execution finished. - ProcessingEndTime *time.Time `json:"processingEndTime,omitempty"` - - // The time when export was picked up to be executed. - ProcessingStartTime *time.Time `json:"processingStartTime,omitempty"` - - // The export settings that were in effect for this execution. - RunSettings *CommonExportProperties `json:"runSettings,omitempty"` - - // The last known status of the export execution. - Status *ExecutionStatus `json:"status,omitempty"` - - // The identifier for the entity that executed the export. For OnDemand executions it is the user email. For scheduled executions - // it is 'System'. - SubmittedBy *string `json:"submittedBy,omitempty"` - - // The time when export was queued to be executed. - SubmittedTime *time.Time `json:"submittedTime,omitempty"` -} - -// ExportListResult - Result of listing exports. It contains a list of available exports in the scope provided. -type ExportListResult struct { - // READ-ONLY; The list of exports. - Value []*Export `json:"value,omitempty" azure:"ro"` -} - -// ExportProperties - The properties of the export. -type ExportProperties struct { - // REQUIRED; Has the definition for the export. - Definition *ExportDefinition `json:"definition,omitempty"` - - // REQUIRED; Has delivery information for the export. - DeliveryInfo *ExportDeliveryInfo `json:"deliveryInfo,omitempty"` - - // The format of the export being delivered. Currently only 'Csv' is supported. - Format *FormatType `json:"format,omitempty"` - - // If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. - // Note: this option is currently available only for modern commerce scopes. - PartitionData *bool `json:"partitionData,omitempty"` - - // If requested, has the most recent execution history for the export. - RunHistory *ExportExecutionListResult `json:"runHistory,omitempty"` - - // Has schedule information for the export. - Schedule *ExportSchedule `json:"schedule,omitempty"` - - // READ-ONLY; If the export has an active schedule, provides an estimate of the next execution time. - NextRunTimeEstimate *time.Time `json:"nextRunTimeEstimate,omitempty" azure:"ro"` -} - -// ExportRecurrencePeriod - The start and end date for recurrence schedule. -type ExportRecurrencePeriod struct { - // REQUIRED; The start date of recurrence. - From *time.Time `json:"from,omitempty"` - - // The end date of recurrence. - To *time.Time `json:"to,omitempty"` -} - -// ExportSchedule - The schedule associated with the export. -type ExportSchedule struct { - // The schedule recurrence. - Recurrence *RecurrenceType `json:"recurrence,omitempty"` - - // Has start and end date of the recurrence. The start date must be in future. If present, the end date must be greater than - // start date. - RecurrencePeriod *ExportRecurrencePeriod `json:"recurrencePeriod,omitempty"` - - // The status of the export's schedule. If 'Inactive', the export's schedule is paused. - Status *StatusType `json:"status,omitempty"` -} - -// ExportTimePeriod - The date range for data in the export. This should only be specified with timeFrame set to 'Custom'. -// The maximum date range is 3 months. -type ExportTimePeriod struct { - // REQUIRED; The start date for export data. - From *time.Time `json:"from,omitempty"` - - // REQUIRED; The end date for export data. - To *time.Time `json:"to,omitempty"` -} - -// ExportsClientCreateOrUpdateOptions contains the optional parameters for the ExportsClient.CreateOrUpdate method. -type ExportsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ExportsClientDeleteOptions contains the optional parameters for the ExportsClient.Delete method. -type ExportsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ExportsClientExecuteOptions contains the optional parameters for the ExportsClient.Execute method. -type ExportsClientExecuteOptions struct { - // placeholder for future optional parameters -} - -// ExportsClientGetExecutionHistoryOptions contains the optional parameters for the ExportsClient.GetExecutionHistory method. -type ExportsClientGetExecutionHistoryOptions struct { - // placeholder for future optional parameters -} - -// ExportsClientGetOptions contains the optional parameters for the ExportsClient.Get method. -type ExportsClientGetOptions struct { - // May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information - // for the last 10 executions of the export. - Expand *string -} - -// ExportsClientListOptions contains the optional parameters for the ExportsClient.List method. -type ExportsClientListOptions struct { - // May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information - // for the last execution of each export. - Expand *string -} - -// ForecastClientExternalCloudProviderUsageOptions contains the optional parameters for the ForecastClient.ExternalCloudProviderUsage -// method. -type ForecastClientExternalCloudProviderUsageOptions struct { - // May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter - // supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently - // support 'ne', 'or', or 'not'. - Filter *string -} - -// ForecastClientUsageOptions contains the optional parameters for the ForecastClient.Usage method. -type ForecastClientUsageOptions struct { - // May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter - // supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently - // support 'ne', 'or', or 'not'. - Filter *string -} - -// ForecastDataset - The definition of data present in the forecast. -type ForecastDataset struct { - // Dictionary of aggregation expression to use in the forecast. The key of each item in the dictionary is the alias for the - // aggregated column. forecast can have up to 2 aggregation clauses. - Aggregation map[string]*QueryAggregation `json:"aggregation,omitempty"` - - // Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping - // are provided. - Configuration *QueryDatasetConfiguration `json:"configuration,omitempty"` - - // Has filter expression to use in the forecast. - Filter *QueryFilter `json:"filter,omitempty"` - - // The granularity of rows in the forecast. - Granularity *GranularityType `json:"granularity,omitempty"` -} - -// ForecastDefinition - The definition of a forecast. -type ForecastDefinition struct { - // REQUIRED; Has definition for data in this forecast. - Dataset *ForecastDataset `json:"dataset,omitempty"` - - // REQUIRED; The time frame for pulling data for the forecast. If custom, then a specific time period must be provided. - Timeframe *ForecastTimeframeType `json:"timeframe,omitempty"` - - // REQUIRED; The type of the forecast. - Type *ForecastType `json:"type,omitempty"` - - // a boolean determining if actualCost will be included - IncludeActualCost *bool `json:"includeActualCost,omitempty"` - - // a boolean determining if FreshPartialCost will be included - IncludeFreshPartialCost *bool `json:"includeFreshPartialCost,omitempty"` - - // Has time period for pulling data for the forecast. - TimePeriod *QueryTimePeriod `json:"timePeriod,omitempty"` -} - -// GenerateDetailedCostReportClientBeginCreateOperationOptions contains the optional parameters for the GenerateDetailedCostReportClient.BeginCreateOperation -// method. -type GenerateDetailedCostReportClientBeginCreateOperationOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// GenerateDetailedCostReportDefinition - The definition of a cost detailed report. -type GenerateDetailedCostReportDefinition struct { - // Billing Period in YearMonth(e.g. 202008) format. Only for legacy enterprise customers can use this. Can only have one of - // either timePeriod or invoiceId or billingPeriod parameters. If none provided - // current month cost is provided. - BillingPeriod *string `json:"billingPeriod,omitempty"` - - // Customer Id for Modern (Invoice Id and billing profile is also required for this). - CustomerID *string `json:"customerId,omitempty"` - - // Invoice Id for PayAsYouGo customers and Modern billing profile scope. Can only have one of either timePeriod or invoiceId - // or billingPeriod parameters. If none provided current month cost is provided. - InvoiceID *string `json:"invoiceId,omitempty"` - - // The type of the detailed report. By default ActualCost is provided - Metric *GenerateDetailedCostReportMetricType `json:"metric,omitempty"` - - // Has time period for pulling data for the cost detailed report. Can only have one of either timePeriod or invoiceId or billingPeriod - // parameters. If none provided current month cost is provided. - TimePeriod *GenerateDetailedCostReportTimePeriod `json:"timePeriod,omitempty"` -} - -// GenerateDetailedCostReportErrorResponse - Error response indicates that the service is not able to process the incoming -// request. The reason is provided in the error message. -// Some Error responses: -// * 413 Request Entity Too Large - Request is throttled. The amount of data required to fulfill the request exceeds the maximum -// size permitted of 2Gb. Please utilize our Exports feature instead. -// -// * 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" -// header. -// -// * 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" -// header. -type GenerateDetailedCostReportErrorResponse struct { - // The details of the error. - Error *ErrorDetails `json:"error,omitempty"` -} - -// GenerateDetailedCostReportOperationResult - The result of the long running operation for cost detailed report. -type GenerateDetailedCostReportOperationResult struct { - // The id of the long running operation. - ID *string `json:"id,omitempty"` - - // The name of the long running operation. - Name *string `json:"name,omitempty"` - - // The properties of the resource generated. - Properties *DownloadURL `json:"properties,omitempty"` - - // The type of the long running operation. - Type *string `json:"type,omitempty"` -} - -// GenerateDetailedCostReportOperationResultsClientGetOptions contains the optional parameters for the GenerateDetailedCostReportOperationResultsClient.Get -// method. -type GenerateDetailedCostReportOperationResultsClientGetOptions struct { - // placeholder for future optional parameters -} - -// GenerateDetailedCostReportOperationStatusClientGetOptions contains the optional parameters for the GenerateDetailedCostReportOperationStatusClient.Get -// method. -type GenerateDetailedCostReportOperationStatusClientGetOptions struct { - // placeholder for future optional parameters -} - -// GenerateDetailedCostReportOperationStatuses - The status of the long running operation for cost detailed report. -type GenerateDetailedCostReportOperationStatuses struct { - // The details of the error. - Error *ErrorDetails `json:"error,omitempty"` - - // The id of the long running operation. - ID *string `json:"id,omitempty"` - - // The name of the long running operation. - Name *string `json:"name,omitempty"` - - // The properties of the resource generated. - Properties *DownloadURL `json:"properties,omitempty"` - - // The status of the long running operation. - Status *Status `json:"status,omitempty"` - - // The type of the long running operation. - Type *string `json:"type,omitempty"` -} - -// GenerateDetailedCostReportTimePeriod - The start and end date for pulling data for the cost detailed report. -type GenerateDetailedCostReportTimePeriod struct { - // REQUIRED; The end date to pull data to. example format 2020-03-15 - End *string `json:"end,omitempty"` - - // REQUIRED; The start date to pull data from. example format 2020-03-15 - Start *string `json:"start,omitempty"` -} - -// GenerateReservationDetailsReportClientBeginByBillingAccountIDOptions contains the optional parameters for the GenerateReservationDetailsReportClient.BeginByBillingAccountID -// method. -type GenerateReservationDetailsReportClientBeginByBillingAccountIDOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// GenerateReservationDetailsReportClientBeginByBillingProfileIDOptions contains the optional parameters for the GenerateReservationDetailsReportClient.BeginByBillingProfileID -// method. -type GenerateReservationDetailsReportClientBeginByBillingProfileIDOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// KpiProperties - Each KPI must contain a 'type' and 'enabled' key. -type KpiProperties struct { - // show the KPI in the UI? - Enabled *bool `json:"enabled,omitempty"` - - // ID of resource related to metric (budget). - ID *string `json:"id,omitempty"` - - // KPI type (Forecast, Budget). - Type *KpiType `json:"type,omitempty"` -} - -// Operation - A Cost management REST API operation. -type Operation struct { - // The object that represents the operation. - Display *OperationDisplay `json:"display,omitempty"` - - // READ-ONLY; Operation id: {provider}/{resource}/{operation}. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Operation name: {provider}/{resource}/{operation}. - Name *string `json:"name,omitempty" azure:"ro"` -} - -// OperationDisplay - The object that represents the operation. -type OperationDisplay struct { - // READ-ONLY; Operation description - Description *string `json:"description,omitempty" azure:"ro"` - - // READ-ONLY; Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty" azure:"ro"` - - // READ-ONLY; Service provider: Microsoft.CostManagement. - Provider *string `json:"provider,omitempty" azure:"ro"` - - // READ-ONLY; Resource on which the operation is performed: Dimensions, Query. - Resource *string `json:"resource,omitempty" azure:"ro"` -} - -// OperationListResult - Result of listing cost management operations. It contains a list of operations and a URL link to -// get the next set of results. -type OperationListResult struct { - // READ-ONLY; URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` - - // READ-ONLY; List of cost management operations supported by the Microsoft.CostManagement resource provider. - Value []*Operation `json:"value,omitempty" azure:"ro"` -} - -// OperationStatus - The status of the long running operation. -type OperationStatus struct { - // The properties of the resource generated. - Properties *ReportURL `json:"properties,omitempty"` - - // The status of the long running operation. - Status *OperationStatusType `json:"status,omitempty"` -} - -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - -// PivotProperties - Each pivot must contain a 'type' and 'name'. -type PivotProperties struct { - // Data field to show in view. - Name *string `json:"name,omitempty"` - - // Data type to show in view. - Type *PivotType `json:"type,omitempty"` -} - -// ProxyResource - The Resource model definition. -type ProxyResource struct { - // eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating - // the latest version or not. - ETag *string `json:"eTag,omitempty"` - - // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// QueryAggregation - The aggregation expression to be used in the query. -type QueryAggregation struct { - // REQUIRED; The name of the aggregation function to use. - Function *FunctionType `json:"function,omitempty"` - - // REQUIRED; The name of the column to aggregate. - Name *string `json:"name,omitempty"` -} - -// QueryClientUsageByExternalCloudProviderTypeOptions contains the optional parameters for the QueryClient.UsageByExternalCloudProviderType -// method. -type QueryClientUsageByExternalCloudProviderTypeOptions struct { - // placeholder for future optional parameters -} - -// QueryClientUsageOptions contains the optional parameters for the QueryClient.Usage method. -type QueryClientUsageOptions struct { - // placeholder for future optional parameters -} - -// QueryColumn properties -type QueryColumn struct { - // The name of column. - Name *string `json:"name,omitempty"` - - // The type of column. - Type *string `json:"type,omitempty"` -} - -// QueryComparisonExpression - The comparison expression to be used in the query. -type QueryComparisonExpression struct { - // REQUIRED; The name of the column to use in comparison. - Name *string `json:"name,omitempty"` - - // REQUIRED; The operator to use for comparison. - Operator *QueryOperatorType `json:"operator,omitempty"` - - // REQUIRED; Array of values to use for comparison - Values []*string `json:"values,omitempty"` -} - -// QueryDataset - The definition of data present in the query. -type QueryDataset struct { - // Dictionary of aggregation expression to use in the query. The key of each item in the dictionary is the alias for the aggregated - // column. Query can have up to 2 aggregation clauses. - Aggregation map[string]*QueryAggregation `json:"aggregation,omitempty"` - - // Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping - // are provided. - Configuration *QueryDatasetConfiguration `json:"configuration,omitempty"` - - // The filter expression to use in the query. Please reference our Query API REST documentation for how to properly format - // the filter. - Filter *QueryFilter `json:"filter,omitempty"` - - // The granularity of rows in the query. - Granularity *GranularityType `json:"granularity,omitempty"` - - // Array of group by expression to use in the query. Query can have up to 2 group by clauses. - Grouping []*QueryGrouping `json:"grouping,omitempty"` -} - -// QueryDatasetConfiguration - The configuration of dataset in the query. -type QueryDatasetConfiguration struct { - // Array of column names to be included in the query. Any valid query column name is allowed. If not provided, then query - // includes all columns. - Columns []*string `json:"columns,omitempty"` -} - -// QueryDefinition - The definition of a query. -type QueryDefinition struct { - // REQUIRED; Has definition for data in this query. - Dataset *QueryDataset `json:"dataset,omitempty"` - - // REQUIRED; The time frame for pulling data for the query. If custom, then a specific time period must be provided. - Timeframe *TimeframeType `json:"timeframe,omitempty"` - - // REQUIRED; The type of the query. - Type *ExportType `json:"type,omitempty"` - - // Has time period for pulling data for the query. - TimePeriod *QueryTimePeriod `json:"timePeriod,omitempty"` -} - -// QueryFilter - The filter expression to be used in the export. -type QueryFilter struct { - // The logical "AND" expression. Must have at least 2 items. - And []*QueryFilter `json:"and,omitempty"` - - // Has comparison expression for a dimension - Dimensions *QueryComparisonExpression `json:"dimensions,omitempty"` - - // The logical "OR" expression. Must have at least 2 items. - Or []*QueryFilter `json:"or,omitempty"` - - // Has comparison expression for a tag - Tags *QueryComparisonExpression `json:"tags,omitempty"` -} - -// QueryGrouping - The group by expression to be used in the query. -type QueryGrouping struct { - // REQUIRED; The name of the column to group. - Name *string `json:"name,omitempty"` - - // REQUIRED; Has type of the column to group. - Type *QueryColumnType `json:"type,omitempty"` -} - -// QueryProperties - Query properties -type QueryProperties struct { - // Array of columns - Columns []*QueryColumn `json:"columns,omitempty"` - - // The link (url) to the next page of results. - NextLink *string `json:"nextLink,omitempty"` - - // Array of rows - Rows [][]interface{} `json:"rows,omitempty"` -} - -// QueryResult - Result of query. It contains all columns listed under groupings and aggregation. -type QueryResult struct { - // Query properties - Properties *QueryProperties `json:"properties,omitempty"` - - // READ-ONLY; ETag of the resource. - ETag *string `json:"eTag,omitempty" azure:"ro"` - - // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Location of the resource. - Location *string `json:"location,omitempty" azure:"ro"` - - // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; SKU of the resource. - SKU *string `json:"sku,omitempty" azure:"ro"` - - // READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` - - // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// QueryTimePeriod - The start and end date for pulling data for the query. -type QueryTimePeriod struct { - // REQUIRED; The start date to pull data from. - From *time.Time `json:"from,omitempty"` - - // REQUIRED; The end date to pull data to. - To *time.Time `json:"to,omitempty"` -} - -// ReportConfigAggregation - The aggregation expression to be used in the report. -type ReportConfigAggregation struct { - // REQUIRED; The name of the aggregation function to use. - Function *FunctionType `json:"function,omitempty"` - - // REQUIRED; The name of the column to aggregate. - Name *string `json:"name,omitempty"` -} - -// ReportConfigComparisonExpression - The comparison expression to be used in the report. -type ReportConfigComparisonExpression struct { - // REQUIRED; The name of the column to use in comparison. - Name *string `json:"name,omitempty"` - - // REQUIRED; The operator to use for comparison. - Operator *OperatorType `json:"operator,omitempty"` - - // REQUIRED; Array of values to use for comparison - Values []*string `json:"values,omitempty"` -} - -// ReportConfigDataset - The definition of data present in the report. -type ReportConfigDataset struct { - // Dictionary of aggregation expression to use in the report. The key of each item in the dictionary is the alias for the - // aggregated column. Report can have up to 2 aggregation clauses. - Aggregation map[string]*ReportConfigAggregation `json:"aggregation,omitempty"` - - // Has configuration information for the data in the report. The configuration will be ignored if aggregation and grouping - // are provided. - Configuration *ReportConfigDatasetConfiguration `json:"configuration,omitempty"` - - // Has filter expression to use in the report. - Filter *ReportConfigFilter `json:"filter,omitempty"` - - // The granularity of rows in the report. - Granularity *ReportGranularityType `json:"granularity,omitempty"` - - // Array of group by expression to use in the report. Report can have up to 2 group by clauses. - Grouping []*ReportConfigGrouping `json:"grouping,omitempty"` - - // Array of order by expression to use in the report. - Sorting []*ReportConfigSorting `json:"sorting,omitempty"` -} - -// ReportConfigDatasetConfiguration - The configuration of dataset in the report. -type ReportConfigDatasetConfiguration struct { - // Array of column names to be included in the report. Any valid report column name is allowed. If not provided, then report - // includes all columns. - Columns []*string `json:"columns,omitempty"` -} - -// ReportConfigDefinition - The definition of a report config. -type ReportConfigDefinition struct { - // REQUIRED; The time frame for pulling data for the report. If custom, then a specific time period must be provided. - Timeframe *ReportTimeframeType `json:"timeframe,omitempty"` - - // REQUIRED; The type of the report. Usage represents actual usage, forecast represents forecasted data and UsageAndForecast - // represents both usage and forecasted data. Actual usage and forecasted data can be - // differentiated based on dates. - Type *ReportType `json:"type,omitempty"` - - // Has definition for data in this report config. - DataSet *ReportConfigDataset `json:"dataSet,omitempty"` - - // If true, report includes monetary commitment. - IncludeMonetaryCommitment *bool `json:"includeMonetaryCommitment,omitempty"` - - // Has time period for pulling data for the report. - TimePeriod *ReportConfigTimePeriod `json:"timePeriod,omitempty"` -} - -// ReportConfigFilter - The filter expression to be used in the report. -type ReportConfigFilter struct { - // The logical "AND" expression. Must have at least 2 items. - And []*ReportConfigFilter `json:"and,omitempty"` - - // Has comparison expression for a dimension - Dimensions *ReportConfigComparisonExpression `json:"dimensions,omitempty"` - - // The logical "OR" expression. Must have at least 2 items. - Or []*ReportConfigFilter `json:"or,omitempty"` - - // Has comparison expression for a tag - Tags *ReportConfigComparisonExpression `json:"tags,omitempty"` -} - -// ReportConfigGrouping - The group by expression to be used in the report. -type ReportConfigGrouping struct { - // REQUIRED; The name of the column to group. This version supports subscription lowest possible grain. - Name *string `json:"name,omitempty"` - - // REQUIRED; Has type of the column to group. - Type *ReportConfigColumnType `json:"type,omitempty"` -} - -// ReportConfigSorting - The order by expression to be used in the report. -type ReportConfigSorting struct { - // REQUIRED; The name of the column to sort. - Name *string `json:"name,omitempty"` - - // Direction of sort. - Direction *ReportConfigSortingType `json:"direction,omitempty"` -} - -// ReportConfigTimePeriod - The start and end date for pulling data for the report. -type ReportConfigTimePeriod struct { - // REQUIRED; The start date to pull data from. - From *time.Time `json:"from,omitempty"` - - // REQUIRED; The end date to pull data to. - To *time.Time `json:"to,omitempty"` -} - -// ReportURL - The URL to download the generated report. -type ReportURL struct { - // The CSV file from the reportUrl blob link consists of reservation usage data with the following schema at daily granularity - ReportURL *ReservationReportSchema `json:"reportUrl,omitempty"` - - // The time at which report URL becomes invalid. - ValidUntil *time.Time `json:"validUntil,omitempty"` -} - -// Resource - The Resource model definition. -type Resource struct { - // READ-ONLY; ETag of the resource. - ETag *string `json:"eTag,omitempty" azure:"ro"` - - // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Location of the resource. - Location *string `json:"location,omitempty" azure:"ro"` - - // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; SKU of the resource. - SKU *string `json:"sku,omitempty" azure:"ro"` - - // READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` - - // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// Status - The status of the long running operation. -type Status struct { - // The status of the long running operation. - Status *ReportOperationStatusType `json:"status,omitempty"` -} - -// View - States and configurations of Cost Analysis. -type View struct { - // eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating - // the latest version or not. - ETag *string `json:"eTag,omitempty"` - - // The properties of the view. - Properties *ViewProperties `json:"properties,omitempty"` - - // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ViewListResult - Result of listing views. It contains a list of available views. -type ViewListResult struct { - // READ-ONLY; The link (url) to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` - - // READ-ONLY; The list of views. - Value []*View `json:"value,omitempty" azure:"ro"` -} - -// ViewProperties - The properties of the view. -type ViewProperties struct { - // Show costs accumulated over time. - Accumulated *AccumulatedType `json:"accumulated,omitempty"` - - // Chart type of the main view in Cost Analysis. Required. - Chart *ChartType `json:"chart,omitempty"` - - // User input name of the view. Required. - DisplayName *string `json:"displayName,omitempty"` - - // List of KPIs to show in Cost Analysis UI. - Kpis []*KpiProperties `json:"kpis,omitempty"` - - // Metric to use when displaying costs. - Metric *MetricType `json:"metric,omitempty"` - - // Configuration of 3 sub-views in the Cost Analysis UI. - Pivots []*PivotProperties `json:"pivots,omitempty"` - - // Query body configuration. Required. - Query *ReportConfigDefinition `json:"query,omitempty"` - - // Cost Management scope to save the view on. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' - // for resourceGroup - // scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' - // for - // Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' - // for EnrollmentAccount scope, - // 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile - // scope, - // 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection - // scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for - // Management Group scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for - // ExternalBillingAccount scope, and - // '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope. - Scope *string `json:"scope,omitempty"` - - // READ-ONLY; Date the user created this view. - CreatedOn *time.Time `json:"createdOn,omitempty" azure:"ro"` - - // READ-ONLY; Currency of the current view. - Currency *string `json:"currency,omitempty" azure:"ro"` - - // READ-ONLY; Date range of the current view. - DateRange *string `json:"dateRange,omitempty" azure:"ro"` - - // READ-ONLY; Date when the user last modified this view. - ModifiedOn *time.Time `json:"modifiedOn,omitempty" azure:"ro"` -} - -// ViewsClientCreateOrUpdateByScopeOptions contains the optional parameters for the ViewsClient.CreateOrUpdateByScope method. -type ViewsClientCreateOrUpdateByScopeOptions struct { - // placeholder for future optional parameters -} - -// ViewsClientCreateOrUpdateOptions contains the optional parameters for the ViewsClient.CreateOrUpdate method. -type ViewsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ViewsClientDeleteByScopeOptions contains the optional parameters for the ViewsClient.DeleteByScope method. -type ViewsClientDeleteByScopeOptions struct { - // placeholder for future optional parameters -} - -// ViewsClientDeleteOptions contains the optional parameters for the ViewsClient.Delete method. -type ViewsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ViewsClientGetByScopeOptions contains the optional parameters for the ViewsClient.GetByScope method. -type ViewsClientGetByScopeOptions struct { - // placeholder for future optional parameters -} - -// ViewsClientGetOptions contains the optional parameters for the ViewsClient.Get method. -type ViewsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ViewsClientListByScopeOptions contains the optional parameters for the ViewsClient.ListByScope method. -type ViewsClientListByScopeOptions struct { - // placeholder for future optional parameters -} - -// ViewsClientListOptions contains the optional parameters for the ViewsClient.List method. -type ViewsClientListOptions struct { - // placeholder for future optional parameters -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_models_serde.go b/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_models_serde.go deleted file mode 100644 index 2eb55f6d045e..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_models_serde.go +++ /dev/null @@ -1,612 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcostmanagement - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type AlertPropertiesDetails. -func (a AlertPropertiesDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "amount", a.Amount) - populate(objectMap, "companyName", a.CompanyName) - populate(objectMap, "contactEmails", a.ContactEmails) - populate(objectMap, "contactGroups", a.ContactGroups) - populate(objectMap, "contactRoles", a.ContactRoles) - populate(objectMap, "currentSpend", a.CurrentSpend) - populate(objectMap, "departmentName", a.DepartmentName) - populate(objectMap, "enrollmentEndDate", a.EnrollmentEndDate) - populate(objectMap, "enrollmentNumber", a.EnrollmentNumber) - populate(objectMap, "enrollmentStartDate", a.EnrollmentStartDate) - populate(objectMap, "invoicingThreshold", a.InvoicingThreshold) - populate(objectMap, "meterFilter", a.MeterFilter) - populate(objectMap, "operator", a.Operator) - populate(objectMap, "overridingAlert", a.OverridingAlert) - populate(objectMap, "periodStartDate", a.PeriodStartDate) - populate(objectMap, "resourceFilter", a.ResourceFilter) - populate(objectMap, "resourceGroupFilter", a.ResourceGroupFilter) - populate(objectMap, "tagFilter", &a.TagFilter) - populate(objectMap, "threshold", a.Threshold) - populate(objectMap, "timeGrainType", a.TimeGrainType) - populate(objectMap, "triggeredBy", a.TriggeredBy) - populate(objectMap, "unit", a.Unit) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type CommonExportProperties. -func (c CommonExportProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "definition", c.Definition) - populate(objectMap, "deliveryInfo", c.DeliveryInfo) - populate(objectMap, "format", c.Format) - populateTimeRFC3339(objectMap, "nextRunTimeEstimate", c.NextRunTimeEstimate) - populate(objectMap, "partitionData", c.PartitionData) - populate(objectMap, "runHistory", c.RunHistory) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CommonExportProperties. -func (c *CommonExportProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "definition": - err = unpopulate(val, "Definition", &c.Definition) - delete(rawMsg, key) - case "deliveryInfo": - err = unpopulate(val, "DeliveryInfo", &c.DeliveryInfo) - delete(rawMsg, key) - case "format": - err = unpopulate(val, "Format", &c.Format) - delete(rawMsg, key) - case "nextRunTimeEstimate": - err = unpopulateTimeRFC3339(val, "NextRunTimeEstimate", &c.NextRunTimeEstimate) - delete(rawMsg, key) - case "partitionData": - err = unpopulate(val, "PartitionData", &c.PartitionData) - delete(rawMsg, key) - case "runHistory": - err = unpopulate(val, "RunHistory", &c.RunHistory) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DimensionProperties. -func (d *DimensionProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "category": - err = unpopulate(val, "Category", &d.Category) - delete(rawMsg, key) - case "data": - err = unpopulate(val, "Data", &d.Data) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "filterEnabled": - err = unpopulate(val, "FilterEnabled", &d.FilterEnabled) - delete(rawMsg, key) - case "groupingEnabled": - err = unpopulate(val, "GroupingEnabled", &d.GroupingEnabled) - delete(rawMsg, key) - case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) - delete(rawMsg, key) - case "total": - err = unpopulate(val, "Total", &d.Total) - delete(rawMsg, key) - case "usageEnd": - err = unpopulateTimeRFC3339(val, "UsageEnd", &d.UsageEnd) - delete(rawMsg, key) - case "usageStart": - err = unpopulateTimeRFC3339(val, "UsageStart", &d.UsageStart) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DismissAlertPayload. -func (d DismissAlertPayload) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", d.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DownloadURL. -func (d *DownloadURL) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "downloadUrl": - err = unpopulate(val, "DownloadURL", &d.DownloadURL) - delete(rawMsg, key) - case "validTill": - err = unpopulateTimeRFC3339(val, "ValidTill", &d.ValidTill) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ExportDatasetConfiguration. -func (e ExportDatasetConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "columns", e.Columns) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ExportExecutionListResult. -func (e ExportExecutionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", e.Value) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ExportExecutionProperties. -func (e ExportExecutionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "error", e.Error) - populate(objectMap, "executionType", e.ExecutionType) - populate(objectMap, "fileName", e.FileName) - populateTimeRFC3339(objectMap, "processingEndTime", e.ProcessingEndTime) - populateTimeRFC3339(objectMap, "processingStartTime", e.ProcessingStartTime) - populate(objectMap, "runSettings", e.RunSettings) - populate(objectMap, "status", e.Status) - populate(objectMap, "submittedBy", e.SubmittedBy) - populateTimeRFC3339(objectMap, "submittedTime", e.SubmittedTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportExecutionProperties. -func (e *ExportExecutionProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) - delete(rawMsg, key) - case "executionType": - err = unpopulate(val, "ExecutionType", &e.ExecutionType) - delete(rawMsg, key) - case "fileName": - err = unpopulate(val, "FileName", &e.FileName) - delete(rawMsg, key) - case "processingEndTime": - err = unpopulateTimeRFC3339(val, "ProcessingEndTime", &e.ProcessingEndTime) - delete(rawMsg, key) - case "processingStartTime": - err = unpopulateTimeRFC3339(val, "ProcessingStartTime", &e.ProcessingStartTime) - delete(rawMsg, key) - case "runSettings": - err = unpopulate(val, "RunSettings", &e.RunSettings) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &e.Status) - delete(rawMsg, key) - case "submittedBy": - err = unpopulate(val, "SubmittedBy", &e.SubmittedBy) - delete(rawMsg, key) - case "submittedTime": - err = unpopulateTimeRFC3339(val, "SubmittedTime", &e.SubmittedTime) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ExportProperties. -func (e ExportProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "definition", e.Definition) - populate(objectMap, "deliveryInfo", e.DeliveryInfo) - populate(objectMap, "format", e.Format) - populateTimeRFC3339(objectMap, "nextRunTimeEstimate", e.NextRunTimeEstimate) - populate(objectMap, "partitionData", e.PartitionData) - populate(objectMap, "runHistory", e.RunHistory) - populate(objectMap, "schedule", e.Schedule) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportProperties. -func (e *ExportProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "definition": - err = unpopulate(val, "Definition", &e.Definition) - delete(rawMsg, key) - case "deliveryInfo": - err = unpopulate(val, "DeliveryInfo", &e.DeliveryInfo) - delete(rawMsg, key) - case "format": - err = unpopulate(val, "Format", &e.Format) - delete(rawMsg, key) - case "nextRunTimeEstimate": - err = unpopulateTimeRFC3339(val, "NextRunTimeEstimate", &e.NextRunTimeEstimate) - delete(rawMsg, key) - case "partitionData": - err = unpopulate(val, "PartitionData", &e.PartitionData) - delete(rawMsg, key) - case "runHistory": - err = unpopulate(val, "RunHistory", &e.RunHistory) - delete(rawMsg, key) - case "schedule": - err = unpopulate(val, "Schedule", &e.Schedule) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ExportRecurrencePeriod. -func (e ExportRecurrencePeriod) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "from", e.From) - populateTimeRFC3339(objectMap, "to", e.To) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportRecurrencePeriod. -func (e *ExportRecurrencePeriod) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "from": - err = unpopulateTimeRFC3339(val, "From", &e.From) - delete(rawMsg, key) - case "to": - err = unpopulateTimeRFC3339(val, "To", &e.To) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ExportTimePeriod. -func (e ExportTimePeriod) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "from", e.From) - populateTimeRFC3339(objectMap, "to", e.To) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportTimePeriod. -func (e *ExportTimePeriod) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "from": - err = unpopulateTimeRFC3339(val, "From", &e.From) - delete(rawMsg, key) - case "to": - err = unpopulateTimeRFC3339(val, "To", &e.To) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ForecastDataset. -func (f ForecastDataset) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "aggregation", f.Aggregation) - populate(objectMap, "configuration", f.Configuration) - populate(objectMap, "filter", f.Filter) - populate(objectMap, "granularity", f.Granularity) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type QueryComparisonExpression. -func (q QueryComparisonExpression) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "name", q.Name) - populate(objectMap, "operator", q.Operator) - populate(objectMap, "values", q.Values) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type QueryDataset. -func (q QueryDataset) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "aggregation", q.Aggregation) - populate(objectMap, "configuration", q.Configuration) - populate(objectMap, "filter", q.Filter) - populate(objectMap, "granularity", q.Granularity) - populate(objectMap, "grouping", q.Grouping) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type QueryDatasetConfiguration. -func (q QueryDatasetConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "columns", q.Columns) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type QueryFilter. -func (q QueryFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "and", q.And) - populate(objectMap, "dimensions", q.Dimensions) - populate(objectMap, "or", q.Or) - populate(objectMap, "tags", q.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type QueryTimePeriod. -func (q QueryTimePeriod) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "from", q.From) - populateTimeRFC3339(objectMap, "to", q.To) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type QueryTimePeriod. -func (q *QueryTimePeriod) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "from": - err = unpopulateTimeRFC3339(val, "From", &q.From) - delete(rawMsg, key) - case "to": - err = unpopulateTimeRFC3339(val, "To", &q.To) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ReportConfigComparisonExpression. -func (r ReportConfigComparisonExpression) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "name", r.Name) - populate(objectMap, "operator", r.Operator) - populate(objectMap, "values", r.Values) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ReportConfigDataset. -func (r ReportConfigDataset) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "aggregation", r.Aggregation) - populate(objectMap, "configuration", r.Configuration) - populate(objectMap, "filter", r.Filter) - populate(objectMap, "granularity", r.Granularity) - populate(objectMap, "grouping", r.Grouping) - populate(objectMap, "sorting", r.Sorting) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ReportConfigDatasetConfiguration. -func (r ReportConfigDatasetConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "columns", r.Columns) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ReportConfigFilter. -func (r ReportConfigFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "and", r.And) - populate(objectMap, "dimensions", r.Dimensions) - populate(objectMap, "or", r.Or) - populate(objectMap, "tags", r.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ReportConfigTimePeriod. -func (r ReportConfigTimePeriod) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "from", r.From) - populateTimeRFC3339(objectMap, "to", r.To) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ReportConfigTimePeriod. -func (r *ReportConfigTimePeriod) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "from": - err = unpopulateTimeRFC3339(val, "From", &r.From) - delete(rawMsg, key) - case "to": - err = unpopulateTimeRFC3339(val, "To", &r.To) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ReportURL. -func (r *ReportURL) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "reportUrl": - err = unpopulate(val, "ReportURL", &r.ReportURL) - delete(rawMsg, key) - case "validUntil": - err = unpopulateTimeRFC3339(val, "ValidUntil", &r.ValidUntil) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ViewProperties. -func (v ViewProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "accumulated", v.Accumulated) - populate(objectMap, "chart", v.Chart) - populateTimeRFC3339(objectMap, "createdOn", v.CreatedOn) - populate(objectMap, "currency", v.Currency) - populate(objectMap, "dateRange", v.DateRange) - populate(objectMap, "displayName", v.DisplayName) - populate(objectMap, "kpis", v.Kpis) - populate(objectMap, "metric", v.Metric) - populateTimeRFC3339(objectMap, "modifiedOn", v.ModifiedOn) - populate(objectMap, "pivots", v.Pivots) - populate(objectMap, "query", v.Query) - populate(objectMap, "scope", v.Scope) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ViewProperties. -func (v *ViewProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "accumulated": - err = unpopulate(val, "Accumulated", &v.Accumulated) - delete(rawMsg, key) - case "chart": - err = unpopulate(val, "Chart", &v.Chart) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, "CreatedOn", &v.CreatedOn) - delete(rawMsg, key) - case "currency": - err = unpopulate(val, "Currency", &v.Currency) - delete(rawMsg, key) - case "dateRange": - err = unpopulate(val, "DateRange", &v.DateRange) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &v.DisplayName) - delete(rawMsg, key) - case "kpis": - err = unpopulate(val, "Kpis", &v.Kpis) - delete(rawMsg, key) - case "metric": - err = unpopulate(val, "Metric", &v.Metric) - delete(rawMsg, key) - case "modifiedOn": - err = unpopulateTimeRFC3339(val, "ModifiedOn", &v.ModifiedOn) - delete(rawMsg, key) - case "pivots": - err = unpopulate(val, "Pivots", &v.Pivots) - delete(rawMsg, key) - case "query": - err = unpopulate(val, "Query", &v.Query) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &v.Scope) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - } - return nil -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, fn string, v interface{}) error { - if data == nil { - return nil - } - if err := json.Unmarshal(data, v); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - return nil -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_query_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_query_client.go deleted file mode 100644 index 33fb2aa9eb69..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_query_client.go +++ /dev/null @@ -1,162 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcostmanagement - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// QueryClient contains the methods for the Query group. -// Don't use this type directly, use NewQueryClient() instead. -type QueryClient struct { - host string - pl runtime.Pipeline -} - -// NewQueryClient creates a new instance of QueryClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewQueryClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*QueryClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &QueryClient{ - host: ep, - pl: pl, - } - return client, nil -} - -// Usage - Query the usage data for scope defined. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// scope - The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription -// scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for -// resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount -// scope, -// '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. -// parameters - Parameters supplied to the CreateOrUpdate Query Config operation. -// options - QueryClientUsageOptions contains the optional parameters for the QueryClient.Usage method. -func (client *QueryClient) Usage(ctx context.Context, scope string, parameters QueryDefinition, options *QueryClientUsageOptions) (QueryClientUsageResponse, error) { - req, err := client.usageCreateRequest(ctx, scope, parameters, options) - if err != nil { - return QueryClientUsageResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return QueryClientUsageResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return QueryClientUsageResponse{}, runtime.NewResponseError(resp) - } - return client.usageHandleResponse(resp) -} - -// usageCreateRequest creates the Usage request. -func (client *QueryClient) usageCreateRequest(ctx context.Context, scope string, parameters QueryDefinition, options *QueryClientUsageOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.CostManagement/query" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// usageHandleResponse handles the Usage response. -func (client *QueryClient) usageHandleResponse(resp *http.Response) (QueryClientUsageResponse, error) { - result := QueryClientUsageResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.QueryResult); err != nil { - return QueryClientUsageResponse{}, err - } - return result, nil -} - -// UsageByExternalCloudProviderType - Query the usage data for external cloud provider type defined. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// externalCloudProviderType - The external cloud provider type associated with dimension/query operations. This includes -// 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. -// externalCloudProviderID - This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for -// consolidated account used with dimension/query operations. -// parameters - Parameters supplied to the CreateOrUpdate Query Config operation. -// options - QueryClientUsageByExternalCloudProviderTypeOptions contains the optional parameters for the QueryClient.UsageByExternalCloudProviderType -// method. -func (client *QueryClient) UsageByExternalCloudProviderType(ctx context.Context, externalCloudProviderType ExternalCloudProviderType, externalCloudProviderID string, parameters QueryDefinition, options *QueryClientUsageByExternalCloudProviderTypeOptions) (QueryClientUsageByExternalCloudProviderTypeResponse, error) { - req, err := client.usageByExternalCloudProviderTypeCreateRequest(ctx, externalCloudProviderType, externalCloudProviderID, parameters, options) - if err != nil { - return QueryClientUsageByExternalCloudProviderTypeResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return QueryClientUsageByExternalCloudProviderTypeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return QueryClientUsageByExternalCloudProviderTypeResponse{}, runtime.NewResponseError(resp) - } - return client.usageByExternalCloudProviderTypeHandleResponse(resp) -} - -// usageByExternalCloudProviderTypeCreateRequest creates the UsageByExternalCloudProviderType request. -func (client *QueryClient) usageByExternalCloudProviderTypeCreateRequest(ctx context.Context, externalCloudProviderType ExternalCloudProviderType, externalCloudProviderID string, parameters QueryDefinition, options *QueryClientUsageByExternalCloudProviderTypeOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query" - if externalCloudProviderType == "" { - return nil, errors.New("parameter externalCloudProviderType cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{externalCloudProviderType}", url.PathEscape(string(externalCloudProviderType))) - if externalCloudProviderID == "" { - return nil, errors.New("parameter externalCloudProviderID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{externalCloudProviderId}", url.PathEscape(externalCloudProviderID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// usageByExternalCloudProviderTypeHandleResponse handles the UsageByExternalCloudProviderType response. -func (client *QueryClient) usageByExternalCloudProviderTypeHandleResponse(resp *http.Response) (QueryClientUsageByExternalCloudProviderTypeResponse, error) { - result := QueryClientUsageByExternalCloudProviderTypeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.QueryResult); err != nil { - return QueryClientUsageByExternalCloudProviderTypeResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_response_types.go b/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_response_types.go deleted file mode 100644 index 0f40aeaffec8..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_response_types.go +++ /dev/null @@ -1,159 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcostmanagement - -// AlertsClientDismissResponse contains the response from method AlertsClient.Dismiss. -type AlertsClientDismissResponse struct { - Alert -} - -// AlertsClientGetResponse contains the response from method AlertsClient.Get. -type AlertsClientGetResponse struct { - Alert -} - -// AlertsClientListExternalResponse contains the response from method AlertsClient.ListExternal. -type AlertsClientListExternalResponse struct { - AlertsResult -} - -// AlertsClientListResponse contains the response from method AlertsClient.List. -type AlertsClientListResponse struct { - AlertsResult -} - -// DimensionsClientByExternalCloudProviderTypeResponse contains the response from method DimensionsClient.ByExternalCloudProviderType. -type DimensionsClientByExternalCloudProviderTypeResponse struct { - DimensionsListResult -} - -// DimensionsClientListResponse contains the response from method DimensionsClient.List. -type DimensionsClientListResponse struct { - DimensionsListResult -} - -// ExportsClientCreateOrUpdateResponse contains the response from method ExportsClient.CreateOrUpdate. -type ExportsClientCreateOrUpdateResponse struct { - Export -} - -// ExportsClientDeleteResponse contains the response from method ExportsClient.Delete. -type ExportsClientDeleteResponse struct { - // placeholder for future response values -} - -// ExportsClientExecuteResponse contains the response from method ExportsClient.Execute. -type ExportsClientExecuteResponse struct { - // placeholder for future response values -} - -// ExportsClientGetExecutionHistoryResponse contains the response from method ExportsClient.GetExecutionHistory. -type ExportsClientGetExecutionHistoryResponse struct { - ExportExecutionListResult -} - -// ExportsClientGetResponse contains the response from method ExportsClient.Get. -type ExportsClientGetResponse struct { - Export -} - -// ExportsClientListResponse contains the response from method ExportsClient.List. -type ExportsClientListResponse struct { - ExportListResult -} - -// ForecastClientExternalCloudProviderUsageResponse contains the response from method ForecastClient.ExternalCloudProviderUsage. -type ForecastClientExternalCloudProviderUsageResponse struct { - QueryResult -} - -// ForecastClientUsageResponse contains the response from method ForecastClient.Usage. -type ForecastClientUsageResponse struct { - QueryResult -} - -// GenerateDetailedCostReportClientCreateOperationResponse contains the response from method GenerateDetailedCostReportClient.CreateOperation. -type GenerateDetailedCostReportClientCreateOperationResponse struct { - GenerateDetailedCostReportOperationResult -} - -// GenerateDetailedCostReportOperationResultsClientGetResponse contains the response from method GenerateDetailedCostReportOperationResultsClient.Get. -type GenerateDetailedCostReportOperationResultsClientGetResponse struct { - GenerateDetailedCostReportOperationResult -} - -// GenerateDetailedCostReportOperationStatusClientGetResponse contains the response from method GenerateDetailedCostReportOperationStatusClient.Get. -type GenerateDetailedCostReportOperationStatusClientGetResponse struct { - GenerateDetailedCostReportOperationStatuses -} - -// GenerateReservationDetailsReportClientByBillingAccountIDResponse contains the response from method GenerateReservationDetailsReportClient.ByBillingAccountID. -type GenerateReservationDetailsReportClientByBillingAccountIDResponse struct { - OperationStatus -} - -// GenerateReservationDetailsReportClientByBillingProfileIDResponse contains the response from method GenerateReservationDetailsReportClient.ByBillingProfileID. -type GenerateReservationDetailsReportClientByBillingProfileIDResponse struct { - OperationStatus -} - -// OperationsClientListResponse contains the response from method OperationsClient.List. -type OperationsClientListResponse struct { - OperationListResult -} - -// QueryClientUsageByExternalCloudProviderTypeResponse contains the response from method QueryClient.UsageByExternalCloudProviderType. -type QueryClientUsageByExternalCloudProviderTypeResponse struct { - QueryResult -} - -// QueryClientUsageResponse contains the response from method QueryClient.Usage. -type QueryClientUsageResponse struct { - QueryResult -} - -// ViewsClientCreateOrUpdateByScopeResponse contains the response from method ViewsClient.CreateOrUpdateByScope. -type ViewsClientCreateOrUpdateByScopeResponse struct { - View -} - -// ViewsClientCreateOrUpdateResponse contains the response from method ViewsClient.CreateOrUpdate. -type ViewsClientCreateOrUpdateResponse struct { - View -} - -// ViewsClientDeleteByScopeResponse contains the response from method ViewsClient.DeleteByScope. -type ViewsClientDeleteByScopeResponse struct { - // placeholder for future response values -} - -// ViewsClientDeleteResponse contains the response from method ViewsClient.Delete. -type ViewsClientDeleteResponse struct { - // placeholder for future response values -} - -// ViewsClientGetByScopeResponse contains the response from method ViewsClient.GetByScope. -type ViewsClientGetByScopeResponse struct { - View -} - -// ViewsClientGetResponse contains the response from method ViewsClient.Get. -type ViewsClientGetResponse struct { - View -} - -// ViewsClientListByScopeResponse contains the response from method ViewsClient.ListByScope. -type ViewsClientListByScopeResponse struct { - ViewListResult -} - -// ViewsClientListResponse contains the response from method ViewsClient.List. -type ViewsClientListResponse struct { - ViewListResult -} diff --git a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_views_client.go b/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_views_client.go deleted file mode 100644 index 51a00b3475a9..000000000000 --- a/sdk/resourcemanager/costmanagement/armcostmanagement/zz_generated_views_client.go +++ /dev/null @@ -1,501 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcostmanagement - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ViewsClient contains the methods for the Views group. -// Don't use this type directly, use NewViewsClient() instead. -type ViewsClient struct { - host string - pl runtime.Pipeline -} - -// NewViewsClient creates a new instance of ViewsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewViewsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ViewsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &ViewsClient{ - host: ep, - pl: pl, - } - return client, nil -} - -// CreateOrUpdate - The operation to create or update a view. Update operation requires latest eTag to be set in the 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 -// viewName - View name -// parameters - Parameters supplied to the CreateOrUpdate View operation. -// options - ViewsClientCreateOrUpdateOptions contains the optional parameters for the ViewsClient.CreateOrUpdate method. -func (client *ViewsClient) CreateOrUpdate(ctx context.Context, viewName string, parameters View, options *ViewsClientCreateOrUpdateOptions) (ViewsClientCreateOrUpdateResponse, error) { - req, err := client.createOrUpdateCreateRequest(ctx, viewName, parameters, options) - if err != nil { - return ViewsClientCreateOrUpdateResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ViewsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return ViewsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) - } - return client.createOrUpdateHandleResponse(resp) -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ViewsClient) createOrUpdateCreateRequest(ctx context.Context, viewName string, parameters View, options *ViewsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.CostManagement/views/{viewName}" - if viewName == "" { - return nil, errors.New("parameter viewName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *ViewsClient) createOrUpdateHandleResponse(resp *http.Response) (ViewsClientCreateOrUpdateResponse, error) { - result := ViewsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.View); err != nil { - return ViewsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// CreateOrUpdateByScope - The operation to create or update a view. Update operation requires latest eTag to be set in the -// request. You may obtain the latest eTag by performing a get operation. Create operation does not -// require eTag. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// scope - The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, -// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup -// scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' -// for -// Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile -// scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection -// scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for -// Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External -// Billing Account scope and -// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. -// viewName - View name -// parameters - Parameters supplied to the CreateOrUpdate View operation. -// options - ViewsClientCreateOrUpdateByScopeOptions contains the optional parameters for the ViewsClient.CreateOrUpdateByScope -// method. -func (client *ViewsClient) CreateOrUpdateByScope(ctx context.Context, scope string, viewName string, parameters View, options *ViewsClientCreateOrUpdateByScopeOptions) (ViewsClientCreateOrUpdateByScopeResponse, error) { - req, err := client.createOrUpdateByScopeCreateRequest(ctx, scope, viewName, parameters, options) - if err != nil { - return ViewsClientCreateOrUpdateByScopeResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ViewsClientCreateOrUpdateByScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return ViewsClientCreateOrUpdateByScopeResponse{}, runtime.NewResponseError(resp) - } - return client.createOrUpdateByScopeHandleResponse(resp) -} - -// createOrUpdateByScopeCreateRequest creates the CreateOrUpdateByScope request. -func (client *ViewsClient) createOrUpdateByScopeCreateRequest(ctx context.Context, scope string, viewName string, parameters View, options *ViewsClientCreateOrUpdateByScopeOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.CostManagement/views/{viewName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) - if viewName == "" { - return nil, errors.New("parameter viewName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// createOrUpdateByScopeHandleResponse handles the CreateOrUpdateByScope response. -func (client *ViewsClient) createOrUpdateByScopeHandleResponse(resp *http.Response) (ViewsClientCreateOrUpdateByScopeResponse, error) { - result := ViewsClientCreateOrUpdateByScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.View); err != nil { - return ViewsClientCreateOrUpdateByScopeResponse{}, err - } - return result, nil -} - -// Delete - The operation to delete a view. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// viewName - View name -// options - ViewsClientDeleteOptions contains the optional parameters for the ViewsClient.Delete method. -func (client *ViewsClient) Delete(ctx context.Context, viewName string, options *ViewsClientDeleteOptions) (ViewsClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, viewName, options) - if err != nil { - return ViewsClientDeleteResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ViewsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return ViewsClientDeleteResponse{}, runtime.NewResponseError(resp) - } - return ViewsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ViewsClient) deleteCreateRequest(ctx context.Context, viewName string, options *ViewsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.CostManagement/views/{viewName}" - if viewName == "" { - return nil, errors.New("parameter viewName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// DeleteByScope - The operation to delete a view. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// scope - The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, -// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup -// scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' -// for -// Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile -// scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection -// scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for -// Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External -// Billing Account scope and -// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. -// viewName - View name -// options - ViewsClientDeleteByScopeOptions contains the optional parameters for the ViewsClient.DeleteByScope method. -func (client *ViewsClient) DeleteByScope(ctx context.Context, scope string, viewName string, options *ViewsClientDeleteByScopeOptions) (ViewsClientDeleteByScopeResponse, error) { - req, err := client.deleteByScopeCreateRequest(ctx, scope, viewName, options) - if err != nil { - return ViewsClientDeleteByScopeResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ViewsClientDeleteByScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return ViewsClientDeleteByScopeResponse{}, runtime.NewResponseError(resp) - } - return ViewsClientDeleteByScopeResponse{}, nil -} - -// deleteByScopeCreateRequest creates the DeleteByScope request. -func (client *ViewsClient) deleteByScopeCreateRequest(ctx context.Context, scope string, viewName string, options *ViewsClientDeleteByScopeOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.CostManagement/views/{viewName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) - if viewName == "" { - return nil, errors.New("parameter viewName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets the view by view name. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// viewName - View name -// options - ViewsClientGetOptions contains the optional parameters for the ViewsClient.Get method. -func (client *ViewsClient) Get(ctx context.Context, viewName string, options *ViewsClientGetOptions) (ViewsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, viewName, options) - if err != nil { - return ViewsClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ViewsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ViewsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *ViewsClient) getCreateRequest(ctx context.Context, viewName string, options *ViewsClientGetOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.CostManagement/views/{viewName}" - if viewName == "" { - return nil, errors.New("parameter viewName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ViewsClient) getHandleResponse(resp *http.Response) (ViewsClientGetResponse, error) { - result := ViewsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.View); err != nil { - return ViewsClientGetResponse{}, err - } - return result, nil -} - -// GetByScope - Gets the view for the defined scope by view name. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// scope - The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, -// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup -// scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' -// for -// Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile -// scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection -// scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for -// Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External -// Billing Account scope and -// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. -// viewName - View name -// options - ViewsClientGetByScopeOptions contains the optional parameters for the ViewsClient.GetByScope method. -func (client *ViewsClient) GetByScope(ctx context.Context, scope string, viewName string, options *ViewsClientGetByScopeOptions) (ViewsClientGetByScopeResponse, error) { - req, err := client.getByScopeCreateRequest(ctx, scope, viewName, options) - if err != nil { - return ViewsClientGetByScopeResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ViewsClientGetByScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ViewsClientGetByScopeResponse{}, runtime.NewResponseError(resp) - } - return client.getByScopeHandleResponse(resp) -} - -// getByScopeCreateRequest creates the GetByScope request. -func (client *ViewsClient) getByScopeCreateRequest(ctx context.Context, scope string, viewName string, options *ViewsClientGetByScopeOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.CostManagement/views/{viewName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) - if viewName == "" { - return nil, errors.New("parameter viewName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getByScopeHandleResponse handles the GetByScope response. -func (client *ViewsClient) getByScopeHandleResponse(resp *http.Response) (ViewsClientGetByScopeResponse, error) { - result := ViewsClientGetByScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.View); err != nil { - return ViewsClientGetByScopeResponse{}, err - } - return result, nil -} - -// NewListPager - Lists all views by tenant and object. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// options - ViewsClientListOptions contains the optional parameters for the ViewsClient.List method. -func (client *ViewsClient) NewListPager(options *ViewsClientListOptions) *runtime.Pager[ViewsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[ViewsClientListResponse]{ - More: func(page ViewsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ViewsClientListResponse) (ViewsClientListResponse, 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 ViewsClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ViewsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ViewsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - }) -} - -// listCreateRequest creates the List request. -func (client *ViewsClient) listCreateRequest(ctx context.Context, options *ViewsClientListOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.CostManagement/views" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *ViewsClient) listHandleResponse(resp *http.Response) (ViewsClientListResponse, error) { - result := ViewsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ViewListResult); err != nil { - return ViewsClientListResponse{}, err - } - return result, nil -} - -// NewListByScopePager - Lists all views at the given scope. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 -// scope - The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, -// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup -// scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' -// for -// Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile -// scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection -// scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for -// Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External -// Billing Account scope and -// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. -// options - ViewsClientListByScopeOptions contains the optional parameters for the ViewsClient.ListByScope method. -func (client *ViewsClient) NewListByScopePager(scope string, options *ViewsClientListByScopeOptions) *runtime.Pager[ViewsClientListByScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[ViewsClientListByScopeResponse]{ - More: func(page ViewsClientListByScopeResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ViewsClientListByScopeResponse) (ViewsClientListByScopeResponse, 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 ViewsClientListByScopeResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ViewsClientListByScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ViewsClientListByScopeResponse{}, runtime.NewResponseError(resp) - } - return client.listByScopeHandleResponse(resp) - }, - }) -} - -// listByScopeCreateRequest creates the ListByScope request. -func (client *ViewsClient) listByScopeCreateRequest(ctx context.Context, scope string, options *ViewsClientListByScopeOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.CostManagement/views" - 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", "2021-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByScopeHandleResponse handles the ListByScope response. -func (client *ViewsClient) listByScopeHandleResponse(resp *http.Response) (ViewsClientListByScopeResponse, error) { - result := ViewsClientListByScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ViewListResult); err != nil { - return ViewsClientListByScopeResponse{}, err - } - return result, nil -}