diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 28421c2220b7..f862bd7ac9b2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9397,24 +9397,27 @@ importers: sdk/cost-management/arm-costmanagement: dependencies: + '@azure-rest/core-client': + specifier: ^2.3.1 + version: link:../../core/core-client-rest '@azure/abort-controller': specifier: ^2.1.2 version: link:../../core/abort-controller '@azure/core-auth': specifier: ^1.9.0 version: link:../../core/core-auth - '@azure/core-client': - specifier: ^1.9.2 - version: link:../../core/core-client '@azure/core-lro': - specifier: ^2.5.0 - version: 2.7.2 - '@azure/core-paging': - specifier: ^1.6.2 - version: link:../../core/core-paging + specifier: ^3.1.0 + version: link:../../core/core-lro '@azure/core-rest-pipeline': specifier: link:../../core/core-rest-pipeline version: link:../../core/core-rest-pipeline + '@azure/core-util': + specifier: ^1.12.0 + version: link:../../core/core-util + '@azure/logger': + specifier: ^1.2.0 + version: link:../../core/logger tslib: specifier: ^2.8.1 version: 2.8.1 @@ -9431,12 +9434,12 @@ importers: '@azure/dev-tool': specifier: workspace:^ version: link:../../../common/tools/dev-tool + '@azure/eslint-plugin-azure-sdk': + specifier: workspace:^ + version: link:../../../common/tools/eslint-plugin-azure-sdk '@azure/identity': specifier: catalog:internal version: 4.13.0 - '@azure/logger': - specifier: ^1.1.4 - version: link:../../core/logger '@types/node': specifier: 'catalog:' version: 20.19.41 @@ -9452,9 +9455,15 @@ importers: dotenv: specifier: catalog:testing version: 16.6.1 + eslint: + specifier: 'catalog:' + version: 9.39.4 playwright: specifier: catalog:testing version: 1.60.0 + prettier: + specifier: 'catalog:' + version: 3.8.3 rimraf: specifier: 'catalog:' version: 6.1.3 diff --git a/sdk/cost-management/arm-costmanagement/CHANGELOG.md b/sdk/cost-management/arm-costmanagement/CHANGELOG.md index 5884528a2bbc..b3427355b755 100644 --- a/sdk/cost-management/arm-costmanagement/CHANGELOG.md +++ b/sdk/cost-management/arm-costmanagement/CHANGELOG.md @@ -1,21 +1,211 @@ # Release History -## 1.0.0-beta.3 (Unreleased) +## 1.0.0-beta.3 (2026-06-05) +Compared with version 1.0.0-beta.1 ### Features Added + - Added operation group BudgetsOperations + - Added operation group CostAllocationRulesOperations + - Added operation group GenerateBenefitUtilizationSummariesReportOperations + - Added operation group SettingsOperations + - Added operation GenerateCostDetailsReportOperations.createOperation + - Added operation GenerateCostDetailsReportOperations.getOperationResults + - Added operation GenerateDetailedCostReportOperations.createOperation + - Added operation GenerateDetailedCostReportOperationResultsOperations.get + - Added operation GenerateReservationDetailsReportOperations.byBillingAccountId + - Added operation GenerateReservationDetailsReportOperations.byBillingProfileId + - Added operation PriceSheetOperations.downloadByBillingAccount + - Added operation PriceSheetOperations.downloadByBillingProfile + - Added operation PriceSheetOperations.downloadByInvoice + - Added Interface AlertProperties + - Added Interface ArmErrorResponse + - Added Interface AsyncOperationStatusProperties + - Added Interface BenefitUtilizationSummariesOperationStatus + - Added Interface BenefitUtilizationSummariesRequest + - Added Interface Budget + - Added Interface BudgetComparisonExpression + - Added Interface BudgetFilter + - Added Interface BudgetFilterProperties + - Added Interface BudgetProperties + - Added Interface BudgetsCreateOrUpdateOptionalParams + - Added Interface BudgetsDeleteOptionalParams + - Added Interface BudgetsGetOptionalParams + - Added Interface BudgetsListOptionalParams + - Added Interface BudgetTimePeriod + - Added Interface CostAllocationProportion + - Added Interface CostAllocationResource + - Added Interface CostAllocationRuleCheckNameAvailabilityRequest + - Added Interface CostAllocationRuleCheckNameAvailabilityResponse + - Added Interface CostAllocationRuleDefinition + - Added Interface CostAllocationRuleDetails + - Added Interface CostAllocationRuleProperties + - Added Interface CostAllocationRulesCheckNameAvailabilityOptionalParams + - Added Interface CostAllocationRulesCreateOrUpdateOptionalParams + - Added Interface CostAllocationRulesDeleteOptionalParams + - Added Interface CostAllocationRulesGetOptionalParams + - Added Interface CostAllocationRulesListOptionalParams + - Added Interface CurrentSpend + - Added Interface DimensionProperties + - Added Interface DimensionsListByExternalCloudProviderTypeOptionalParams + - Added Interface ErrorAdditionalInfo + - Added Interface ErrorDetail + - Added Interface ExportRunProperties + - Added Interface ExportRunRequest + - Added Interface ExportSuspensionContext + - Added Interface ExtensionResource + - Added Interface FilterItems + - Added Interface ForecastProperties + - Added Interface ForecastSpend + - Added Interface GenerateBenefitUtilizationSummariesReportGenerateByBillingAccountOptionalParams + - Added Interface GenerateBenefitUtilizationSummariesReportGenerateByBillingProfileOptionalParams + - Added Interface GenerateBenefitUtilizationSummariesReportGenerateByReservationIdOptionalParams + - Added Interface GenerateBenefitUtilizationSummariesReportGenerateByReservationOrderIdOptionalParams + - Added Interface GenerateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdOptionalParams + - Added Interface GenerateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdOptionalParams + - Added Interface MCAPriceSheetProperties + - Added Interface Notification + - Added Interface PagedAsyncIterableIterator + - Added Interface PageSettings + - Added Interface PriceSheetDownloadByBillingAccountOptionalParams + - Added Interface PriceSheetDownloadByInvoiceOptionalParams + - Added Interface PricesheetDownloadProperties + - Added Interface QueryProperties + - Added Interface ReportConfigDefinition + - Added Interface ReportManifest + - Added Interface ReportURL + - Added Interface RequestContext + - Added Interface RestorePollerOptions + - Added Interface ScheduledActionProperties + - Added Interface Setting + - Added Interface SettingsCreateOrUpdateByScopeOptionalParams + - Added Interface SettingsDeleteByScopeOptionalParams + - Added Interface SettingsGetByScopeOptionalParams + - Added Interface SettingsListOptionalParams + - Added Interface SettingsListResult + - Added Interface SourceCostAllocationResource + - Added Interface SystemAssignedServiceIdentity + - Added Interface TagInheritanceProperties + - Added Interface TagInheritanceSetting + - Added Interface TargetCostAllocationResource + - Added Interface ViewProperties + - Interface Alert has a new optional parameter systemData + - Interface BenefitRecommendationModel has a new optional parameter systemData + - Interface BenefitResource has a new optional parameter systemData + - Interface BenefitUtilizationSummary has a new optional parameter systemData + - Interface CommonExportProperties has a new optional parameter compressionMode + - Interface CommonExportProperties has a new optional parameter dataOverwriteBehavior + - Interface CommonExportProperties has a new optional parameter exportDescription + - Interface CommonExportProperties has a new optional parameter systemSuspensionContext + - Interface CostDetailsOperationResults has a new optional parameter requestContext + - Interface Export has a new optional parameter compressionMode + - Interface Export has a new optional parameter dataOverwriteBehavior + - Interface Export has a new optional parameter exportDescription + - Interface Export has a new optional parameter identity + - Interface Export has a new optional parameter location + - Interface Export has a new optional parameter systemSuspensionContext + - Interface Export has a new optional parameter systemData + - Interface ExportDatasetConfiguration has a new optional parameter dataVersion + - Interface ExportDatasetConfiguration has a new optional parameter filters + - Interface ExportDeliveryDestination has a new optional parameter type + - Interface ExportProperties has a new optional parameter compressionMode + - Interface ExportProperties has a new optional parameter dataOverwriteBehavior + - Interface ExportProperties has a new optional parameter exportDescription + - Interface ExportProperties has a new optional parameter systemSuspensionContext + - Interface ExportRun has a new optional parameter endDate + - Interface ExportRun has a new optional parameter manifestFile + - Interface ExportRun has a new optional parameter startDate + - Interface ExportsExecuteOptionalParams has a new optional parameter parameters + - Interface GenerateDetailedCostReportOperationResult has a new optional parameter systemData + - Interface GenerateDetailedCostReportOperationStatuses has a new optional parameter systemData + - Interface IncludedQuantityUtilizationSummary has a new optional parameter systemData + - Interface ProxyResource has a new optional parameter systemData + - Interface Resource has a new optional parameter systemData + - Interface SavingsPlanUtilizationSummary has a new optional parameter systemData + - Interface View has a new optional parameter query + - Interface View has a new optional parameter systemData + - Added Type Alias AzureSupportedClouds + - Added Type Alias BenefitUtilizationSummaryReportSchema + - Added Type Alias BudgetNotificationOperatorType + - Added Type Alias BudgetOperatorType + - Added Type Alias CategoryType + - Added Type Alias CompressionModeType + - Added Type Alias CostAllocationPolicyType + - Added Type Alias CostAllocationResourceType + - Added Type Alias CultureCode + - Added Type Alias DataOverwriteBehaviorType + - Added Type Alias DestinationType + - Added Type Alias FilterItemNames + - Added Type Alias Frequency + - Added Type Alias Reason + - Added Type Alias RuleStatus + - Added Type Alias SettingsKind + - Added Type Alias SettingType + - Added Type Alias SettingUnion + - Added Type Alias SystemAssignedServiceIdentityType + - Added Type Alias ThresholdType + - Added Type Alias TimeGrainType + - Added Enum AzureClouds + - Added Enum KnownBenefitUtilizationSummaryReportSchema + - Added Enum KnownBudgetNotificationOperatorType + - Added Enum KnownBudgetOperatorType + - Added Enum KnownCategoryType + - Added Enum KnownCompressionModeType + - Added Enum KnownCostAllocationPolicyType + - Added Enum KnownCostAllocationResourceType + - Added Enum KnownCultureCode + - Added Enum KnownDataOverwriteBehaviorType + - Added Enum KnownDestinationType + - Added Enum KnownFilterItemNames + - Added Enum KnownFrequency + - Added Enum KnownReason + - Added Enum KnownRuleStatus + - Added Enum KnownSettingsKind + - Added Enum KnownSettingType + - Added Enum KnownSystemAssignedServiceIdentityType + - Added Enum KnownThresholdType + - Added Enum KnownTimeGrainType + - Added Enum KnownVersions + - Enum KnownExportType has a new value FocusCost + - Enum KnownExportType has a new value PriceSheet + - Enum KnownExportType has a new value ReservationDetails + - Enum KnownExportType has a new value ReservationRecommendations + - Enum KnownExportType has a new value ReservationTransactions + - Enum KnownFormatType has a new value Parquet + - Enum KnownGranularityType has a new value Monthly + - Enum KnownTimeframeType has a new value TheCurrentMonth ### Breaking Changes + - Removed operation GenerateCostDetailsReport.beginCreateOperation + - Removed operation GenerateCostDetailsReport.beginCreateOperationAndWait + - Removed operation GenerateCostDetailsReport.beginGetOperationResults + - Removed operation GenerateCostDetailsReport.beginGetOperationResultsAndWait + - Removed operation GenerateDetailedCostReport.beginCreateOperation + - Removed operation GenerateDetailedCostReport.beginCreateOperationAndWait + - Removed operation GenerateDetailedCostReportOperationResults.beginGet + - Removed operation GenerateDetailedCostReportOperationResults.beginGetAndWait + - Removed operation GenerateReservationDetailsReport.beginByBillingAccountId + - Removed operation GenerateReservationDetailsReport.beginByBillingAccountIdAndWait + - Removed operation GenerateReservationDetailsReport.beginByBillingProfileId + - Removed operation GenerateReservationDetailsReport.beginByBillingProfileIdAndWait + - Removed operation PriceSheet.beginDownload + - Removed operation PriceSheet.beginDownloadAndWait + - Removed operation PriceSheet.beginDownloadByBillingProfile + - Removed operation PriceSheet.beginDownloadByBillingProfileAndWait + - Class CostManagementClient no longer has parameter apiVersion + - Removed Interface DimensionsByExternalCloudProviderTypeOptionalParams + - Removed Interface PriceSheetDownloadOptionalParams + - Removed Interface ScheduledActionProxyResource + - Type of parameter scope of interface BenefitRecommendationProperties is changed from "Single" | "Shared" to Scope + - Interface CostDetailsOperationResults no longer has parameter requestBody + - Interface CostDetailsOperationResults no longer has parameter requestScope + - Interface View no longer has parameter dataSet + - Interface View no longer has parameter includeMonetaryCommitment + - Interface View no longer has parameter timeframe + - Interface View no longer has parameter timePeriod + - Interface View no longer has parameter typePropertiesQueryType + - Type alias "BenefitRecommendationPropertiesUnion" has been changed -### Bugs Fixed - -### Other Changes - -## 1.0.0-beta.2 (2025-08-22) - -### Other Changes - - - Other fixes - + ## 1.0.0-beta.1 (2023-05-09) -The package of @azure/arm-costmanagement is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart ). +The package of @azure/arm-costmanagement is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart). diff --git a/sdk/cost-management/arm-costmanagement/LICENSE b/sdk/cost-management/arm-costmanagement/LICENSE index b2f52a2bad4e..63447fd8bbbf 100644 --- a/sdk/cost-management/arm-costmanagement/LICENSE +++ b/sdk/cost-management/arm-costmanagement/LICENSE @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +SOFTWARE. \ No newline at end of file diff --git a/sdk/cost-management/arm-costmanagement/README.md b/sdk/cost-management/arm-costmanagement/README.md index 1dced9c0cf2a..3f07ab06c257 100644 --- a/sdk/cost-management/arm-costmanagement/README.md +++ b/sdk/cost-management/arm-costmanagement/README.md @@ -4,10 +4,12 @@ This package contains an isomorphic SDK (runs both in Node.js and in browsers) f CostManagement management client provides access to CostManagement resources for Azure Enterprise Subscriptions. -[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cost-management/arm-costmanagement) | -[Package (NPM)](https://www.npmjs.com/package/@azure/arm-costmanagement) | -[API reference documentation](https://learn.microsoft.com/javascript/api/@azure/arm-costmanagement) | -[Samples](https://github.com/Azure-Samples/azure-samples-js-management) +Key links: + +- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cost-management/arm-costmanagement) +- [Package (NPM)](https://www.npmjs.com/package/@azure/arm-costmanagement) +- [API reference documentation](https://learn.microsoft.com/javascript/api/@azure/arm-costmanagement?view=azure-node-preview) +- [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cost-management/arm-costmanagement/samples) ## Getting started @@ -35,7 +37,7 @@ npm install @azure/arm-costmanagement To create a client object to access the Azure CostManagement API, you will need the `endpoint` of your Azure CostManagement resource and a `credential`. The Azure CostManagement client can use Azure Active Directory credentials to authenticate. You can find the endpoint for your Azure CostManagement resource in the [Azure Portal][azure_portal]. -You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). +You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: @@ -44,7 +46,6 @@ npm install @azure/identity ``` You will also need to **register a new AAD application and grant access to Azure CostManagement** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). -Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. For more information about how to create an Azure AD Application check out [this guide](https://learn.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). @@ -70,8 +71,8 @@ const credential = new InteractiveBrowserCredential({ const client = new CostManagementClient(credential); ``` -### JavaScript Bundle +### JavaScript Bundle To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). ## Key concepts @@ -96,7 +97,7 @@ For more detailed instructions on how to enable logs, you can look at the [@azur ## Next steps -Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. +Please take a look at the [samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cost-management/arm-costmanagement/samples) directory for detailed examples on how to use this library. ## Contributing @@ -106,10 +107,6 @@ If you'd like to contribute to this library, please read the [contributing guide - [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) - - -[azure_cli]: https://learn.microsoft.com/cli/azure -[azure_sub]: https://azure.microsoft.com/free/ [azure_sub]: https://azure.microsoft.com/free/ [azure_portal]: https://portal.azure.com [azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity diff --git a/sdk/cost-management/arm-costmanagement/_meta.json b/sdk/cost-management/arm-costmanagement/_meta.json deleted file mode 100644 index 9ff52fc13ed3..000000000000 --- a/sdk/cost-management/arm-costmanagement/_meta.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "commit": "d5c8648e01a2a2a743c2649c9522d21f5db952ce", - "readme": "specification/cost-management/resource-manager/readme.md", - "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\cost-management\\resource-manager\\readme.md --use=@autorest/typescript@6.0.1 --generate-sample=true", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.6.2", - "use": "@autorest/typescript@6.0.1" -} diff --git a/sdk/cost-management/arm-costmanagement/api-extractor.json b/sdk/cost-management/arm-costmanagement/api-extractor.json index 16d81e2eb512..870d6d399477 100644 --- a/sdk/cost-management/arm-costmanagement/api-extractor.json +++ b/sdk/cost-management/arm-costmanagement/api-extractor.json @@ -1,3 +1 @@ -{ - "extends": "../../../api-extractor-base.json" -} +{ "extends": "../../../api-extractor-base.json" } diff --git a/sdk/cost-management/arm-costmanagement/config/tsconfig.lint.json b/sdk/cost-management/arm-costmanagement/config/tsconfig.lint.json index 8431a95cbcb1..3a31a03786d2 100644 --- a/sdk/cost-management/arm-costmanagement/config/tsconfig.lint.json +++ b/sdk/cost-management/arm-costmanagement/config/tsconfig.lint.json @@ -1,7 +1,4 @@ { "extends": "../../../../tsconfig.json", - "include": [ - "../src", - "../test" - ] + "include": ["../src", "../test"] } diff --git a/sdk/cost-management/arm-costmanagement/config/tsconfig.samples.json b/sdk/cost-management/arm-costmanagement/config/tsconfig.samples.json index c1b6bcb07544..d061d4ca3a66 100644 --- a/sdk/cost-management/arm-costmanagement/config/tsconfig.samples.json +++ b/sdk/cost-management/arm-costmanagement/config/tsconfig.samples.json @@ -2,9 +2,7 @@ "extends": "../../../../eng/tsconfigs/samples.json", "compilerOptions": { "paths": { - "@azure/arm-costmanagement": [ - "../dist/esm" - ] + "@azure/arm-costmanagement": ["../dist/esm"] } } } diff --git a/sdk/cost-management/arm-costmanagement/config/tsconfig.src.browser.json b/sdk/cost-management/arm-costmanagement/config/tsconfig.src.browser.json index 2e75154106a2..429817e79b26 100644 --- a/sdk/cost-management/arm-costmanagement/config/tsconfig.src.browser.json +++ b/sdk/cost-management/arm-costmanagement/config/tsconfig.src.browser.json @@ -1,6 +1,4 @@ { "extends": "../../../../eng/tsconfigs/src.browser.json", - "include": [ - "../src/index.ts" - ] + "include": ["../src/index.ts"] } diff --git a/sdk/cost-management/arm-costmanagement/config/tsconfig.src.cjs.json b/sdk/cost-management/arm-costmanagement/config/tsconfig.src.cjs.json index 018cc5885d5b..b000a4a9909e 100644 --- a/sdk/cost-management/arm-costmanagement/config/tsconfig.src.cjs.json +++ b/sdk/cost-management/arm-costmanagement/config/tsconfig.src.cjs.json @@ -1,6 +1,4 @@ { "extends": "../../../../eng/tsconfigs/src.cjs.json", - "include": [ - "../src/index.ts" - ] + "include": ["../src/index.ts"] } diff --git a/sdk/cost-management/arm-costmanagement/config/tsconfig.src.esm.json b/sdk/cost-management/arm-costmanagement/config/tsconfig.src.esm.json index bc91d3d2b231..b393943938eb 100644 --- a/sdk/cost-management/arm-costmanagement/config/tsconfig.src.esm.json +++ b/sdk/cost-management/arm-costmanagement/config/tsconfig.src.esm.json @@ -1,6 +1,4 @@ { "extends": "../../../../eng/tsconfigs/src.esm.json", - "include": [ - "../src/index.ts" - ] + "include": ["../src/index.ts"] } diff --git a/sdk/cost-management/arm-costmanagement/config/tsconfig.test.browser.json b/sdk/cost-management/arm-costmanagement/config/tsconfig.test.browser.json new file mode 100644 index 000000000000..c0d662573ef7 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/config/tsconfig.test.browser.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../eng/tsconfigs/test.browser.json", + "compilerOptions": { + "paths": { + "@azure/arm-costmanagement": ["../src/index.ts"], + "@azure/arm-costmanagement/*": ["../src/*"], + "$internal/*": ["../src/*"] + } + } +} diff --git a/sdk/cost-management/arm-costmanagement/config/tsconfig.test.node.json b/sdk/cost-management/arm-costmanagement/config/tsconfig.test.node.json index d123d08c39d5..00ee2b6ef71c 100644 --- a/sdk/cost-management/arm-costmanagement/config/tsconfig.test.node.json +++ b/sdk/cost-management/arm-costmanagement/config/tsconfig.test.node.json @@ -1,3 +1,10 @@ { - "extends": "../../../../eng/tsconfigs/test.node.json" + "extends": "../../../../eng/tsconfigs/test.node.json", + "compilerOptions": { + "paths": { + "@azure/arm-costmanagement": ["../src/index.ts"], + "@azure/arm-costmanagement/*": ["../src/*"], + "$internal/*": ["../src/*"] + } + } } diff --git a/sdk/cost-management/arm-costmanagement/eslint.config.mjs b/sdk/cost-management/arm-costmanagement/eslint.config.mjs index 06fec08fcab3..93322da715ec 100644 --- a/sdk/cost-management/arm-costmanagement/eslint.config.mjs +++ b/sdk/cost-management/arm-costmanagement/eslint.config.mjs @@ -9,9 +9,9 @@ export default [ "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", "@azure/azure-sdk/ts-package-json-files-required": "off", "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", - "tsdoc/syntax": "warn" - } - } + "tsdoc/syntax": "warn", + }, + }, ]), { files: ["src/**/*.ts", "src/**/*.mts", "test/**/*.ts"], diff --git a/sdk/cost-management/arm-costmanagement/metadata.json b/sdk/cost-management/arm-costmanagement/metadata.json new file mode 100644 index 000000000000..eae45ae3a1ec --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/metadata.json @@ -0,0 +1,309 @@ +{ + "apiVersions": { + "Microsoft.CostManagement": "2025-03-01" + }, + "emitterVersion": "0.54.1", + "crossLanguageDefinitions": { + "CrossLanguagePackageId": "Microsoft.CostManagement", + "CrossLanguageDefinitionId": { + "@azure/arm-costmanagement!GenerateDetailedCostReportOperationStatuses:interface": "Microsoft.CostManagement.GenerateDetailedCostReportOperationStatuses", + "@azure/arm-costmanagement!DownloadURL:interface": "Microsoft.CostManagement.DownloadURL", + "@azure/arm-costmanagement!Status:interface": "Microsoft.CostManagement.Status", + "@azure/arm-costmanagement!ErrorDetails:interface": "Microsoft.CostManagement.ErrorDetails", + "@azure/arm-costmanagement!ExtensionResource:interface": "Azure.ResourceManager.CommonTypes.ExtensionResource", + "@azure/arm-costmanagement!Resource:interface": "Azure.ResourceManager.CommonTypes.Resource", + "@azure/arm-costmanagement!SystemData:interface": "Azure.ResourceManager.CommonTypes.SystemData", + "@azure/arm-costmanagement!ErrorResponse:interface": "Microsoft.CostManagement.ErrorResponse", + "@azure/arm-costmanagement!OperationListResult:interface": "Microsoft.CostManagement.OperationListResult", + "@azure/arm-costmanagement!CostManagementOperation:interface": "Microsoft.CostManagement.CostManagementOperation", + "@azure/arm-costmanagement!Operation:interface": "Azure.ResourceManager.CommonTypes.Operation", + "@azure/arm-costmanagement!OperationDisplay:interface": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "@azure/arm-costmanagement!Budget:interface": "Microsoft.CostManagement.Budget", + "@azure/arm-costmanagement!BudgetProperties:interface": "Microsoft.CostManagement.BudgetProperties", + "@azure/arm-costmanagement!BudgetTimePeriod:interface": "Microsoft.CostManagement.BudgetTimePeriod", + "@azure/arm-costmanagement!BudgetFilter:interface": "Microsoft.CostManagement.BudgetFilter", + "@azure/arm-costmanagement!BudgetFilterProperties:interface": "Microsoft.CostManagement.BudgetFilterProperties", + "@azure/arm-costmanagement!BudgetComparisonExpression:interface": "Microsoft.CostManagement.BudgetComparisonExpression", + "@azure/arm-costmanagement!CurrentSpend:interface": "Microsoft.CostManagement.CurrentSpend", + "@azure/arm-costmanagement!Notification:interface": "Microsoft.CostManagement.Notification", + "@azure/arm-costmanagement!ForecastSpend:interface": "Microsoft.CostManagement.ForecastSpend", + "@azure/arm-costmanagement!BudgetsListResult:interface": "Microsoft.CostManagement.BudgetsListResult", + "@azure/arm-costmanagement!Export:interface": "Microsoft.CostManagement.Export", + "@azure/arm-costmanagement!ExportProperties:interface": "Microsoft.CostManagement.ExportProperties", + "@azure/arm-costmanagement!ExportSchedule:interface": "Microsoft.CostManagement.ExportSchedule", + "@azure/arm-costmanagement!ExportRecurrencePeriod:interface": "Microsoft.CostManagement.ExportRecurrencePeriod", + "@azure/arm-costmanagement!CommonExportProperties:interface": "Microsoft.CostManagement.CommonExportProperties", + "@azure/arm-costmanagement!ExportDeliveryInfo:interface": "Microsoft.CostManagement.ExportDeliveryInfo", + "@azure/arm-costmanagement!ExportDeliveryDestination:interface": "Microsoft.CostManagement.ExportDeliveryDestination", + "@azure/arm-costmanagement!ExportDefinition:interface": "Microsoft.CostManagement.ExportDefinition", + "@azure/arm-costmanagement!ExportTimePeriod:interface": "Microsoft.CostManagement.ExportTimePeriod", + "@azure/arm-costmanagement!ExportDataset:interface": "Microsoft.CostManagement.ExportDataset", + "@azure/arm-costmanagement!ExportDatasetConfiguration:interface": "Microsoft.CostManagement.ExportDatasetConfiguration", + "@azure/arm-costmanagement!FilterItems:interface": "Microsoft.CostManagement.FilterItems", + "@azure/arm-costmanagement!ExportExecutionListResult:interface": "Microsoft.CostManagement.ExportExecutionListResult", + "@azure/arm-costmanagement!ExportRun:interface": "Microsoft.CostManagement.ExportRun", + "@azure/arm-costmanagement!ExportRunProperties:interface": "Microsoft.CostManagement.ExportRunProperties", + "@azure/arm-costmanagement!CostManagementProxyResource:interface": "Microsoft.CostManagement.CostManagementProxyResource", + "@azure/arm-costmanagement!ExportSuspensionContext:interface": "Microsoft.CostManagement.ExportSuspensionContext", + "@azure/arm-costmanagement!SystemAssignedServiceIdentity:interface": "Azure.ResourceManager.CommonTypes.SystemAssignedServiceIdentity", + "@azure/arm-costmanagement!ExportListResult:interface": "Microsoft.CostManagement.ExportListResult", + "@azure/arm-costmanagement!ExportRunRequest:interface": "Microsoft.CostManagement.ExportRunRequest", + "@azure/arm-costmanagement!GenerateDetailedCostReportOperationResult:interface": "Microsoft.CostManagement.GenerateDetailedCostReportOperationResult", + "@azure/arm-costmanagement!View:interface": "Microsoft.CostManagement.View", + "@azure/arm-costmanagement!ViewProperties:interface": "Microsoft.CostManagement.ViewProperties", + "@azure/arm-costmanagement!ReportConfigDefinition:interface": "Microsoft.CostManagement.ReportConfigDefinition", + "@azure/arm-costmanagement!ReportConfigTimePeriod:interface": "Microsoft.CostManagement.ReportConfigTimePeriod", + "@azure/arm-costmanagement!ReportConfigDataset:interface": "Microsoft.CostManagement.ReportConfigDataset", + "@azure/arm-costmanagement!ReportConfigDatasetConfiguration:interface": "Microsoft.CostManagement.ReportConfigDatasetConfiguration", + "@azure/arm-costmanagement!ReportConfigAggregation:interface": "Microsoft.CostManagement.ReportConfigAggregation", + "@azure/arm-costmanagement!ReportConfigGrouping:interface": "Microsoft.CostManagement.ReportConfigGrouping", + "@azure/arm-costmanagement!ReportConfigSorting:interface": "Microsoft.CostManagement.ReportConfigSorting", + "@azure/arm-costmanagement!ReportConfigFilter:interface": "Microsoft.CostManagement.ReportConfigFilter", + "@azure/arm-costmanagement!ReportConfigComparisonExpression:interface": "Microsoft.CostManagement.ReportConfigComparisonExpression", + "@azure/arm-costmanagement!KpiProperties:interface": "Microsoft.CostManagement.KpiProperties", + "@azure/arm-costmanagement!PivotProperties:interface": "Microsoft.CostManagement.PivotProperties", + "@azure/arm-costmanagement!ProxyResource:interface": "Azure.ResourceManager.CommonTypes.ProxyResource", + "@azure/arm-costmanagement!ViewListResult:interface": "Microsoft.CostManagement.ViewListResult", + "@azure/arm-costmanagement!Alert:interface": "Microsoft.CostManagement.Alert", + "@azure/arm-costmanagement!AlertProperties:interface": "Microsoft.CostManagement.AlertProperties", + "@azure/arm-costmanagement!AlertPropertiesDefinition:interface": "Microsoft.CostManagement.AlertPropertiesDefinition", + "@azure/arm-costmanagement!AlertPropertiesDetails:interface": "Microsoft.CostManagement.AlertPropertiesDetails", + "@azure/arm-costmanagement!DismissAlertPayload:interface": "Microsoft.CostManagement.DismissAlertPayload", + "@azure/arm-costmanagement!AlertsResult:interface": "Microsoft.CostManagement.AlertsResult", + "@azure/arm-costmanagement!ScheduledAction:interface": "Microsoft.CostManagement.ScheduledAction", + "@azure/arm-costmanagement!ScheduledActionProperties:interface": "Microsoft.CostManagement.ScheduledActionProperties", + "@azure/arm-costmanagement!FileDestination:interface": "Microsoft.CostManagement.FileDestination", + "@azure/arm-costmanagement!NotificationProperties:interface": "Microsoft.CostManagement.NotificationProperties", + "@azure/arm-costmanagement!ScheduleProperties:interface": "Microsoft.CostManagement.ScheduleProperties", + "@azure/arm-costmanagement!ErrorResponseWithNestedDetails:interface": "Microsoft.CostManagement.ErrorResponseWithNestedDetails", + "@azure/arm-costmanagement!ErrorDetailsWithNestedDetails:interface": "Microsoft.CostManagement.ErrorDetailsWithNestedDetails", + "@azure/arm-costmanagement!ScheduledActionListResult:interface": "Microsoft.CostManagement.ScheduledActionListResult", + "@azure/arm-costmanagement!CheckNameAvailabilityRequest:interface": "Azure.ResourceManager.CommonTypes.CheckNameAvailabilityRequest", + "@azure/arm-costmanagement!CheckNameAvailabilityResponse:interface": "Azure.ResourceManager.CommonTypes.CheckNameAvailabilityResponse", + "@azure/arm-costmanagement!Setting:interface": "Microsoft.CostManagement.Setting", + "@azure/arm-costmanagement!TagInheritanceSetting:interface": "Microsoft.CostManagement.TagInheritanceSetting", + "@azure/arm-costmanagement!TagInheritanceProperties:interface": "Microsoft.CostManagement.TagInheritanceProperties", + "@azure/arm-costmanagement!SettingsListResult:interface": "Microsoft.CostManagement.SettingsListResult", + "@azure/arm-costmanagement!CostDetailsOperationResults:interface": "Microsoft.CostManagement.CostDetailsOperationResults", + "@azure/arm-costmanagement!ReportManifest:interface": "Microsoft.CostManagement.ReportManifest", + "@azure/arm-costmanagement!RequestContext:interface": "Microsoft.CostManagement.RequestContext", + "@azure/arm-costmanagement!GenerateCostDetailsReportRequestDefinition:interface": "Microsoft.CostManagement.GenerateCostDetailsReportRequestDefinition", + "@azure/arm-costmanagement!CostDetailsTimePeriod:interface": "Microsoft.CostManagement.CostDetailsTimePeriod", + "@azure/arm-costmanagement!BlobInfo:interface": "Microsoft.CostManagement.BlobInfo", + "@azure/arm-costmanagement!GenerateCostDetailsReportErrorResponse:interface": "Microsoft.CostManagement.GenerateCostDetailsReportErrorResponse", + "@azure/arm-costmanagement!ArmOperationStatusResourceProvisioningState:interface": "Azure.ResourceManager.ArmOperationStatus", + "@azure/arm-costmanagement!ErrorDetail:interface": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "@azure/arm-costmanagement!ErrorAdditionalInfo:interface": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "@azure/arm-costmanagement!CostAllocationRuleDefinition:interface": "Microsoft.CostManagement.CostAllocationRuleDefinition", + "@azure/arm-costmanagement!CostAllocationRuleProperties:interface": "Microsoft.CostManagement.CostAllocationRuleProperties", + "@azure/arm-costmanagement!CostAllocationRuleDetails:interface": "Microsoft.CostManagement.CostAllocationRuleDetails", + "@azure/arm-costmanagement!SourceCostAllocationResource:interface": "Microsoft.CostManagement.SourceCostAllocationResource", + "@azure/arm-costmanagement!CostAllocationResource:interface": "Microsoft.CostManagement.CostAllocationResource", + "@azure/arm-costmanagement!TargetCostAllocationResource:interface": "Microsoft.CostManagement.TargetCostAllocationResource", + "@azure/arm-costmanagement!CostAllocationProportion:interface": "Microsoft.CostManagement.CostAllocationProportion", + "@azure/arm-costmanagement!CostAllocationRuleList:interface": "Microsoft.CostManagement.CostAllocationRuleList", + "@azure/arm-costmanagement!CostAllocationRuleCheckNameAvailabilityRequest:interface": "Microsoft.CostManagement.CostAllocationRuleCheckNameAvailabilityRequest", + "@azure/arm-costmanagement!CostAllocationRuleCheckNameAvailabilityResponse:interface": "Microsoft.CostManagement.CostAllocationRuleCheckNameAvailabilityResponse", + "@azure/arm-costmanagement!benefitRecommendationsListResult:interface": "Microsoft.CostManagement.benefitRecommendationsListResult", + "@azure/arm-costmanagement!benefitRecommendationModel:interface": "Microsoft.CostManagement.BenefitRecommendationModel", + "@azure/arm-costmanagement!benefitRecommendationProperties:interface": "Microsoft.CostManagement.BenefitRecommendationProperties", + "@azure/arm-costmanagement!recommendationUsageDetails:interface": "Microsoft.CostManagement.RecommendationUsageDetails", + "@azure/arm-costmanagement!allSavingsBenefitDetails:interface": "Microsoft.CostManagement.AllSavingsBenefitDetails", + "@azure/arm-costmanagement!allSavingsList:interface": "Microsoft.CostManagement.AllSavingsList", + "@azure/arm-costmanagement!singleScopeBenefitRecommendationProperties:interface": "Microsoft.CostManagement.SingleScopeBenefitRecommendationProperties", + "@azure/arm-costmanagement!sharedScopeBenefitRecommendationProperties:interface": "Microsoft.CostManagement.SharedScopeBenefitRecommendationProperties", + "@azure/arm-costmanagement!BenefitResource:interface": "Microsoft.CostManagement.BenefitResource", + "@azure/arm-costmanagement!BenefitUtilizationSummariesListResult:interface": "Microsoft.CostManagement.BenefitUtilizationSummariesListResult", + "@azure/arm-costmanagement!BenefitUtilizationSummary:interface": "Microsoft.CostManagement.BenefitUtilizationSummary", + "@azure/arm-costmanagement!IncludedQuantityUtilizationSummary:interface": "Microsoft.CostManagement.IncludedQuantityUtilizationSummary", + "@azure/arm-costmanagement!IncludedQuantityUtilizationSummaryProperties:interface": "Microsoft.CostManagement.IncludedQuantityUtilizationSummaryProperties", + "@azure/arm-costmanagement!BenefitUtilizationSummaryProperties:interface": "Microsoft.CostManagement.BenefitUtilizationSummaryProperties", + "@azure/arm-costmanagement!SavingsPlanUtilizationSummary:interface": "Microsoft.CostManagement.SavingsPlanUtilizationSummary", + "@azure/arm-costmanagement!SavingsPlanUtilizationSummaryProperties:interface": "Microsoft.CostManagement.SavingsPlanUtilizationSummaryProperties", + "@azure/arm-costmanagement!BenefitUtilizationSummariesRequest:interface": "Microsoft.CostManagement.BenefitUtilizationSummariesRequest", + "@azure/arm-costmanagement!BenefitUtilizationSummariesOperationStatus:interface": "Microsoft.CostManagement.BenefitUtilizationSummariesOperationStatus", + "@azure/arm-costmanagement!AsyncOperationStatusProperties:interface": "Microsoft.CostManagement.AsyncOperationStatusProperties", + "@azure/arm-costmanagement!ArmErrorResponse:interface": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "@azure/arm-costmanagement!GenerateDetailedCostReportDefinition:interface": "Microsoft.CostManagement.GenerateDetailedCostReportDefinition", + "@azure/arm-costmanagement!GenerateDetailedCostReportTimePeriod:interface": "Microsoft.CostManagement.GenerateDetailedCostReportTimePeriod", + "@azure/arm-costmanagement!GenerateDetailedCostReportErrorResponse:interface": "Microsoft.CostManagement.GenerateDetailedCostReportErrorResponse", + "@azure/arm-costmanagement!ForecastDefinition:interface": "Microsoft.CostManagement.ForecastDefinition", + "@azure/arm-costmanagement!ForecastTimePeriod:interface": "Microsoft.CostManagement.ForecastTimePeriod", + "@azure/arm-costmanagement!ForecastDataset:interface": "Microsoft.CostManagement.ForecastDataset", + "@azure/arm-costmanagement!ForecastDatasetConfiguration:interface": "Microsoft.CostManagement.ForecastDatasetConfiguration", + "@azure/arm-costmanagement!ForecastAggregation:interface": "Microsoft.CostManagement.ForecastAggregation", + "@azure/arm-costmanagement!ForecastFilter:interface": "Microsoft.CostManagement.ForecastFilter", + "@azure/arm-costmanagement!ForecastComparisonExpression:interface": "Microsoft.CostManagement.ForecastComparisonExpression", + "@azure/arm-costmanagement!ForecastResult:interface": "Microsoft.CostManagement.ForecastResult", + "@azure/arm-costmanagement!ForecastProperties:interface": "Microsoft.CostManagement.ForecastProperties", + "@azure/arm-costmanagement!ForecastColumn:interface": "Microsoft.CostManagement.ForecastColumn", + "@azure/arm-costmanagement!CostManagementResource:interface": "Microsoft.CostManagement.CostManagementResource", + "@azure/arm-costmanagement!DimensionsListResult:interface": "Microsoft.CostManagement.DimensionsListResult", + "@azure/arm-costmanagement!Dimension:interface": "Microsoft.CostManagement.Dimension", + "@azure/arm-costmanagement!DimensionProperties:interface": "Microsoft.CostManagement.DimensionProperties", + "@azure/arm-costmanagement!QueryDefinition:interface": "Microsoft.CostManagement.QueryDefinition", + "@azure/arm-costmanagement!QueryTimePeriod:interface": "Microsoft.CostManagement.QueryTimePeriod", + "@azure/arm-costmanagement!QueryDataset:interface": "Microsoft.CostManagement.QueryDataset", + "@azure/arm-costmanagement!QueryDatasetConfiguration:interface": "Microsoft.CostManagement.QueryDatasetConfiguration", + "@azure/arm-costmanagement!QueryAggregation:interface": "Microsoft.CostManagement.QueryAggregation", + "@azure/arm-costmanagement!QueryGrouping:interface": "Microsoft.CostManagement.QueryGrouping", + "@azure/arm-costmanagement!QueryFilter:interface": "Microsoft.CostManagement.QueryFilter", + "@azure/arm-costmanagement!QueryComparisonExpression:interface": "Microsoft.CostManagement.QueryComparisonExpression", + "@azure/arm-costmanagement!QueryResult:interface": "Microsoft.CostManagement.QueryResult", + "@azure/arm-costmanagement!QueryProperties:interface": "Microsoft.CostManagement.QueryProperties", + "@azure/arm-costmanagement!QueryColumn:interface": "Microsoft.CostManagement.QueryColumn", + "@azure/arm-costmanagement!OperationStatus:interface": "Microsoft.CostManagement.OperationStatus", + "@azure/arm-costmanagement!ReportURL:interface": "Microsoft.CostManagement.ReportURL", + "@azure/arm-costmanagement!PricesheetDownloadProperties:interface": "Microsoft.CostManagement.PricesheetDownloadProperties", + "@azure/arm-costmanagement!MCAPriceSheetProperties:interface": "Microsoft.CostManagement.MCAPriceSheetProperties", + "@azure/arm-costmanagement!KnownReportOperationStatusType:enum": "Microsoft.CostManagement.ReportOperationStatusType", + "@azure/arm-costmanagement!KnowncreatedByType:enum": "Azure.ResourceManager.CommonTypes.createdByType", + "@azure/arm-costmanagement!KnownOrigin:enum": "Azure.ResourceManager.CommonTypes.Origin", + "@azure/arm-costmanagement!KnownActionType:enum": "Azure.ResourceManager.CommonTypes.ActionType", + "@azure/arm-costmanagement!KnownCategoryType:enum": "Microsoft.CostManagement.CategoryType", + "@azure/arm-costmanagement!KnownTimeGrainType:enum": "Microsoft.CostManagement.TimeGrainType", + "@azure/arm-costmanagement!KnownBudgetOperatorType:enum": "Microsoft.CostManagement.BudgetOperatorType", + "@azure/arm-costmanagement!KnownBudgetNotificationOperatorType:enum": "Microsoft.CostManagement.BudgetNotificationOperatorType", + "@azure/arm-costmanagement!KnownFrequency:enum": "Microsoft.CostManagement.Frequency", + "@azure/arm-costmanagement!KnownThresholdType:enum": "Microsoft.CostManagement.ThresholdType", + "@azure/arm-costmanagement!KnownCultureCode:enum": "Microsoft.CostManagement.CultureCode", + "@azure/arm-costmanagement!KnownStatusType:enum": "Microsoft.CostManagement.StatusType", + "@azure/arm-costmanagement!KnownRecurrenceType:enum": "Microsoft.CostManagement.RecurrenceType", + "@azure/arm-costmanagement!KnownFormatType:enum": "Microsoft.CostManagement.FormatType", + "@azure/arm-costmanagement!KnownDestinationType:enum": "Microsoft.CostManagement.DestinationType", + "@azure/arm-costmanagement!KnownExportType:enum": "Microsoft.CostManagement.ExportType", + "@azure/arm-costmanagement!KnownTimeframeType:enum": "Microsoft.CostManagement.TimeframeType", + "@azure/arm-costmanagement!KnownGranularityType:enum": "Microsoft.CostManagement.GranularityType", + "@azure/arm-costmanagement!KnownFilterItemNames:enum": "Microsoft.CostManagement.FilterItemNames", + "@azure/arm-costmanagement!KnownExecutionType:enum": "Microsoft.CostManagement.ExecutionType", + "@azure/arm-costmanagement!KnownExecutionStatus:enum": "Microsoft.CostManagement.ExecutionStatus", + "@azure/arm-costmanagement!KnownDataOverwriteBehaviorType:enum": "Microsoft.CostManagement.DataOverwriteBehaviorType", + "@azure/arm-costmanagement!KnownCompressionModeType:enum": "Microsoft.CostManagement.CompressionModeType", + "@azure/arm-costmanagement!KnownSystemAssignedServiceIdentityType:enum": "Azure.ResourceManager.CommonTypes.SystemAssignedServiceIdentityType", + "@azure/arm-costmanagement!KnownReportType:enum": "Microsoft.CostManagement.ReportType", + "@azure/arm-costmanagement!KnownReportTimeframeType:enum": "Microsoft.CostManagement.ReportTimeframeType", + "@azure/arm-costmanagement!KnownReportGranularityType:enum": "Microsoft.CostManagement.ReportGranularityType", + "@azure/arm-costmanagement!KnownFunctionType:enum": "Microsoft.CostManagement.FunctionType", + "@azure/arm-costmanagement!KnownQueryColumnType:enum": "Microsoft.CostManagement.QueryColumnType", + "@azure/arm-costmanagement!KnownReportConfigSortingType:enum": "Microsoft.CostManagement.ReportConfigSortingType", + "@azure/arm-costmanagement!KnownOperatorType:enum": "Microsoft.CostManagement.OperatorType", + "@azure/arm-costmanagement!KnownChartType:enum": "Microsoft.CostManagement.ChartType", + "@azure/arm-costmanagement!KnownAccumulatedType:enum": "Microsoft.CostManagement.AccumulatedType", + "@azure/arm-costmanagement!KnownMetricType:enum": "Microsoft.CostManagement.MetricType", + "@azure/arm-costmanagement!KnownKpiType:enum": "Microsoft.CostManagement.KpiTypeType", + "@azure/arm-costmanagement!KnownPivotType:enum": "Microsoft.CostManagement.PivotTypeType", + "@azure/arm-costmanagement!KnownAlertType:enum": "Microsoft.CostManagement.AlertType", + "@azure/arm-costmanagement!KnownAlertCategory:enum": "Microsoft.CostManagement.AlertCategory", + "@azure/arm-costmanagement!KnownAlertCriteria:enum": "Microsoft.CostManagement.AlertCriteria", + "@azure/arm-costmanagement!KnownAlertSource:enum": "Microsoft.CostManagement.AlertSource", + "@azure/arm-costmanagement!KnownAlertTimeGrainType:enum": "Microsoft.CostManagement.AlertTimeGrainType", + "@azure/arm-costmanagement!KnownAlertOperator:enum": "Microsoft.CostManagement.AlertOperator", + "@azure/arm-costmanagement!KnownAlertStatus:enum": "Microsoft.CostManagement.AlertStatus", + "@azure/arm-costmanagement!KnownExternalCloudProviderType:enum": "Microsoft.CostManagement.ExternalCloudProviderType", + "@azure/arm-costmanagement!KnownFileFormat:enum": "Microsoft.CostManagement.FileFormat", + "@azure/arm-costmanagement!KnownScheduleFrequency:enum": "Microsoft.CostManagement.ScheduleFrequency", + "@azure/arm-costmanagement!KnownDaysOfWeek:enum": "Microsoft.CostManagement.DaysOfWeek", + "@azure/arm-costmanagement!KnownWeeksOfMonth:enum": "Microsoft.CostManagement.WeeksOfMonth", + "@azure/arm-costmanagement!KnownScheduledActionStatus:enum": "Microsoft.CostManagement.ScheduledActionStatus", + "@azure/arm-costmanagement!KnownScheduledActionKind:enum": "Microsoft.CostManagement.ScheduledActionKind", + "@azure/arm-costmanagement!KnownCheckNameAvailabilityReason:enum": "Azure.ResourceManager.CommonTypes.CheckNameAvailabilityReason", + "@azure/arm-costmanagement!KnownSettingType:enum": "Microsoft.CostManagement.SettingType", + "@azure/arm-costmanagement!KnownSettingsKind:enum": "Microsoft.CostManagement.SettingsKind", + "@azure/arm-costmanagement!KnownCostDetailsStatusType:enum": "Microsoft.CostManagement.CostDetailsStatusType", + "@azure/arm-costmanagement!KnownCostDetailsDataFormat:enum": "Microsoft.CostManagement.CostDetailsDataFormat", + "@azure/arm-costmanagement!KnownCostDetailsMetricType:enum": "Microsoft.CostManagement.CostDetailsMetricType", + "@azure/arm-costmanagement!KnownResourceProvisioningState:enum": "Azure.ResourceManager.ResourceProvisioningState", + "@azure/arm-costmanagement!KnownCostAllocationResourceType:enum": "Microsoft.CostManagement.CostAllocationResourceType", + "@azure/arm-costmanagement!KnownCostAllocationPolicyType:enum": "Microsoft.CostManagement.CostAllocationPolicyType", + "@azure/arm-costmanagement!KnownRuleStatus:enum": "Microsoft.CostManagement.RuleStatus", + "@azure/arm-costmanagement!KnownReason:enum": "Microsoft.CostManagement.Reason", + "@azure/arm-costmanagement!KnownLookBackPeriod:enum": "Microsoft.CostManagement.LookBackPeriod", + "@azure/arm-costmanagement!KnownGrain:enum": "Microsoft.CostManagement.Grain", + "@azure/arm-costmanagement!KnownTerm:enum": "Microsoft.CostManagement.Term", + "@azure/arm-costmanagement!KnownScope:enum": "Microsoft.CostManagement.Scope", + "@azure/arm-costmanagement!KnownBenefitKind:enum": "Microsoft.CostManagement.BenefitKind", + "@azure/arm-costmanagement!KnownGrainParameter:enum": "Microsoft.CostManagement.GrainParameter", + "@azure/arm-costmanagement!KnownOperationStatusType:enum": "Microsoft.CostManagement.OperationStatusType", + "@azure/arm-costmanagement!KnownBenefitUtilizationSummaryReportSchema:enum": "Microsoft.CostManagement.BenefitUtilizationSummaryReportSchema", + "@azure/arm-costmanagement!KnownGenerateDetailedCostReportMetricType:enum": "Microsoft.CostManagement.GenerateDetailedCostReportMetricType", + "@azure/arm-costmanagement!KnownForecastType:enum": "Microsoft.CostManagement.ForecastType", + "@azure/arm-costmanagement!KnownForecastTimeframe:enum": "Microsoft.CostManagement.ForecastTimeframe", + "@azure/arm-costmanagement!KnownFunctionName:enum": "Microsoft.CostManagement.FunctionName", + "@azure/arm-costmanagement!KnownForecastOperatorType:enum": "Microsoft.CostManagement.ForecastOperatorType", + "@azure/arm-costmanagement!KnownQueryOperatorType:enum": "Microsoft.CostManagement.QueryOperatorType", + "@azure/arm-costmanagement!KnownReservationReportSchema:enum": "Microsoft.CostManagement.ReservationReportSchema", + "@azure/arm-costmanagement!KnownVersions:enum": "Microsoft.CostManagement.Versions", + "@azure/arm-costmanagement!PriceSheetOperations#downloadByBillingAccount:member": "Microsoft.CostManagement.PriceSheetOperationGroup.downloadByBillingAccount", + "@azure/arm-costmanagement!PriceSheetOperations#downloadByBillingProfile:member": "Microsoft.CostManagement.PriceSheetOperationGroup.downloadByBillingProfile", + "@azure/arm-costmanagement!PriceSheetOperations#downloadByInvoice:member": "Microsoft.CostManagement.PriceSheetOperationGroup.downloadByInvoice", + "@azure/arm-costmanagement!GenerateReservationDetailsReportOperations#byBillingProfileId:member": "Microsoft.CostManagement.GenerateReservationDetailsReportOperationGroup.byBillingProfileId", + "@azure/arm-costmanagement!GenerateReservationDetailsReportOperations#byBillingAccountId:member": "Microsoft.CostManagement.GenerateReservationDetailsReportOperationGroup.byBillingAccountId", + "@azure/arm-costmanagement!QueryOperations#usageByExternalCloudProviderType:member": "Microsoft.CostManagement.QueryOperationGroup.usageByExternalCloudProviderType", + "@azure/arm-costmanagement!QueryOperations#usage:member": "Microsoft.CostManagement.QueryOperationGroup.usage", + "@azure/arm-costmanagement!DimensionsOperations#listByExternalCloudProviderType:member": "Microsoft.CostManagement.DimensionsOperationGroup.byExternalCloudProviderType", + "@azure/arm-costmanagement!DimensionsOperations#list:member": "Microsoft.CostManagement.DimensionsOperationGroup.list", + "@azure/arm-costmanagement!ForecastOperations#externalCloudProviderUsage:member": "Microsoft.CostManagement.ForecastOperationGroup.externalCloudProviderUsage", + "@azure/arm-costmanagement!ForecastOperations#usage:member": "Microsoft.CostManagement.ForecastOperationGroup.usage", + "@azure/arm-costmanagement!GenerateDetailedCostReportOperations#createOperation:member": "Microsoft.CostManagement.GenerateDetailedCostReportOperationGroup.createOperation", + "@azure/arm-costmanagement!GenerateBenefitUtilizationSummariesReportOperations#generateBySavingsPlanId:member": "Microsoft.CostManagement.GenerateBenefitUtilizationSummariesReportOperationGroup.generateBySavingsPlanId", + "@azure/arm-costmanagement!GenerateBenefitUtilizationSummariesReportOperations#generateBySavingsPlanOrderId:member": "Microsoft.CostManagement.GenerateBenefitUtilizationSummariesReportOperationGroup.generateBySavingsPlanOrderId", + "@azure/arm-costmanagement!GenerateBenefitUtilizationSummariesReportOperations#generateByReservationId:member": "Microsoft.CostManagement.GenerateBenefitUtilizationSummariesReportOperationGroup.generateByReservationId", + "@azure/arm-costmanagement!GenerateBenefitUtilizationSummariesReportOperations#generateByReservationOrderId:member": "Microsoft.CostManagement.GenerateBenefitUtilizationSummariesReportOperationGroup.generateByReservationOrderId", + "@azure/arm-costmanagement!GenerateBenefitUtilizationSummariesReportOperations#generateByBillingProfile:member": "Microsoft.CostManagement.GenerateBenefitUtilizationSummariesReportOperationGroup.generateByBillingProfile", + "@azure/arm-costmanagement!GenerateBenefitUtilizationSummariesReportOperations#generateByBillingAccount:member": "Microsoft.CostManagement.GenerateBenefitUtilizationSummariesReportOperationGroup.generateByBillingAccount", + "@azure/arm-costmanagement!BenefitUtilizationSummariesOperations#listBySavingsPlanId:member": "Microsoft.CostManagement.BenefitUtilizationSummariesOperationGroup.listBySavingsPlanId", + "@azure/arm-costmanagement!BenefitUtilizationSummariesOperations#listBySavingsPlanOrder:member": "Microsoft.CostManagement.BenefitUtilizationSummariesOperationGroup.listBySavingsPlanOrder", + "@azure/arm-costmanagement!BenefitUtilizationSummariesOperations#listByBillingProfileId:member": "Microsoft.CostManagement.BenefitUtilizationSummariesOperationGroup.listByBillingProfileId", + "@azure/arm-costmanagement!BenefitUtilizationSummariesOperations#listByBillingAccountId:member": "Microsoft.CostManagement.BenefitUtilizationSummariesOperationGroup.listByBillingAccountId", + "@azure/arm-costmanagement!BenefitRecommendationsOperations#list:member": "Microsoft.CostManagement.BenefitRecommendationsOperationGroup.list", + "@azure/arm-costmanagement!CostAllocationRulesOperations#checkNameAvailability:member": "Microsoft.CostManagement.CostAllocationRulesOperationGroup.checkNameAvailability", + "@azure/arm-costmanagement!CostAllocationRulesOperations#list:member": "Microsoft.CostManagement.CostAllocationRuleDefinitions.list", + "@azure/arm-costmanagement!CostAllocationRulesOperations#delete:member": "Microsoft.CostManagement.CostAllocationRuleDefinitions.delete", + "@azure/arm-costmanagement!CostAllocationRulesOperations#createOrUpdate:member": "Microsoft.CostManagement.CostAllocationRuleDefinitions.createOrUpdate", + "@azure/arm-costmanagement!CostAllocationRulesOperations#get:member": "Microsoft.CostManagement.CostAllocationRuleDefinitions.get", + "@azure/arm-costmanagement!GenerateCostDetailsReportOperations#createOperation:member": "Microsoft.CostManagement.GenerateCostDetailsReportOperationGroup.createOperation", + "@azure/arm-costmanagement!GenerateCostDetailsReportOperations#getOperationResults:member": "Microsoft.CostManagement.GenerateCostDetailsReport.getOperationResults", + "@azure/arm-costmanagement!SettingsOperations#list:member": "Microsoft.CostManagement.Settings.list", + "@azure/arm-costmanagement!SettingsOperations#deleteByScope:member": "Microsoft.CostManagement.Settings.deleteByScope", + "@azure/arm-costmanagement!SettingsOperations#createOrUpdateByScope:member": "Microsoft.CostManagement.Settings.createOrUpdateByScope", + "@azure/arm-costmanagement!SettingsOperations#getByScope:member": "Microsoft.CostManagement.Settings.getByScope", + "@azure/arm-costmanagement!ScheduledActionsOperations#checkNameAvailabilityByScope:member": "Microsoft.CostManagement.ScheduledActionsOperationGroup.checkNameAvailabilityByScope", + "@azure/arm-costmanagement!ScheduledActionsOperations#checkNameAvailability:member": "Microsoft.CostManagement.ScheduledActionsOperationGroup.checkNameAvailability", + "@azure/arm-costmanagement!ScheduledActionsOperations#runByScope:member": "Microsoft.CostManagement.ScheduledActionOperationGroup.runByScope", + "@azure/arm-costmanagement!ScheduledActionsOperations#listByScope:member": "Microsoft.CostManagement.ScheduledActionOperationGroup.listByScope", + "@azure/arm-costmanagement!ScheduledActionsOperations#deleteByScope:member": "Microsoft.CostManagement.ScheduledActionOperationGroup.deleteByScope", + "@azure/arm-costmanagement!ScheduledActionsOperations#createOrUpdateByScope:member": "Microsoft.CostManagement.ScheduledActionOperationGroup.createOrUpdateByScope", + "@azure/arm-costmanagement!ScheduledActionsOperations#getByScope:member": "Microsoft.CostManagement.ScheduledActionOperationGroup.getByScope", + "@azure/arm-costmanagement!ScheduledActionsOperations#run:member": "Microsoft.CostManagement.ScheduledActions.run", + "@azure/arm-costmanagement!ScheduledActionsOperations#list:member": "Microsoft.CostManagement.ScheduledActions.list", + "@azure/arm-costmanagement!ScheduledActionsOperations#delete:member": "Microsoft.CostManagement.ScheduledActions.delete", + "@azure/arm-costmanagement!ScheduledActionsOperations#createOrUpdate:member": "Microsoft.CostManagement.ScheduledActions.createOrUpdate", + "@azure/arm-costmanagement!ScheduledActionsOperations#get:member": "Microsoft.CostManagement.ScheduledActions.get", + "@azure/arm-costmanagement!AlertsOperations#listExternal:member": "Microsoft.CostManagement.AlertsOperationGroup.listExternal", + "@azure/arm-costmanagement!AlertsOperations#list:member": "Microsoft.CostManagement.Alerts.list", + "@azure/arm-costmanagement!AlertsOperations#dismiss:member": "Microsoft.CostManagement.Alerts.dismiss", + "@azure/arm-costmanagement!AlertsOperations#get:member": "Microsoft.CostManagement.Alerts.get", + "@azure/arm-costmanagement!ViewsOperations#listByScope:member": "Microsoft.CostManagement.ViewOperationGroup.listByScope", + "@azure/arm-costmanagement!ViewsOperations#deleteByScope:member": "Microsoft.CostManagement.ViewOperationGroup.deleteByScope", + "@azure/arm-costmanagement!ViewsOperations#createOrUpdateByScope:member": "Microsoft.CostManagement.ViewOperationGroup.createOrUpdateByScope", + "@azure/arm-costmanagement!ViewsOperations#getByScope:member": "Microsoft.CostManagement.ViewOperationGroup.getByScope", + "@azure/arm-costmanagement!ViewsOperations#list:member": "Microsoft.CostManagement.Views.list", + "@azure/arm-costmanagement!ViewsOperations#delete:member": "Microsoft.CostManagement.Views.delete", + "@azure/arm-costmanagement!ViewsOperations#createOrUpdate:member": "Microsoft.CostManagement.Views.createOrUpdate", + "@azure/arm-costmanagement!ViewsOperations#get:member": "Microsoft.CostManagement.Views.get", + "@azure/arm-costmanagement!GenerateDetailedCostReportOperationResultsOperations#get:member": "Microsoft.CostManagement.GenerateDetailedCostReportOperationResults.get", + "@azure/arm-costmanagement!ExportsOperations#getExecutionHistory:member": "Microsoft.CostManagement.Exports.getExecutionHistory", + "@azure/arm-costmanagement!ExportsOperations#execute:member": "Microsoft.CostManagement.Exports.execute", + "@azure/arm-costmanagement!ExportsOperations#list:member": "Microsoft.CostManagement.Exports.list", + "@azure/arm-costmanagement!ExportsOperations#delete:member": "Microsoft.CostManagement.Exports.delete", + "@azure/arm-costmanagement!ExportsOperations#createOrUpdate:member": "Microsoft.CostManagement.Exports.createOrUpdate", + "@azure/arm-costmanagement!ExportsOperations#get:member": "Microsoft.CostManagement.Exports.get", + "@azure/arm-costmanagement!BudgetsOperations#list:member": "Microsoft.CostManagement.Budgets.list", + "@azure/arm-costmanagement!BudgetsOperations#delete:member": "Microsoft.CostManagement.Budgets.delete", + "@azure/arm-costmanagement!BudgetsOperations#createOrUpdate:member": "Microsoft.CostManagement.Budgets.createOrUpdate", + "@azure/arm-costmanagement!BudgetsOperations#get:member": "Microsoft.CostManagement.Budgets.get", + "@azure/arm-costmanagement!OperationsOperations#list:member": "Azure.ResourceManager.Legacy.Operations.list", + "@azure/arm-costmanagement!GenerateDetailedCostReportOperationStatusOperations#get:member": "Microsoft.CostManagement.GenerateDetailedCostReportOperationStatus.get" + } + } +} diff --git a/sdk/cost-management/arm-costmanagement/package.json b/sdk/cost-management/arm-costmanagement/package.json index 43770ad3678e..ea3cd467a258 100644 --- a/sdk/cost-management/arm-costmanagement/package.json +++ b/sdk/cost-management/arm-costmanagement/package.json @@ -1,122 +1,435 @@ { "name": "@azure/arm-costmanagement", - "sdk-type": "mgmt", - "author": "Microsoft Corporation", - "description": "A generated SDK for CostManagementClient.", "version": "1.0.0-beta.3", + "description": "A generated SDK for CostManagementClient.", "engines": { "node": ">=20.0.0" }, - "dependencies": { - "@azure/abort-controller": "^2.1.2", - "@azure/core-auth": "^1.9.0", - "@azure/core-client": "^1.9.2", - "@azure/core-lro": "^2.5.0", - "@azure/core-paging": "^1.6.2", - "@azure/core-rest-pipeline": "^1.18.2", - "tslib": "^2.8.1" + "sideEffects": false, + "autoPublish": false, + "type": "module", + "main": "./dist/commonjs/index.js", + "module": "./dist/esm/index.js", + "types": "./dist/commonjs/index.d.ts", + "browser": "./dist/browser/index.js", + "imports": { + "#platform/*": { + "browser": "./src/*-browser.mts", + "default": "./src/*.ts" + } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "browser": { + "types": "./dist/browser/index.d.ts", + "default": "./dist/browser/index.js" + }, + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + }, + "./api": { + "browser": { + "types": "./dist/browser/api/index.d.ts", + "default": "./dist/browser/api/index.js" + }, + "import": { + "types": "./dist/esm/api/index.d.ts", + "default": "./dist/esm/api/index.js" + }, + "require": { + "types": "./dist/commonjs/api/index.d.ts", + "default": "./dist/commonjs/api/index.js" + } + }, + "./api/priceSheet": { + "browser": { + "types": "./dist/browser/api/priceSheet/index.d.ts", + "default": "./dist/browser/api/priceSheet/index.js" + }, + "import": { + "types": "./dist/esm/api/priceSheet/index.d.ts", + "default": "./dist/esm/api/priceSheet/index.js" + }, + "require": { + "types": "./dist/commonjs/api/priceSheet/index.d.ts", + "default": "./dist/commonjs/api/priceSheet/index.js" + } + }, + "./api/generateReservationDetailsReport": { + "browser": { + "types": "./dist/browser/api/generateReservationDetailsReport/index.d.ts", + "default": "./dist/browser/api/generateReservationDetailsReport/index.js" + }, + "import": { + "types": "./dist/esm/api/generateReservationDetailsReport/index.d.ts", + "default": "./dist/esm/api/generateReservationDetailsReport/index.js" + }, + "require": { + "types": "./dist/commonjs/api/generateReservationDetailsReport/index.d.ts", + "default": "./dist/commonjs/api/generateReservationDetailsReport/index.js" + } + }, + "./api/query": { + "browser": { + "types": "./dist/browser/api/query/index.d.ts", + "default": "./dist/browser/api/query/index.js" + }, + "import": { + "types": "./dist/esm/api/query/index.d.ts", + "default": "./dist/esm/api/query/index.js" + }, + "require": { + "types": "./dist/commonjs/api/query/index.d.ts", + "default": "./dist/commonjs/api/query/index.js" + } + }, + "./api/dimensions": { + "browser": { + "types": "./dist/browser/api/dimensions/index.d.ts", + "default": "./dist/browser/api/dimensions/index.js" + }, + "import": { + "types": "./dist/esm/api/dimensions/index.d.ts", + "default": "./dist/esm/api/dimensions/index.js" + }, + "require": { + "types": "./dist/commonjs/api/dimensions/index.d.ts", + "default": "./dist/commonjs/api/dimensions/index.js" + } + }, + "./api/forecast": { + "browser": { + "types": "./dist/browser/api/forecast/index.d.ts", + "default": "./dist/browser/api/forecast/index.js" + }, + "import": { + "types": "./dist/esm/api/forecast/index.d.ts", + "default": "./dist/esm/api/forecast/index.js" + }, + "require": { + "types": "./dist/commonjs/api/forecast/index.d.ts", + "default": "./dist/commonjs/api/forecast/index.js" + } + }, + "./api/generateDetailedCostReport": { + "browser": { + "types": "./dist/browser/api/generateDetailedCostReport/index.d.ts", + "default": "./dist/browser/api/generateDetailedCostReport/index.js" + }, + "import": { + "types": "./dist/esm/api/generateDetailedCostReport/index.d.ts", + "default": "./dist/esm/api/generateDetailedCostReport/index.js" + }, + "require": { + "types": "./dist/commonjs/api/generateDetailedCostReport/index.d.ts", + "default": "./dist/commonjs/api/generateDetailedCostReport/index.js" + } + }, + "./api/generateBenefitUtilizationSummariesReport": { + "browser": { + "types": "./dist/browser/api/generateBenefitUtilizationSummariesReport/index.d.ts", + "default": "./dist/browser/api/generateBenefitUtilizationSummariesReport/index.js" + }, + "import": { + "types": "./dist/esm/api/generateBenefitUtilizationSummariesReport/index.d.ts", + "default": "./dist/esm/api/generateBenefitUtilizationSummariesReport/index.js" + }, + "require": { + "types": "./dist/commonjs/api/generateBenefitUtilizationSummariesReport/index.d.ts", + "default": "./dist/commonjs/api/generateBenefitUtilizationSummariesReport/index.js" + } + }, + "./api/benefitUtilizationSummaries": { + "browser": { + "types": "./dist/browser/api/benefitUtilizationSummaries/index.d.ts", + "default": "./dist/browser/api/benefitUtilizationSummaries/index.js" + }, + "import": { + "types": "./dist/esm/api/benefitUtilizationSummaries/index.d.ts", + "default": "./dist/esm/api/benefitUtilizationSummaries/index.js" + }, + "require": { + "types": "./dist/commonjs/api/benefitUtilizationSummaries/index.d.ts", + "default": "./dist/commonjs/api/benefitUtilizationSummaries/index.js" + } + }, + "./api/benefitRecommendations": { + "browser": { + "types": "./dist/browser/api/benefitRecommendations/index.d.ts", + "default": "./dist/browser/api/benefitRecommendations/index.js" + }, + "import": { + "types": "./dist/esm/api/benefitRecommendations/index.d.ts", + "default": "./dist/esm/api/benefitRecommendations/index.js" + }, + "require": { + "types": "./dist/commonjs/api/benefitRecommendations/index.d.ts", + "default": "./dist/commonjs/api/benefitRecommendations/index.js" + } + }, + "./api/costAllocationRules": { + "browser": { + "types": "./dist/browser/api/costAllocationRules/index.d.ts", + "default": "./dist/browser/api/costAllocationRules/index.js" + }, + "import": { + "types": "./dist/esm/api/costAllocationRules/index.d.ts", + "default": "./dist/esm/api/costAllocationRules/index.js" + }, + "require": { + "types": "./dist/commonjs/api/costAllocationRules/index.d.ts", + "default": "./dist/commonjs/api/costAllocationRules/index.js" + } + }, + "./api/generateCostDetailsReport": { + "browser": { + "types": "./dist/browser/api/generateCostDetailsReport/index.d.ts", + "default": "./dist/browser/api/generateCostDetailsReport/index.js" + }, + "import": { + "types": "./dist/esm/api/generateCostDetailsReport/index.d.ts", + "default": "./dist/esm/api/generateCostDetailsReport/index.js" + }, + "require": { + "types": "./dist/commonjs/api/generateCostDetailsReport/index.d.ts", + "default": "./dist/commonjs/api/generateCostDetailsReport/index.js" + } + }, + "./api/settings": { + "browser": { + "types": "./dist/browser/api/settings/index.d.ts", + "default": "./dist/browser/api/settings/index.js" + }, + "import": { + "types": "./dist/esm/api/settings/index.d.ts", + "default": "./dist/esm/api/settings/index.js" + }, + "require": { + "types": "./dist/commonjs/api/settings/index.d.ts", + "default": "./dist/commonjs/api/settings/index.js" + } + }, + "./api/scheduledActions": { + "browser": { + "types": "./dist/browser/api/scheduledActions/index.d.ts", + "default": "./dist/browser/api/scheduledActions/index.js" + }, + "import": { + "types": "./dist/esm/api/scheduledActions/index.d.ts", + "default": "./dist/esm/api/scheduledActions/index.js" + }, + "require": { + "types": "./dist/commonjs/api/scheduledActions/index.d.ts", + "default": "./dist/commonjs/api/scheduledActions/index.js" + } + }, + "./api/alerts": { + "browser": { + "types": "./dist/browser/api/alerts/index.d.ts", + "default": "./dist/browser/api/alerts/index.js" + }, + "import": { + "types": "./dist/esm/api/alerts/index.d.ts", + "default": "./dist/esm/api/alerts/index.js" + }, + "require": { + "types": "./dist/commonjs/api/alerts/index.d.ts", + "default": "./dist/commonjs/api/alerts/index.js" + } + }, + "./api/views": { + "browser": { + "types": "./dist/browser/api/views/index.d.ts", + "default": "./dist/browser/api/views/index.js" + }, + "import": { + "types": "./dist/esm/api/views/index.d.ts", + "default": "./dist/esm/api/views/index.js" + }, + "require": { + "types": "./dist/commonjs/api/views/index.d.ts", + "default": "./dist/commonjs/api/views/index.js" + } + }, + "./api/generateDetailedCostReportOperationResults": { + "browser": { + "types": "./dist/browser/api/generateDetailedCostReportOperationResults/index.d.ts", + "default": "./dist/browser/api/generateDetailedCostReportOperationResults/index.js" + }, + "import": { + "types": "./dist/esm/api/generateDetailedCostReportOperationResults/index.d.ts", + "default": "./dist/esm/api/generateDetailedCostReportOperationResults/index.js" + }, + "require": { + "types": "./dist/commonjs/api/generateDetailedCostReportOperationResults/index.d.ts", + "default": "./dist/commonjs/api/generateDetailedCostReportOperationResults/index.js" + } + }, + "./api/exports": { + "browser": { + "types": "./dist/browser/api/exports/index.d.ts", + "default": "./dist/browser/api/exports/index.js" + }, + "import": { + "types": "./dist/esm/api/exports/index.d.ts", + "default": "./dist/esm/api/exports/index.js" + }, + "require": { + "types": "./dist/commonjs/api/exports/index.d.ts", + "default": "./dist/commonjs/api/exports/index.js" + } + }, + "./api/budgets": { + "browser": { + "types": "./dist/browser/api/budgets/index.d.ts", + "default": "./dist/browser/api/budgets/index.js" + }, + "import": { + "types": "./dist/esm/api/budgets/index.d.ts", + "default": "./dist/esm/api/budgets/index.js" + }, + "require": { + "types": "./dist/commonjs/api/budgets/index.d.ts", + "default": "./dist/commonjs/api/budgets/index.js" + } + }, + "./api/operations": { + "browser": { + "types": "./dist/browser/api/operations/index.d.ts", + "default": "./dist/browser/api/operations/index.js" + }, + "import": { + "types": "./dist/esm/api/operations/index.d.ts", + "default": "./dist/esm/api/operations/index.js" + }, + "require": { + "types": "./dist/commonjs/api/operations/index.d.ts", + "default": "./dist/commonjs/api/operations/index.js" + } + }, + "./api/generateDetailedCostReportOperationStatus": { + "browser": { + "types": "./dist/browser/api/generateDetailedCostReportOperationStatus/index.d.ts", + "default": "./dist/browser/api/generateDetailedCostReportOperationStatus/index.js" + }, + "import": { + "types": "./dist/esm/api/generateDetailedCostReportOperationStatus/index.d.ts", + "default": "./dist/esm/api/generateDetailedCostReportOperationStatus/index.js" + }, + "require": { + "types": "./dist/commonjs/api/generateDetailedCostReportOperationStatus/index.d.ts", + "default": "./dist/commonjs/api/generateDetailedCostReportOperationStatus/index.js" + } + }, + "./models": { + "browser": { + "types": "./dist/browser/models/index.d.ts", + "default": "./dist/browser/models/index.js" + }, + "import": { + "types": "./dist/esm/models/index.d.ts", + "default": "./dist/esm/models/index.js" + }, + "require": { + "types": "./dist/commonjs/models/index.d.ts", + "default": "./dist/commonjs/models/index.js" + } + } }, "keywords": [ "node", "azure", + "cloud", "typescript", "browser", - "isomorphic", - "cloud" + "isomorphic" ], + "author": "Microsoft Corporation", "license": "MIT", - "main": "./dist/commonjs/index.js", - "module": "./dist/esm/index.js", - "types": "./dist/commonjs/index.d.ts", + "files": [ + "dist/", + "!dist/**/*.d.*ts.map", + "README.md", + "LICENSE" + ], + "sdk-type": "mgmt", + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js", + "directory": "sdk/cost-management/arm-costmanagement" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cost-management/arm-costmanagement/README.md", + "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", + "//metadata": { + "constantPaths": [ + { + "path": "src/api/costManagementContext.ts", + "prefix": "userAgentInfo" + } + ] + }, + "dependencies": { + "@azure/core-util": "^1.12.0", + "@azure-rest/core-client": "^2.3.1", + "@azure/abort-controller": "^2.1.2", + "@azure/core-auth": "^1.9.0", + "@azure/core-lro": "^3.1.0", + "@azure/core-rest-pipeline": "^1.20.0", + "@azure/logger": "^1.2.0", + "tslib": "^2.8.1" + }, "devDependencies": { "@azure-tools/test-credential": "workspace:^", "@azure-tools/test-recorder": "workspace:^", "@azure-tools/test-utils-vitest": "workspace:^", "@azure/dev-tool": "workspace:^", + "@azure/eslint-plugin-azure-sdk": "workspace:^", "@azure/identity": "catalog:internal", - "@azure/logger": "^1.1.4", "@types/node": "catalog:", + "cross-env": "catalog:", + "eslint": "catalog:", + "prettier": "catalog:", + "rimraf": "catalog:", "@vitest/browser-playwright": "catalog:testing", "@vitest/coverage-istanbul": "catalog:testing", - "cross-env": "catalog:", "dotenv": "catalog:testing", "playwright": "catalog:testing", - "rimraf": "catalog:", "typescript": "catalog:", "vitest": "catalog:testing" }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js", - "directory": "sdk/cost-management/arm-costmanagement" - }, - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "files": [ - "dist/", - "README.md", - "LICENSE", - "review/", - "CHANGELOG.md" - ], "scripts": { - "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api", - "build:samples": "tsc -p config/tsconfig.samples.json && dev-tool samples publish -f", - "check-format": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", - "execute:samples": "echo skipped", - "extract-api": "dev-tool run extract-api", - "format": "echo skipped", - "lint": "echo skipped", + "extract-api": "rimraf review && dev-tool run extract-api", "pack": "pnpm pack 2>&1", - "test": "tsc -b --noEmit && npm run test:node && npm run test:browser", - "test:browser": "echo skipped", + "lint": "echo skipped", + "lint:fix": "echo skipped", + "build:samples": "tsc -p config/tsconfig.samples.json && dev-tool samples publish -f", + "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"", + "execute:samples": "dev-tool samples run samples-dev", + "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"", + "generate:client": "echo skipped", + "test:browser": "dev-tool run test:vitest --browser", + "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api", "test:node": "dev-tool run test:vitest", + "test": "tsc -b --noEmit && npm run test:node && npm run test:browser", "update-snippets": "dev-tool run update-snippets" }, - "sideEffects": false, - "//metadata": { - "constantPaths": [ - { - "path": "src/costManagementClient.ts", - "prefix": "packageDetails" - } - ] - }, - "autoPublish": true, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cost-management/arm-costmanagement/README.md", "//sampleConfiguration": { - "productName": "", + "productName": "@azure/arm-costmanagement", "productSlugs": [ "azure" ], "disableDocsMs": true, "apiRefLink": "https://learn.microsoft.com/javascript/api/@azure/arm-costmanagement?view=azure-node-preview" - }, - "type": "module", - "browser": "./dist/browser/index.js", - "exports": { - "./package.json": "./package.json", - ".": { - "browser": { - "types": "./dist/browser/index.d.ts", - "default": "./dist/browser/index.js" - }, - "import": { - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - }, - "require": { - "types": "./dist/commonjs/index.d.ts", - "default": "./dist/commonjs/index.js" - } - } - }, - "imports": { - "#platform/*": { - "browser": "./src/*-browser.mts", - "default": "./src/*.ts" - } } } diff --git a/sdk/cost-management/arm-costmanagement/review/arm-costmanagement-browser.api.diff.md b/sdk/cost-management/arm-costmanagement/review/arm-costmanagement-browser.api.diff.md new file mode 100644 index 000000000000..52db5ca102d2 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/review/arm-costmanagement-browser.api.diff.md @@ -0,0 +1,54 @@ +# API Report Diff for browser runtime + +This file contains only the differences from the Node.js API. +For the complete API surface, see the corresponding -node.api.md file. + +```diff +=================================================================== +--- NodeJS ++++ browser +@@ -306,9 +306,9 @@ + readonly currentSpend?: CurrentSpend; + eTag?: string; + filter?: BudgetFilter; + readonly forecastSpend?: ForecastSpend; +- notifications?: Record; ++ notifications?: Record; + timeGrain?: TimeGrainType; + timePeriod?: BudgetTimePeriod; + } + +@@ -344,9 +344,9 @@ + category: CategoryType; + readonly currentSpend?: CurrentSpend; + filter?: BudgetFilter; + readonly forecastSpend?: ForecastSpend; +- notifications?: Record; ++ notifications?: Record; + timeGrain: TimeGrainType; + timePeriod: BudgetTimePeriod; + } + +@@ -1835,9 +1835,9 @@ + // @public + export type MetricType = string; + + // @public +-export interface Notification { ++interface Notification_2 { + contactEmails: string[]; + contactGroups?: string[]; + contactRoles?: string[]; + enabled: boolean; +@@ -1846,8 +1846,9 @@ + operator: BudgetNotificationOperatorType; + threshold: number; + thresholdType?: ThresholdType; + } ++export { Notification_2 as Notification } + + // @public + export interface NotificationProperties { + language?: string; + +``` \ No newline at end of file diff --git a/sdk/cost-management/arm-costmanagement/review/arm-costmanagement-node.api.md b/sdk/cost-management/arm-costmanagement/review/arm-costmanagement-node.api.md index d4b49cb7a3b0..1d71c0552a53 100644 --- a/sdk/cost-management/arm-costmanagement/review/arm-costmanagement-node.api.md +++ b/sdk/cost-management/arm-costmanagement/review/arm-costmanagement-node.api.md @@ -4,11 +4,16 @@ ```ts -import * as coreAuth from '@azure/core-auth'; -import * as coreClient from '@azure/core-client'; -import { OperationState } from '@azure/core-lro'; -import { PagedAsyncIterableIterator } from '@azure/core-paging'; -import { SimplePollerLike } from '@azure/core-lro'; +import type { AbortSignalLike } from '@azure/abort-controller'; +import type { ClientOptions } from '@azure-rest/core-client'; +import { isRestError } from '@azure/core-rest-pipeline'; +import type { OperationOptions } from '@azure-rest/core-client'; +import type { OperationState } from '@azure/core-lro'; +import type { PathUncheckedResponse } from '@azure-rest/core-client'; +import type { Pipeline } from '@azure/core-rest-pipeline'; +import type { PollerLike } from '@azure/core-lro'; +import { RestError } from '@azure/core-rest-pipeline'; +import type { TokenCredential } from '@azure/core-auth'; // @public export type AccumulatedType = string; @@ -17,13 +22,14 @@ export type AccumulatedType = string; export type ActionType = string; // @public -export interface Alert extends CostManagementProxyResource { +export interface Alert extends ExtensionResource { closeTime?: string; costEntityId?: string; creationTime?: string; definition?: AlertPropertiesDefinition; description?: string; details?: AlertPropertiesDetails; + eTag?: string; modificationTime?: string; source?: AlertSource; status?: AlertStatus; @@ -40,6 +46,21 @@ export type AlertCriteria = string; // @public export type AlertOperator = string; +// @public +export interface AlertProperties { + closeTime?: string; + costEntityId?: string; + creationTime?: string; + definition?: AlertPropertiesDefinition; + description?: string; + details?: AlertPropertiesDetails; + modificationTime?: string; + source?: AlertSource; + status?: AlertStatus; + statusModificationTime?: string; + statusModificationUserName?: string; +} + // @public export interface AlertPropertiesDefinition { category?: AlertCategory; @@ -66,7 +87,7 @@ export interface AlertPropertiesDetails { periodStartDate?: string; resourceFilter?: any[]; resourceGroupFilter?: any[]; - tagFilter?: Record; + tagFilter?: any; threshold?: number; timeGrainType?: AlertTimeGrainType; triggeredBy?: string; @@ -74,41 +95,29 @@ export interface AlertPropertiesDetails { } // @public -export interface Alerts { - dismiss(scope: string, alertId: string, parameters: DismissAlertPayload, options?: AlertsDismissOptionalParams): Promise; - get(scope: string, alertId: string, options?: AlertsGetOptionalParams): Promise; - list(scope: string, options?: AlertsListOptionalParams): Promise; - listExternal(externalCloudProviderType: ExternalCloudProviderType, externalCloudProviderId: string, options?: AlertsListExternalOptionalParams): Promise; +export interface AlertsDismissOptionalParams extends OperationOptions { } // @public -export interface AlertsDismissOptionalParams extends coreClient.OperationOptions { +export interface AlertsGetOptionalParams extends OperationOptions { } // @public -export type AlertsDismissResponse = Alert; - -// @public -export interface AlertsGetOptionalParams extends coreClient.OperationOptions { +export interface AlertsListExternalOptionalParams extends OperationOptions { } // @public -export type AlertsGetResponse = Alert; - -// @public -export interface AlertsListExternalOptionalParams extends coreClient.OperationOptions { +export interface AlertsListOptionalParams extends OperationOptions { } // @public -export type AlertsListExternalResponse = AlertsResult; - -// @public -export interface AlertsListOptionalParams extends coreClient.OperationOptions { +export interface AlertsOperations { + dismiss: (scope: string, alertId: string, parameters: DismissAlertPayload, options?: AlertsDismissOptionalParams) => Promise; + get: (scope: string, alertId: string, options?: AlertsGetOptionalParams) => Promise; + list: (scope: string, options?: AlertsListOptionalParams) => Promise; + listExternal: (externalCloudProviderType: ExternalCloudProviderType, externalCloudProviderId: string, options?: AlertsListExternalOptionalParams) => Promise; } -// @public -export type AlertsListResponse = AlertsResult; - // @public export type AlertSource = string; @@ -146,6 +155,28 @@ export interface AllSavingsList { readonly value?: AllSavingsBenefitDetails[]; } +// @public +export interface ArmErrorResponse { + error?: ErrorDetail; +} + +// @public +export interface AsyncOperationStatusProperties { + reportUrl?: BenefitUtilizationSummaryReportSchema; + secondaryReportUrl?: BenefitUtilizationSummaryReportSchema; + validUntil?: Date; +} + +// @public +export enum AzureClouds { + AZURE_CHINA_CLOUD = "AZURE_CHINA_CLOUD", + AZURE_PUBLIC_CLOUD = "AZURE_PUBLIC_CLOUD", + AZURE_US_GOVERNMENT = "AZURE_US_GOVERNMENT" +} + +// @public +export type AzureSupportedClouds = `${AzureClouds}`; + // @public export type BenefitKind = string; @@ -165,41 +196,25 @@ export interface BenefitRecommendationProperties { readonly lastConsumptionDate?: Date; lookBackPeriod?: LookBackPeriod; recommendationDetails?: AllSavingsBenefitDetails; - scope: "Single" | "Shared"; + scope: Scope; term?: Term; readonly totalHours?: number; usage?: RecommendationUsageDetails; } -// @public (undocumented) -export type BenefitRecommendationPropertiesUnion = BenefitRecommendationProperties | SingleScopeBenefitRecommendationProperties | SharedScopeBenefitRecommendationProperties; - -// @public -export interface BenefitRecommendations { - list(billingScope: string, options?: BenefitRecommendationsListOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface BenefitRecommendationsListNextOptionalParams extends coreClient.OperationOptions { -} - // @public -export type BenefitRecommendationsListNextResponse = BenefitRecommendationsListResult; +export type BenefitRecommendationPropertiesUnion = SingleScopeBenefitRecommendationProperties | SharedScopeBenefitRecommendationProperties | BenefitRecommendationProperties; // @public -export interface BenefitRecommendationsListOptionalParams extends coreClient.OperationOptions { +export interface BenefitRecommendationsListOptionalParams extends OperationOptions { expand?: string; filter?: string; orderby?: string; } // @public -export type BenefitRecommendationsListResponse = BenefitRecommendationsListResult; - -// @public -export interface BenefitRecommendationsListResult { - readonly nextLink?: string; - readonly value?: BenefitRecommendationModel[]; +export interface BenefitRecommendationsOperations { + list: (billingScope: string, options?: BenefitRecommendationsListOptionalParams) => PagedAsyncIterableIterator; } // @public @@ -208,106 +223,167 @@ export interface BenefitResource extends Resource { } // @public -export interface BenefitUtilizationSummaries { - listByBillingAccountId(billingAccountId: string, options?: BenefitUtilizationSummariesListByBillingAccountIdOptionalParams): PagedAsyncIterableIterator; - listByBillingProfileId(billingAccountId: string, billingProfileId: string, options?: BenefitUtilizationSummariesListByBillingProfileIdOptionalParams): PagedAsyncIterableIterator; - listBySavingsPlanId(savingsPlanOrderId: string, savingsPlanId: string, options?: BenefitUtilizationSummariesListBySavingsPlanIdOptionalParams): PagedAsyncIterableIterator; - listBySavingsPlanOrder(savingsPlanOrderId: string, options?: BenefitUtilizationSummariesListBySavingsPlanOrderOptionalParams): PagedAsyncIterableIterator; +export interface BenefitUtilizationSummariesListByBillingAccountIdOptionalParams extends OperationOptions { + filter?: string; + grainParameter?: GrainParameter; } // @public -export interface BenefitUtilizationSummariesListByBillingAccountIdNextOptionalParams extends coreClient.OperationOptions { +export interface BenefitUtilizationSummariesListByBillingProfileIdOptionalParams extends OperationOptions { + filter?: string; + grainParameter?: GrainParameter; } // @public -export type BenefitUtilizationSummariesListByBillingAccountIdNextResponse = BenefitUtilizationSummariesListResult; +export interface BenefitUtilizationSummariesListBySavingsPlanIdOptionalParams extends OperationOptions { + filter?: string; + grainParameter?: GrainParameter; +} // @public -export interface BenefitUtilizationSummariesListByBillingAccountIdOptionalParams extends coreClient.OperationOptions { +export interface BenefitUtilizationSummariesListBySavingsPlanOrderOptionalParams extends OperationOptions { filter?: string; grainParameter?: GrainParameter; } // @public -export type BenefitUtilizationSummariesListByBillingAccountIdResponse = BenefitUtilizationSummariesListResult; +export interface BenefitUtilizationSummariesOperations { + listByBillingAccountId: (billingAccountId: string, options?: BenefitUtilizationSummariesListByBillingAccountIdOptionalParams) => PagedAsyncIterableIterator; + listByBillingProfileId: (billingAccountId: string, billingProfileId: string, options?: BenefitUtilizationSummariesListByBillingProfileIdOptionalParams) => PagedAsyncIterableIterator; + listBySavingsPlanId: (savingsPlanOrderId: string, savingsPlanId: string, options?: BenefitUtilizationSummariesListBySavingsPlanIdOptionalParams) => PagedAsyncIterableIterator; + listBySavingsPlanOrder: (savingsPlanOrderId: string, options?: BenefitUtilizationSummariesListBySavingsPlanOrderOptionalParams) => PagedAsyncIterableIterator; +} // @public -export interface BenefitUtilizationSummariesListByBillingProfileIdNextOptionalParams extends coreClient.OperationOptions { +export interface BenefitUtilizationSummariesOperationStatus { + input?: BenefitUtilizationSummariesRequest; + properties?: AsyncOperationStatusProperties; + status?: OperationStatusType; } // @public -export type BenefitUtilizationSummariesListByBillingProfileIdNextResponse = BenefitUtilizationSummariesListResult; +export interface BenefitUtilizationSummariesRequest { + benefitId?: string; + benefitOrderId?: string; + billingAccountId?: string; + billingProfileId?: string; + endDate: Date; + grain: Grain; + kind?: BenefitKind; + startDate: Date; +} // @public -export interface BenefitUtilizationSummariesListByBillingProfileIdOptionalParams extends coreClient.OperationOptions { - filter?: string; - grainParameter?: GrainParameter; +export interface BenefitUtilizationSummary extends Resource { + kind: BenefitKind; +} + +// @public +export interface BenefitUtilizationSummaryProperties { + readonly armSkuName?: string; + readonly benefitId?: string; + readonly benefitOrderId?: string; + benefitType?: BenefitKind; + readonly usageDate?: Date; } // @public -export type BenefitUtilizationSummariesListByBillingProfileIdResponse = BenefitUtilizationSummariesListResult; +export type BenefitUtilizationSummaryReportSchema = string; // @public -export interface BenefitUtilizationSummariesListBySavingsPlanIdNextOptionalParams extends coreClient.OperationOptions { +export type BenefitUtilizationSummaryUnion = IncludedQuantityUtilizationSummary | SavingsPlanUtilizationSummary | BenefitUtilizationSummary; + +// @public +export interface BlobInfo { + blobLink?: string; + byteCount?: number; } // @public -export type BenefitUtilizationSummariesListBySavingsPlanIdNextResponse = BenefitUtilizationSummariesListResult; +export interface Budget extends ExtensionResource { + amount?: number; + category?: CategoryType; + readonly currentSpend?: CurrentSpend; + eTag?: string; + filter?: BudgetFilter; + readonly forecastSpend?: ForecastSpend; + notifications?: Record; + timeGrain?: TimeGrainType; + timePeriod?: BudgetTimePeriod; +} // @public -export interface BenefitUtilizationSummariesListBySavingsPlanIdOptionalParams extends coreClient.OperationOptions { - filter?: string; - grainParameter?: GrainParameter; +export interface BudgetComparisonExpression { + name: string; + operator: BudgetOperatorType; + values: string[]; } // @public -export type BenefitUtilizationSummariesListBySavingsPlanIdResponse = BenefitUtilizationSummariesListResult; +export interface BudgetFilter { + and?: BudgetFilterProperties[]; + dimensions?: BudgetComparisonExpression; + tags?: BudgetComparisonExpression; +} // @public -export interface BenefitUtilizationSummariesListBySavingsPlanOrderNextOptionalParams extends coreClient.OperationOptions { +export interface BudgetFilterProperties { + dimensions?: BudgetComparisonExpression; + tags?: BudgetComparisonExpression; } // @public -export type BenefitUtilizationSummariesListBySavingsPlanOrderNextResponse = BenefitUtilizationSummariesListResult; +export type BudgetNotificationOperatorType = string; // @public -export interface BenefitUtilizationSummariesListBySavingsPlanOrderOptionalParams extends coreClient.OperationOptions { - filter?: string; - grainParameter?: GrainParameter; +export type BudgetOperatorType = string; + +// @public +export interface BudgetProperties { + amount?: number; + category: CategoryType; + readonly currentSpend?: CurrentSpend; + filter?: BudgetFilter; + readonly forecastSpend?: ForecastSpend; + notifications?: Record; + timeGrain: TimeGrainType; + timePeriod: BudgetTimePeriod; } // @public -export type BenefitUtilizationSummariesListBySavingsPlanOrderResponse = BenefitUtilizationSummariesListResult; +export interface BudgetsCreateOrUpdateOptionalParams extends OperationOptions { +} // @public -export interface BenefitUtilizationSummariesListResult { - readonly nextLink?: string; - readonly value?: BenefitUtilizationSummaryUnion[]; +export interface BudgetsDeleteOptionalParams extends OperationOptions { } // @public -export interface BenefitUtilizationSummary extends Resource { - kind: BenefitKind; +export interface BudgetsGetOptionalParams extends OperationOptions { } // @public -export interface BenefitUtilizationSummaryProperties { - readonly armSkuName?: string; - readonly benefitId?: string; - readonly benefitOrderId?: string; - benefitType?: BenefitKind; - readonly usageDate?: Date; +export interface BudgetsListOptionalParams extends OperationOptions { + filter?: string; } -// @public (undocumented) -export type BenefitUtilizationSummaryUnion = BenefitUtilizationSummary | IncludedQuantityUtilizationSummary | SavingsPlanUtilizationSummary; +// @public +export interface BudgetsOperations { + createOrUpdate: (scope: string, budgetName: string, parameters: Budget, options?: BudgetsCreateOrUpdateOptionalParams) => Promise; + delete: (scope: string, budgetName: string, options?: BudgetsDeleteOptionalParams) => Promise; + get: (scope: string, budgetName: string, options?: BudgetsGetOptionalParams) => Promise; + list: (scope: string, options?: BudgetsListOptionalParams) => PagedAsyncIterableIterator; +} // @public -export interface BlobInfo { - blobLink?: string; - byteCount?: number; +export interface BudgetTimePeriod { + endDate?: Date; + startDate: Date; } +// @public +export type CategoryType = string; + // @public export type ChartType = string; @@ -329,12 +405,104 @@ export interface CheckNameAvailabilityResponse { // @public export interface CommonExportProperties { + compressionMode?: CompressionModeType; + dataOverwriteBehavior?: DataOverwriteBehaviorType; definition: ExportDefinition; deliveryInfo: ExportDeliveryInfo; + exportDescription?: string; format?: FormatType; readonly nextRunTimeEstimate?: Date; partitionData?: boolean; runHistory?: ExportExecutionListResult; + readonly systemSuspensionContext?: ExportSuspensionContext; +} + +// @public +export type CompressionModeType = string; + +// @public +export type ContinuablePage = TPage & { + continuationToken?: string; +}; + +// @public +export type CostAllocationPolicyType = string; + +// @public +export interface CostAllocationProportion { + name: string; + percentage: number; +} + +// @public +export interface CostAllocationResource { + name: string; + resourceType: CostAllocationResourceType; +} + +// @public +export type CostAllocationResourceType = string; + +// @public +export interface CostAllocationRuleCheckNameAvailabilityRequest { + name?: string; + type?: string; +} + +// @public +export interface CostAllocationRuleCheckNameAvailabilityResponse { + message?: string; + nameAvailable?: boolean; + reason?: Reason; +} + +// @public +export interface CostAllocationRuleDefinition extends ProxyResource { + properties?: CostAllocationRuleProperties; +} + +// @public +export interface CostAllocationRuleDetails { + sourceResources?: SourceCostAllocationResource[]; + targetResources?: TargetCostAllocationResource[]; +} + +// @public +export interface CostAllocationRuleProperties { + readonly createdDate?: Date; + description?: string; + details: CostAllocationRuleDetails; + status: RuleStatus; + readonly updatedDate?: Date; +} + +// @public +export interface CostAllocationRulesCheckNameAvailabilityOptionalParams extends OperationOptions { +} + +// @public +export interface CostAllocationRulesCreateOrUpdateOptionalParams extends OperationOptions { +} + +// @public +export interface CostAllocationRulesDeleteOptionalParams extends OperationOptions { +} + +// @public +export interface CostAllocationRulesGetOptionalParams extends OperationOptions { +} + +// @public +export interface CostAllocationRulesListOptionalParams extends OperationOptions { +} + +// @public +export interface CostAllocationRulesOperations { + checkNameAvailability: (billingAccountId: string, costAllocationRuleCheckNameAvailabilityRequest: CostAllocationRuleCheckNameAvailabilityRequest, options?: CostAllocationRulesCheckNameAvailabilityOptionalParams) => Promise; + createOrUpdate: (billingAccountId: string, ruleName: string, costAllocationRule: CostAllocationRuleDefinition, options?: CostAllocationRulesCreateOrUpdateOptionalParams) => Promise; + delete: (billingAccountId: string, ruleName: string, options?: CostAllocationRulesDeleteOptionalParams) => Promise; + get: (billingAccountId: string, ruleName: string, options?: CostAllocationRulesGetOptionalParams) => Promise; + list: (billingAccountId: string, options?: CostAllocationRulesListOptionalParams) => PagedAsyncIterableIterator; } // @public @@ -354,8 +522,7 @@ export interface CostDetailsOperationResults { id?: string; manifestVersion?: string; name?: string; - requestBody?: GenerateCostDetailsReportRequestDefinition; - requestScope?: string; + requestContext?: RequestContext; status?: CostDetailsStatusType; type?: string; validTill?: Date; @@ -371,51 +538,35 @@ export interface CostDetailsTimePeriod { } // @public (undocumented) -export class CostManagementClient extends coreClient.ServiceClient { - // (undocumented) - $host: string; - constructor(credentials: coreAuth.TokenCredential, options?: CostManagementClientOptionalParams); - // (undocumented) - alerts: Alerts; - // (undocumented) - apiVersion: string; - // (undocumented) - benefitRecommendations: BenefitRecommendations; - // (undocumented) - benefitUtilizationSummaries: BenefitUtilizationSummaries; - // (undocumented) - dimensions: Dimensions; - // (undocumented) - exports: Exports; - // (undocumented) - forecast: Forecast; - // (undocumented) - generateCostDetailsReport: GenerateCostDetailsReport; - // (undocumented) - generateDetailedCostReport: GenerateDetailedCostReport; - // (undocumented) - generateDetailedCostReportOperationResults: GenerateDetailedCostReportOperationResults; - // (undocumented) - generateDetailedCostReportOperationStatus: GenerateDetailedCostReportOperationStatus; - // (undocumented) - generateReservationDetailsReport: GenerateReservationDetailsReport; - // (undocumented) - operations: Operations; - // (undocumented) - priceSheet: PriceSheet; - // (undocumented) - query: Query; - // (undocumented) - scheduledActions: ScheduledActions; - // (undocumented) - views: Views; -} - -// @public -export interface CostManagementClientOptionalParams extends coreClient.ServiceClientOptions { - $host?: string; +export class CostManagementClient { + constructor(credential: TokenCredential, options?: CostManagementClientOptionalParams); + readonly alerts: AlertsOperations; + readonly benefitRecommendations: BenefitRecommendationsOperations; + readonly benefitUtilizationSummaries: BenefitUtilizationSummariesOperations; + readonly budgets: BudgetsOperations; + readonly costAllocationRules: CostAllocationRulesOperations; + readonly dimensions: DimensionsOperations; + readonly exports: ExportsOperations; + readonly forecast: ForecastOperations; + readonly generateBenefitUtilizationSummariesReport: GenerateBenefitUtilizationSummariesReportOperations; + readonly generateCostDetailsReport: GenerateCostDetailsReportOperations; + readonly generateDetailedCostReport: GenerateDetailedCostReportOperations; + readonly generateDetailedCostReportOperationResults: GenerateDetailedCostReportOperationResultsOperations; + readonly generateDetailedCostReportOperationStatus: GenerateDetailedCostReportOperationStatusOperations; + readonly generateReservationDetailsReport: GenerateReservationDetailsReportOperations; + readonly operations: OperationsOperations; + readonly pipeline: Pipeline; + readonly priceSheet: PriceSheetOperations; + readonly query: QueryOperations; + readonly scheduledActions: ScheduledActionsOperations; + readonly settings: SettingsOperations; + readonly views: ViewsOperations; +} + +// @public +export interface CostManagementClientOptionalParams extends ClientOptions { apiVersion?: string; - endpoint?: string; + cloudSetting?: AzureSupportedClouds; } // @public @@ -438,18 +589,31 @@ export interface CostManagementResource { readonly location?: string; readonly name?: string; readonly sku?: string; - readonly tags?: { - [propertyName: string]: string; - }; + readonly tags?: Record; readonly type?: string; } // @public export type CreatedByType = string; +// @public +export type CultureCode = string; + +// @public +export interface CurrentSpend { + readonly amount?: number; + readonly unit?: string; +} + +// @public +export type DataOverwriteBehaviorType = string; + // @public export type DaysOfWeek = string; +// @public +export type DestinationType = string; + // @public export interface Dimension extends CostManagementResource { readonly category?: string; @@ -464,13 +628,20 @@ export interface Dimension extends CostManagementResource { } // @public -export interface Dimensions { - list(scope: string, options?: DimensionsListOptionalParams): PagedAsyncIterableIterator; - listByExternalCloudProviderType(externalCloudProviderType: ExternalCloudProviderType, externalCloudProviderId: string, options?: DimensionsByExternalCloudProviderTypeOptionalParams): PagedAsyncIterableIterator; +export interface DimensionProperties { + readonly category?: string; + data?: string[]; + readonly description?: string; + readonly filterEnabled?: boolean; + readonly groupingEnabled?: boolean; + readonly nextLink?: string; + readonly total?: number; + readonly usageEnd?: Date; + readonly usageStart?: Date; } // @public -export interface DimensionsByExternalCloudProviderTypeOptionalParams extends coreClient.OperationOptions { +export interface DimensionsListByExternalCloudProviderTypeOptionalParams extends OperationOptions { expand?: string; filter?: string; skiptoken?: string; @@ -478,10 +649,7 @@ export interface DimensionsByExternalCloudProviderTypeOptionalParams extends cor } // @public -export type DimensionsByExternalCloudProviderTypeResponse = DimensionsListResult; - -// @public -export interface DimensionsListOptionalParams extends coreClient.OperationOptions { +export interface DimensionsListOptionalParams extends OperationOptions { expand?: string; filter?: string; skiptoken?: string; @@ -489,11 +657,9 @@ export interface DimensionsListOptionalParams extends coreClient.OperationOption } // @public -export type DimensionsListResponse = DimensionsListResult; - -// @public -export interface DimensionsListResult { - readonly value?: Dimension[]; +export interface DimensionsOperations { + list: (scope: string, options?: DimensionsListOptionalParams) => PagedAsyncIterableIterator; + listByExternalCloudProviderType: (externalCloudProviderType: ExternalCloudProviderType, externalCloudProviderId: string, options?: DimensionsListByExternalCloudProviderTypeOptionalParams) => PagedAsyncIterableIterator; } // @public @@ -518,6 +684,21 @@ export interface DownloadURL { validTill?: Date; } +// @public +export interface ErrorAdditionalInfo { + readonly info?: any; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + // @public export interface ErrorDetails { readonly code?: string; @@ -546,14 +727,21 @@ export type ExecutionStatus = string; export type ExecutionType = string; // @public -export interface Export extends CostManagementProxyResource { +export interface Export extends ExtensionResource { + compressionMode?: CompressionModeType; + dataOverwriteBehavior?: DataOverwriteBehaviorType; definition?: ExportDefinition; deliveryInfo?: ExportDeliveryInfo; + eTag?: string; + exportDescription?: string; format?: FormatType; + identity?: SystemAssignedServiceIdentity; + location?: string; readonly nextRunTimeEstimate?: Date; partitionData?: boolean; runHistory?: ExportExecutionListResult; schedule?: ExportSchedule; + readonly systemSuspensionContext?: ExportSuspensionContext; } // @public @@ -565,6 +753,8 @@ export interface ExportDataset { // @public export interface ExportDatasetConfiguration { columns?: string[]; + dataVersion?: string; + filters?: FilterItems[]; } // @public @@ -582,6 +772,7 @@ export interface ExportDeliveryDestination { rootFolderPath?: string; sasToken?: string; storageAccount?: string; + type?: DestinationType; } // @public @@ -612,25 +803,39 @@ export interface ExportRecurrencePeriod { // @public export interface ExportRun extends CostManagementProxyResource { + endDate?: Date; error?: ErrorDetails; executionType?: ExecutionType; fileName?: string; + manifestFile?: string; processingEndTime?: Date; processingStartTime?: Date; runSettings?: CommonExportProperties; + startDate?: Date; status?: ExecutionStatus; submittedBy?: string; submittedTime?: Date; } // @public -export interface Exports { - createOrUpdate(scope: string, exportName: string, parameters: Export, options?: ExportsCreateOrUpdateOptionalParams): Promise; - delete(scope: string, exportName: string, options?: ExportsDeleteOptionalParams): Promise; - execute(scope: string, exportName: string, options?: ExportsExecuteOptionalParams): Promise; - get(scope: string, exportName: string, options?: ExportsGetOptionalParams): Promise; - getExecutionHistory(scope: string, exportName: string, options?: ExportsGetExecutionHistoryOptionalParams): Promise; - list(scope: string, options?: ExportsListOptionalParams): Promise; +export interface ExportRunProperties { + endDate?: Date; + error?: ErrorDetails; + executionType?: ExecutionType; + fileName?: string; + manifestFile?: string; + processingEndTime?: Date; + processingStartTime?: Date; + runSettings?: CommonExportProperties; + startDate?: Date; + status?: ExecutionStatus; + submittedBy?: string; + submittedTime?: Date; +} + +// @public +export interface ExportRunRequest { + timePeriod?: ExportTimePeriod; } // @public @@ -641,42 +846,48 @@ export interface ExportSchedule { } // @public -export interface ExportsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +export interface ExportsCreateOrUpdateOptionalParams extends OperationOptions { } // @public -export type ExportsCreateOrUpdateResponse = Export; - -// @public -export interface ExportsDeleteOptionalParams extends coreClient.OperationOptions { +export interface ExportsDeleteOptionalParams extends OperationOptions { } // @public -export interface ExportsExecuteOptionalParams extends coreClient.OperationOptions { +export interface ExportsExecuteOptionalParams extends OperationOptions { + parameters?: ExportRunRequest; } // @public -export interface ExportsGetExecutionHistoryOptionalParams extends coreClient.OperationOptions { +export interface ExportsGetExecutionHistoryOptionalParams extends OperationOptions { } // @public -export type ExportsGetExecutionHistoryResponse = ExportExecutionListResult; - -// @public -export interface ExportsGetOptionalParams extends coreClient.OperationOptions { +export interface ExportsGetOptionalParams extends OperationOptions { expand?: string; } // @public -export type ExportsGetResponse = Export; +export interface ExportsListOptionalParams extends OperationOptions { + expand?: string; +} // @public -export interface ExportsListOptionalParams extends coreClient.OperationOptions { - expand?: string; +export interface ExportsOperations { + createOrUpdate: (scope: string, exportName: string, parameters: Export, options?: ExportsCreateOrUpdateOptionalParams) => Promise; + delete: (scope: string, exportName: string, options?: ExportsDeleteOptionalParams) => Promise; + execute: (scope: string, exportName: string, options?: ExportsExecuteOptionalParams) => Promise; + get: (scope: string, exportName: string, options?: ExportsGetOptionalParams) => Promise; + getExecutionHistory: (scope: string, exportName: string, options?: ExportsGetExecutionHistoryOptionalParams) => Promise; + list: (scope: string, options?: ExportsListOptionalParams) => Promise; } // @public -export type ExportsListResponse = ExportListResult; +export interface ExportSuspensionContext { + suspensionCode?: string; + suspensionReason?: string; + suspensionTime?: Date; +} // @public export interface ExportTimePeriod { @@ -687,6 +898,10 @@ export interface ExportTimePeriod { // @public export type ExportType = string; +// @public +export interface ExtensionResource extends Resource { +} + // @public export type ExternalCloudProviderType = string; @@ -699,9 +914,12 @@ export interface FileDestination { export type FileFormat = string; // @public -export interface Forecast { - externalCloudProviderUsage(externalCloudProviderType: ExternalCloudProviderType, externalCloudProviderId: string, parameters: ForecastDefinition, options?: ForecastExternalCloudProviderUsageOptionalParams): Promise; - usage(scope: string, parameters: ForecastDefinition, options?: ForecastUsageOptionalParams): Promise; +export type FilterItemNames = string; + +// @public +export interface FilterItems { + name?: FilterItemNames; + value?: string; } // @public @@ -725,9 +943,7 @@ export interface ForecastComparisonExpression { // @public export interface ForecastDataset { - aggregation: { - [propertyName: string]: ForecastAggregation; - }; + aggregation: Record; configuration?: ForecastDatasetConfiguration; filter?: ForecastFilter; granularity?: GranularityType; @@ -749,13 +965,10 @@ export interface ForecastDefinition { } // @public -export interface ForecastExternalCloudProviderUsageOptionalParams extends coreClient.OperationOptions { +export interface ForecastExternalCloudProviderUsageOptionalParams extends OperationOptions { filter?: string; } -// @public -export type ForecastExternalCloudProviderUsageResponse = ForecastResult; - // @public export interface ForecastFilter { and?: ForecastFilter[]; @@ -764,9 +977,22 @@ export interface ForecastFilter { tags?: ForecastComparisonExpression; } +// @public +export interface ForecastOperations { + externalCloudProviderUsage: (externalCloudProviderType: ExternalCloudProviderType, externalCloudProviderId: string, parameters: ForecastDefinition, options?: ForecastExternalCloudProviderUsageOptionalParams) => Promise; + usage: (scope: string, parameters: ForecastDefinition, options?: ForecastUsageOptionalParams) => Promise; +} + // @public export type ForecastOperatorType = string; +// @public +export interface ForecastProperties { + columns?: ForecastColumn[]; + nextLink?: string; + rows?: any[][]; +} + // @public export interface ForecastResult extends CostManagementResource { columns?: ForecastColumn[]; @@ -774,6 +1000,12 @@ export interface ForecastResult extends CostManagementResource { rows?: any[][]; } +// @public +export interface ForecastSpend { + readonly amount?: number; + readonly unit?: string; +} + // @public export type ForecastTimeframe = string; @@ -787,15 +1019,15 @@ export interface ForecastTimePeriod { export type ForecastType = string; // @public -export interface ForecastUsageOptionalParams extends coreClient.OperationOptions { +export interface ForecastUsageOptionalParams extends OperationOptions { filter?: string; } // @public -export type ForecastUsageResponse = ForecastResult; +export type FormatType = string; // @public -export type FormatType = string; +export type Frequency = string; // @public export type FunctionName = string; @@ -804,72 +1036,78 @@ export type FunctionName = string; export type FunctionType = string; // @public -export interface GenerateCostDetailsReport { - beginCreateOperation(scope: string, parameters: GenerateCostDetailsReportRequestDefinition, options?: GenerateCostDetailsReportCreateOperationOptionalParams): Promise, GenerateCostDetailsReportCreateOperationResponse>>; - beginCreateOperationAndWait(scope: string, parameters: GenerateCostDetailsReportRequestDefinition, options?: GenerateCostDetailsReportCreateOperationOptionalParams): Promise; - beginGetOperationResults(scope: string, operationId: string, options?: GenerateCostDetailsReportGetOperationResultsOptionalParams): Promise, GenerateCostDetailsReportGetOperationResultsResponse>>; - beginGetOperationResultsAndWait(scope: string, operationId: string, options?: GenerateCostDetailsReportGetOperationResultsOptionalParams): Promise; +export interface GenerateBenefitUtilizationSummariesReportGenerateByBillingAccountOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public -export interface GenerateCostDetailsReportCreateOperationHeaders { - location?: string; - retryAfter?: number; +export interface GenerateBenefitUtilizationSummariesReportGenerateByBillingProfileOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public -export interface GenerateCostDetailsReportCreateOperationOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface GenerateBenefitUtilizationSummariesReportGenerateByReservationIdOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type GenerateCostDetailsReportCreateOperationResponse = CostDetailsOperationResults; +export interface GenerateBenefitUtilizationSummariesReportGenerateByReservationOrderIdOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} // @public -export interface GenerateCostDetailsReportErrorResponse { - error?: ErrorDetails; +export interface GenerateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public -export interface GenerateCostDetailsReportGetOperationResultsOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface GenerateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type GenerateCostDetailsReportGetOperationResultsResponse = CostDetailsOperationResults; +export interface GenerateBenefitUtilizationSummariesReportOperations { + generateByBillingAccount: (billingAccountId: string, benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, options?: GenerateBenefitUtilizationSummariesReportGenerateByBillingAccountOptionalParams) => PollerLike, BenefitUtilizationSummariesOperationStatus>; + generateByBillingProfile: (billingAccountId: string, billingProfileId: string, benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, options?: GenerateBenefitUtilizationSummariesReportGenerateByBillingProfileOptionalParams) => PollerLike, BenefitUtilizationSummariesOperationStatus>; + generateByReservationId: (reservationOrderId: string, reservationId: string, benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, options?: GenerateBenefitUtilizationSummariesReportGenerateByReservationIdOptionalParams) => PollerLike, BenefitUtilizationSummariesOperationStatus>; + generateByReservationOrderId: (reservationOrderId: string, benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, options?: GenerateBenefitUtilizationSummariesReportGenerateByReservationOrderIdOptionalParams) => PollerLike, BenefitUtilizationSummariesOperationStatus>; + generateBySavingsPlanId: (savingsPlanOrderId: string, savingsPlanId: string, benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, options?: GenerateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdOptionalParams) => PollerLike, BenefitUtilizationSummariesOperationStatus>; + generateBySavingsPlanOrderId: (savingsPlanOrderId: string, benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, options?: GenerateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdOptionalParams) => PollerLike, BenefitUtilizationSummariesOperationStatus>; +} // @public -export interface GenerateCostDetailsReportRequestDefinition { - billingPeriod?: string; - invoiceId?: string; - metric?: CostDetailsMetricType; - timePeriod?: CostDetailsTimePeriod; +export interface GenerateCostDetailsReportCreateOperationOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public -export interface GenerateDetailedCostReport { - beginCreateOperation(scope: string, parameters: GenerateDetailedCostReportDefinition, options?: GenerateDetailedCostReportCreateOperationOptionalParams): Promise, GenerateDetailedCostReportCreateOperationResponse>>; - beginCreateOperationAndWait(scope: string, parameters: GenerateDetailedCostReportDefinition, options?: GenerateDetailedCostReportCreateOperationOptionalParams): Promise; +export interface GenerateCostDetailsReportErrorResponse { + error?: ErrorDetails; } // @public -export interface GenerateDetailedCostReportCreateOperationHeaders { - azureAsyncOperation?: string; - azureConsumptionAsyncOperation?: string; - location?: string; - retryAfter?: number; +export interface GenerateCostDetailsReportGetOperationResultsOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public -export interface GenerateDetailedCostReportCreateOperationOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; - updateIntervalInMs?: number; +export interface GenerateCostDetailsReportOperations { + createOperation: (scope: string, parameters: GenerateCostDetailsReportRequestDefinition, options?: GenerateCostDetailsReportCreateOperationOptionalParams) => PollerLike, CostDetailsOperationResults>; + getOperationResults: (scope: string, operationId: string, options?: GenerateCostDetailsReportGetOperationResultsOptionalParams) => PollerLike, CostDetailsOperationResults>; } // @public -export type GenerateDetailedCostReportCreateOperationResponse = GenerateDetailedCostReportOperationResult; +export interface GenerateCostDetailsReportRequestDefinition { + billingPeriod?: string; + invoiceId?: string; + metric?: CostDetailsMetricType; + timePeriod?: CostDetailsTimePeriod; +} + +// @public +export interface GenerateDetailedCostReportCreateOperationOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} // @public export interface GenerateDetailedCostReportDefinition { @@ -889,55 +1127,46 @@ export interface GenerateDetailedCostReportErrorResponse { export type GenerateDetailedCostReportMetricType = string; // @public -export interface GenerateDetailedCostReportOperationResult { +export interface GenerateDetailedCostReportOperationResult extends ExtensionResource { downloadUrl?: string; readonly expiryTime?: Date; - id?: string; - name?: string; - type?: string; validTill?: Date; } // @public -export interface GenerateDetailedCostReportOperationResults { - beginGet(operationId: string, scope: string, options?: GenerateDetailedCostReportOperationResultsGetOptionalParams): Promise, GenerateDetailedCostReportOperationResultsGetResponse>>; - beginGetAndWait(operationId: string, scope: string, options?: GenerateDetailedCostReportOperationResultsGetOptionalParams): Promise; -} - -// @public -export interface GenerateDetailedCostReportOperationResultsGetOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface GenerateDetailedCostReportOperationResultsGetOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type GenerateDetailedCostReportOperationResultsGetResponse = GenerateDetailedCostReportOperationResult; +export interface GenerateDetailedCostReportOperationResultsOperations { + get: (operationId: string, scope: string, options?: GenerateDetailedCostReportOperationResultsGetOptionalParams) => PollerLike, GenerateDetailedCostReportOperationResult>; +} // @public -export interface GenerateDetailedCostReportOperationStatus { - get(operationId: string, scope: string, options?: GenerateDetailedCostReportOperationStatusGetOptionalParams): Promise; +export interface GenerateDetailedCostReportOperations { + createOperation: (scope: string, parameters: GenerateDetailedCostReportDefinition, options?: GenerateDetailedCostReportCreateOperationOptionalParams) => PollerLike, GenerateDetailedCostReportOperationResult>; } // @public -export interface GenerateDetailedCostReportOperationStatuses { +export interface GenerateDetailedCostReportOperationStatuses extends ExtensionResource { downloadUrl?: string; endTime?: string; error?: ErrorDetails; readonly expiryTime?: Date; - id?: string; - name?: string; startTime?: string; status?: Status; - type?: string; validTill?: Date; } // @public -export interface GenerateDetailedCostReportOperationStatusGetOptionalParams extends coreClient.OperationOptions { +export interface GenerateDetailedCostReportOperationStatusGetOptionalParams extends OperationOptions { } // @public -export type GenerateDetailedCostReportOperationStatusGetResponse = GenerateDetailedCostReportOperationStatuses; +export interface GenerateDetailedCostReportOperationStatusOperations { + get: (operationId: string, scope: string, options?: GenerateDetailedCostReportOperationStatusGetOptionalParams) => Promise; +} // @public export interface GenerateDetailedCostReportTimePeriod { @@ -946,45 +1175,20 @@ export interface GenerateDetailedCostReportTimePeriod { } // @public -export interface GenerateReservationDetailsReport { - beginByBillingAccountId(billingAccountId: string, startDate: string, endDate: string, options?: GenerateReservationDetailsReportByBillingAccountIdOptionalParams): Promise, GenerateReservationDetailsReportByBillingAccountIdResponse>>; - beginByBillingAccountIdAndWait(billingAccountId: string, startDate: string, endDate: string, options?: GenerateReservationDetailsReportByBillingAccountIdOptionalParams): Promise; - beginByBillingProfileId(billingAccountId: string, billingProfileId: string, startDate: string, endDate: string, options?: GenerateReservationDetailsReportByBillingProfileIdOptionalParams): Promise, GenerateReservationDetailsReportByBillingProfileIdResponse>>; - beginByBillingProfileIdAndWait(billingAccountId: string, billingProfileId: string, startDate: string, endDate: string, options?: GenerateReservationDetailsReportByBillingProfileIdOptionalParams): Promise; -} - -// @public -export interface GenerateReservationDetailsReportByBillingAccountIdHeaders { - location?: string; - retryAfter?: number; -} - -// @public -export interface GenerateReservationDetailsReportByBillingAccountIdOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface GenerateReservationDetailsReportByBillingAccountIdOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type GenerateReservationDetailsReportByBillingAccountIdResponse = OperationStatus; - -// @public -export interface GenerateReservationDetailsReportByBillingProfileIdHeaders { - location?: string; - retryAfter?: number; -} - -// @public -export interface GenerateReservationDetailsReportByBillingProfileIdOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface GenerateReservationDetailsReportByBillingProfileIdOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type GenerateReservationDetailsReportByBillingProfileIdResponse = OperationStatus; - -// @public -export function getContinuationToken(page: unknown): string | undefined; +export interface GenerateReservationDetailsReportOperations { + byBillingAccountId: (billingAccountId: string, startDate: string, endDate: string, options?: GenerateReservationDetailsReportByBillingAccountIdOptionalParams) => PollerLike, OperationStatus>; + byBillingProfileId: (billingAccountId: string, billingProfileId: string, startDate: string, endDate: string, options?: GenerateReservationDetailsReportByBillingProfileIdOptionalParams) => PollerLike, OperationStatus>; +} // @public export type Grain = string; @@ -1011,6 +1215,8 @@ export interface IncludedQuantityUtilizationSummaryProperties extends BenefitUti readonly utilizationPercentage?: number; } +export { isRestError } + // @public export enum KnownAccumulatedType { False = "false", @@ -1102,6 +1308,38 @@ export enum KnownBenefitKind { SavingsPlan = "SavingsPlan" } +// @public +export enum KnownBenefitUtilizationSummaryReportSchema { + AvgUtilizationPercentage = "AvgUtilizationPercentage", + BenefitId = "BenefitId", + BenefitOrderId = "BenefitOrderId", + BenefitType = "BenefitType", + Kind = "Kind", + MaxUtilizationPercentage = "MaxUtilizationPercentage", + MinUtilizationPercentage = "MinUtilizationPercentage", + UsageDate = "UsageDate", + UtilizedPercentage = "UtilizedPercentage" +} + +// @public +export enum KnownBudgetNotificationOperatorType { + EqualTo = "EqualTo", + GreaterThan = "GreaterThan", + GreaterThanOrEqualTo = "GreaterThanOrEqualTo", + LessThan = "LessThan" +} + +// @public +export enum KnownBudgetOperatorType { + In = "In" +} + +// @public +export enum KnownCategoryType { + Cost = "Cost", + ReservationUtilization = "ReservationUtilization" +} + // @public export enum KnownChartType { Area = "Area", @@ -1117,6 +1355,24 @@ export enum KnownCheckNameAvailabilityReason { Invalid = "Invalid" } +// @public +export enum KnownCompressionModeType { + Gzip = "gzip", + None = "none", + Snappy = "snappy" +} + +// @public +export enum KnownCostAllocationPolicyType { + FixedProportion = "FixedProportion" +} + +// @public +export enum KnownCostAllocationResourceType { + Dimension = "Dimension", + Tag = "Tag" +} + // @public export enum KnownCostDetailsDataFormat { CsvCostDetailsDataFormat = "Csv" @@ -1136,11 +1392,42 @@ export enum KnownCostDetailsStatusType { } // @public -export enum KnownCreatedByType { - Application = "Application", - Key = "Key", - ManagedIdentity = "ManagedIdentity", - User = "User" +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownCultureCode { + CsCz = "cs-cz", + DaDk = "da-dk", + DeDe = "de-de", + EnGb = "en-gb", + EnUs = "en-us", + EsEs = "es-es", + FrFr = "fr-fr", + HuHu = "hu-hu", + ItIt = "it-it", + JaJp = "ja-jp", + KoKr = "ko-kr", + NbNo = "nb-no", + NlNl = "nl-nl", + PlPl = "pl-pl", + PtBr = "pt-br", + PtPt = "pt-pt", + RuRu = "ru-ru", + SvSe = "sv-se", + TrTr = "tr-tr", + ZhCn = "zh-cn", + ZhTw = "zh-tw" +} + +// @public +export enum KnownDataOverwriteBehaviorType { + CreateNewReport = "CreateNewReport", + OverwritePreviousReport = "OverwritePreviousReport" } // @public @@ -1154,6 +1441,11 @@ export enum KnownDaysOfWeek { Wednesday = "Wednesday" } +// @public +export enum KnownDestinationType { + AzureBlob = "AzureBlob" +} + // @public export enum KnownExecutionStatus { Completed = "Completed", @@ -1175,6 +1467,11 @@ export enum KnownExecutionType { export enum KnownExportType { ActualCost = "ActualCost", AmortizedCost = "AmortizedCost", + FocusCost = "FocusCost", + PriceSheet = "PriceSheet", + ReservationDetails = "ReservationDetails", + ReservationRecommendations = "ReservationRecommendations", + ReservationTransactions = "ReservationTransactions", Usage = "Usage" } @@ -1189,6 +1486,13 @@ export enum KnownFileFormat { Csv = "Csv" } +// @public +export enum KnownFilterItemNames { + LookBackPeriod = "LookBackPeriod", + ReservationScope = "ReservationScope", + ResourceType = "ResourceType" +} + // @public export enum KnownForecastOperatorType { In = "In" @@ -1208,7 +1512,15 @@ export enum KnownForecastType { // @public export enum KnownFormatType { - Csv = "Csv" + Csv = "Csv", + Parquet = "Parquet" +} + +// @public +export enum KnownFrequency { + Daily = "Daily", + Monthly = "Monthly", + Weekly = "Weekly" } // @public @@ -1246,7 +1558,8 @@ export enum KnownGrainParameter { // @public export enum KnownGranularityType { - Daily = "Daily" + Daily = "Daily", + Monthly = "Monthly" } // @public @@ -1306,6 +1619,13 @@ export enum KnownQueryOperatorType { In = "In" } +// @public +export enum KnownReason { + AlreadyExists = "AlreadyExists", + Invalid = "Invalid", + Valid = "Valid" +} + // @public export enum KnownRecurrenceType { Annually = "Annually", @@ -1365,6 +1685,13 @@ export enum KnownReservationReportSchema { UsedHours = "UsedHours" } +// @public +export enum KnownRuleStatus { + Active = "Active", + NotActive = "NotActive", + Processing = "Processing" +} + // @public export enum KnownScheduledActionKind { Email = "Email", @@ -1391,28 +1718,68 @@ export enum KnownScope { Single = "Single" } +// @public +export enum KnownSettingsKind { + Taginheritance = "taginheritance" +} + +// @public +export enum KnownSettingType { + Taginheritance = "taginheritance" +} + // @public export enum KnownStatusType { Active = "Active", Inactive = "Inactive" } +// @public +export enum KnownSystemAssignedServiceIdentityType { + None = "None", + SystemAssigned = "SystemAssigned" +} + // @public export enum KnownTerm { P1Y = "P1Y", P3Y = "P3Y" } +// @public +export enum KnownThresholdType { + Actual = "Actual", + Forecasted = "Forecasted" +} + // @public export enum KnownTimeframeType { BillingMonthToDate = "BillingMonthToDate", Custom = "Custom", MonthToDate = "MonthToDate", + TheCurrentMonth = "TheCurrentMonth", TheLastBillingMonth = "TheLastBillingMonth", TheLastMonth = "TheLastMonth", WeekToDate = "WeekToDate" } +// @public +export enum KnownTimeGrainType { + Annually = "Annually", + BillingAnnual = "BillingAnnual", + BillingMonth = "BillingMonth", + BillingQuarter = "BillingQuarter", + Last30Days = "Last30Days", + Last7Days = "Last7Days", + Monthly = "Monthly", + Quarterly = "Quarterly" +} + +// @public +export enum KnownVersions { + V20250301 = "2025-03-01" +} + // @public export enum KnownWeeksOfMonth { First = "First", @@ -1435,9 +1802,52 @@ export type KpiType = string; // @public export type LookBackPeriod = string; +// @public +export interface MCAPriceSheetProperties { + readonly basePrice?: string; + readonly billingAccountID?: string; + readonly billingAccountName?: string; + readonly billingCurrency?: string; + readonly billingProfileId?: string; + readonly billingProfileName?: string; + readonly currency?: string; + readonly effectiveEndDate?: Date; + readonly effectiveStartDate?: Date; + readonly marketPrice?: string; + readonly meterCategory?: string; + readonly meterId?: string; + readonly meterName?: string; + readonly meterRegion?: string; + readonly meterSubCategory?: string; + readonly meterType?: string; + readonly priceType?: string; + readonly product?: string; + readonly productId?: string; + readonly productOrderName?: string; + readonly serviceFamily?: number; + readonly skuId?: string; + readonly term?: string; + readonly tierMinimumUnits?: string; + readonly unitOfMeasure?: string; + readonly unitPrice?: string; +} + // @public export type MetricType = string; +// @public +export interface Notification { + contactEmails: string[]; + contactGroups?: string[]; + contactRoles?: string[]; + enabled: boolean; + frequency?: Frequency; + locale?: CultureCode; + operator: BudgetNotificationOperatorType; + threshold: number; + thresholdType?: ThresholdType; +} + // @public export interface NotificationProperties { language?: string; @@ -1465,30 +1875,14 @@ export interface OperationDisplay { } // @public -export interface OperationListResult { - readonly nextLink?: string; - readonly value?: CostManagementOperation[]; -} - -// @public -export interface Operations { - list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +export interface OperationsListOptionalParams extends OperationOptions { } // @public -export type OperationsListNextResponse = OperationListResult; - -// @public -export interface OperationsListOptionalParams extends coreClient.OperationOptions { +export interface OperationsOperations { + list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; } -// @public -export type OperationsListResponse = OperationListResult; - // @public export interface OperationStatus { reportUrl?: ReservationReportSchema; @@ -1506,62 +1900,57 @@ export type OperatorType = string; export type Origin = string; // @public -export interface PivotProperties { - name?: string; - type?: PivotType; +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; + next(): Promise>; } // @public -export type PivotType = string; +export interface PageSettings { + continuationToken?: string; +} // @public -export interface PriceSheet { - beginDownload(billingAccountName: string, billingProfileName: string, invoiceName: string, options?: PriceSheetDownloadOptionalParams): Promise, PriceSheetDownloadResponse>>; - beginDownloadAndWait(billingAccountName: string, billingProfileName: string, invoiceName: string, options?: PriceSheetDownloadOptionalParams): Promise; - beginDownloadByBillingProfile(billingAccountName: string, billingProfileName: string, options?: PriceSheetDownloadByBillingProfileOptionalParams): Promise, PriceSheetDownloadByBillingProfileResponse>>; - beginDownloadByBillingProfileAndWait(billingAccountName: string, billingProfileName: string, options?: PriceSheetDownloadByBillingProfileOptionalParams): Promise; +export interface PivotProperties { + name?: string; + type?: PivotType; } // @public -export interface PriceSheetDownloadByBillingProfileHeaders { - location?: string; - oDataEntityId?: string; - retryAfter?: string; -} +export type PivotType = string; // @public -export interface PriceSheetDownloadByBillingProfileOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface PriceSheetDownloadByBillingAccountOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type PriceSheetDownloadByBillingProfileResponse = DownloadURL; - -// @public -export interface PriceSheetDownloadHeaders { - location?: string; - oDataEntityId?: string; - retryAfter?: string; +export interface PriceSheetDownloadByBillingProfileOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public -export interface PriceSheetDownloadOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface PriceSheetDownloadByInvoiceOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type PriceSheetDownloadResponse = DownloadURL; +export interface PricesheetDownloadProperties { + downloadFileProperties?: MCAPriceSheetProperties; + downloadUrl?: string; + readonly expiryTime?: Date; +} // @public -export interface ProxyResource extends Resource { +export interface PriceSheetOperations { + downloadByBillingAccount: (billingAccountId: string, billingPeriodName: string, options?: PriceSheetDownloadByBillingAccountOptionalParams) => PollerLike, OperationStatus>; + downloadByBillingProfile: (billingAccountName: string, billingProfileName: string, options?: PriceSheetDownloadByBillingProfileOptionalParams) => PollerLike, PricesheetDownloadProperties>; + downloadByInvoice: (billingAccountName: string, billingProfileName: string, invoiceName: string, options?: PriceSheetDownloadByInvoiceOptionalParams) => PollerLike, DownloadURL>; } // @public -export interface Query { - usage(scope: string, parameters: QueryDefinition, options?: QueryUsageOptionalParams): Promise; - usageByExternalCloudProviderType(externalCloudProviderType: ExternalCloudProviderType, externalCloudProviderId: string, parameters: QueryDefinition, options?: QueryUsageByExternalCloudProviderTypeOptionalParams): Promise; +export interface ProxyResource extends Resource { } // @public @@ -1588,9 +1977,7 @@ export interface QueryComparisonExpression { // @public export interface QueryDataset { - aggregation?: { - [propertyName: string]: QueryAggregation; - }; + aggregation?: Record; configuration?: QueryDatasetConfiguration; filter?: QueryFilter; granularity?: GranularityType; @@ -1624,9 +2011,22 @@ export interface QueryGrouping { type: QueryColumnType; } +// @public +export interface QueryOperations { + usage: (scope: string, parameters: QueryDefinition, options?: QueryUsageOptionalParams) => Promise; + usageByExternalCloudProviderType: (externalCloudProviderType: ExternalCloudProviderType, externalCloudProviderId: string, parameters: QueryDefinition, options?: QueryUsageByExternalCloudProviderTypeOptionalParams) => Promise; +} + // @public export type QueryOperatorType = string; +// @public +export interface QueryProperties { + columns?: QueryColumn[]; + nextLink?: string; + rows?: any[][]; +} + // @public export interface QueryResult extends CostManagementResource { columns?: QueryColumn[]; @@ -1641,18 +2041,15 @@ export interface QueryTimePeriod { } // @public -export interface QueryUsageByExternalCloudProviderTypeOptionalParams extends coreClient.OperationOptions { +export interface QueryUsageByExternalCloudProviderTypeOptionalParams extends OperationOptions { } // @public -export type QueryUsageByExternalCloudProviderTypeResponse = QueryResult; - -// @public -export interface QueryUsageOptionalParams extends coreClient.OperationOptions { +export interface QueryUsageOptionalParams extends OperationOptions { } // @public -export type QueryUsageResponse = QueryResult; +export type Reason = string; // @public export interface RecommendationUsageDetails { @@ -1678,9 +2075,7 @@ export interface ReportConfigComparisonExpression { // @public export interface ReportConfigDataset { - aggregation?: { - [propertyName: string]: ReportConfigAggregation; - }; + aggregation?: Record; configuration?: ReportConfigDatasetConfiguration; filter?: ReportConfigFilter; granularity?: ReportGranularityType; @@ -1693,6 +2088,15 @@ export interface ReportConfigDatasetConfiguration { columns?: string[]; } +// @public +export interface ReportConfigDefinition { + dataSet?: ReportConfigDataset; + includeMonetaryCommitment?: boolean; + timeframe: ReportTimeframeType; + timePeriod?: ReportConfigTimePeriod; + type: ReportType; +} + // @public export interface ReportConfigFilter { and?: ReportConfigFilter[]; @@ -1725,6 +2129,18 @@ export interface ReportConfigTimePeriod { // @public export type ReportGranularityType = string; +// @public +export interface ReportManifest { + blobCount?: number; + blobs?: BlobInfo[]; + byteCount?: number; + compressData?: boolean; + dataFormat?: CostDetailsDataFormat; + manifestVersion?: string; + requestBody?: GenerateCostDetailsReportRequestDefinition; + requestScope?: string; +} + // @public export type ReportOperationStatusType = string; @@ -1734,6 +2150,18 @@ export type ReportTimeframeType = string; // @public export type ReportType = string; +// @public +export interface ReportURL { + reportUrl?: ReservationReportSchema; + validUntil?: Date; +} + +// @public +export interface RequestContext { + requestBody?: GenerateCostDetailsReportRequestDefinition; + requestScope?: string; +} + // @public export type ReservationReportSchema = string; @@ -1741,9 +2169,25 @@ export type ReservationReportSchema = string; export interface Resource { readonly id?: string; readonly name?: string; + readonly systemData?: SystemData; readonly type?: string; } +export { RestError } + +// @public +export function restorePoller(client: CostManagementClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; + +// @public (undocumented) +export interface RestorePollerOptions extends OperationOptions { + abortSignal?: AbortSignalLike; + processResponseBody?: (result: TResponse) => Promise; + updateIntervalInMs?: number; +} + +// @public +export type RuleStatus = string; + // @public export interface SavingsPlanUtilizationSummary extends BenefitUtilizationSummary { readonly armSkuName?: string; @@ -1765,9 +2209,11 @@ export interface SavingsPlanUtilizationSummaryProperties extends BenefitUtilizat } // @public -export interface ScheduledAction extends ScheduledActionProxyResource { +export interface ScheduledAction extends ProxyResource { displayName?: string; + eTag?: string; fileDestination?: FileDestination; + kind?: ScheduledActionKind; notification?: NotificationProperties; notificationEmail?: string; schedule?: ScheduleProperties; @@ -1780,143 +2226,147 @@ export interface ScheduledAction extends ScheduledActionProxyResource { export type ScheduledActionKind = string; // @public -export interface ScheduledActionListResult { - readonly nextLink?: string; - readonly value?: ScheduledAction[]; +export interface ScheduledActionProperties { + displayName: string; + fileDestination?: FileDestination; + notification: NotificationProperties; + notificationEmail?: string; + schedule: ScheduleProperties; + scope?: string; + status: ScheduledActionStatus; + viewId: string; } // @public -export interface ScheduledActionProxyResource extends ProxyResource { - readonly eTag?: string; - kind?: ScheduledActionKind; - readonly systemData?: SystemData; +export interface ScheduledActionsCheckNameAvailabilityByScopeOptionalParams extends OperationOptions { } // @public -export interface ScheduledActions { - checkNameAvailability(checkNameAvailabilityRequest: CheckNameAvailabilityRequest, options?: ScheduledActionsCheckNameAvailabilityOptionalParams): Promise; - checkNameAvailabilityByScope(scope: string, checkNameAvailabilityRequest: CheckNameAvailabilityRequest, options?: ScheduledActionsCheckNameAvailabilityByScopeOptionalParams): Promise; - createOrUpdate(name: string, scheduledAction: ScheduledAction, options?: ScheduledActionsCreateOrUpdateOptionalParams): Promise; - createOrUpdateByScope(scope: string, name: string, scheduledAction: ScheduledAction, options?: ScheduledActionsCreateOrUpdateByScopeOptionalParams): Promise; - delete(name: string, options?: ScheduledActionsDeleteOptionalParams): Promise; - deleteByScope(scope: string, name: string, options?: ScheduledActionsDeleteByScopeOptionalParams): Promise; - get(name: string, options?: ScheduledActionsGetOptionalParams): Promise; - getByScope(scope: string, name: string, options?: ScheduledActionsGetByScopeOptionalParams): Promise; - list(options?: ScheduledActionsListOptionalParams): PagedAsyncIterableIterator; - listByScope(scope: string, options?: ScheduledActionsListByScopeOptionalParams): PagedAsyncIterableIterator; - run(name: string, options?: ScheduledActionsRunOptionalParams): Promise; - runByScope(scope: string, name: string, options?: ScheduledActionsRunByScopeOptionalParams): Promise; +export interface ScheduledActionsCheckNameAvailabilityOptionalParams extends OperationOptions { } // @public -export interface ScheduledActionsCheckNameAvailabilityByScopeOptionalParams extends coreClient.OperationOptions { +export interface ScheduledActionsCreateOrUpdateByScopeOptionalParams extends OperationOptions { + ifMatch?: string; } // @public -export type ScheduledActionsCheckNameAvailabilityByScopeResponse = CheckNameAvailabilityResponse; - -// @public -export interface ScheduledActionsCheckNameAvailabilityOptionalParams extends coreClient.OperationOptions { +export interface ScheduledActionsCreateOrUpdateOptionalParams extends OperationOptions { + ifMatch?: string; } // @public -export type ScheduledActionsCheckNameAvailabilityResponse = CheckNameAvailabilityResponse; +export interface ScheduledActionsDeleteByScopeOptionalParams extends OperationOptions { +} // @public -export interface ScheduledActionsCreateOrUpdateByScopeOptionalParams extends coreClient.OperationOptions { - ifMatch?: string; +export interface ScheduledActionsDeleteOptionalParams extends OperationOptions { } // @public -export type ScheduledActionsCreateOrUpdateByScopeResponse = ScheduledAction; +export interface ScheduledActionsGetByScopeOptionalParams extends OperationOptions { +} // @public -export interface ScheduledActionsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - ifMatch?: string; +export interface ScheduledActionsGetOptionalParams extends OperationOptions { } // @public -export type ScheduledActionsCreateOrUpdateResponse = ScheduledAction; +export interface ScheduledActionsListByScopeOptionalParams extends OperationOptions { + filter?: string; +} // @public -export interface ScheduledActionsDeleteByScopeOptionalParams extends coreClient.OperationOptions { +export interface ScheduledActionsListOptionalParams extends OperationOptions { + filter?: string; } // @public -export interface ScheduledActionsDeleteOptionalParams extends coreClient.OperationOptions { +export interface ScheduledActionsOperations { + checkNameAvailability: (checkNameAvailabilityRequest: CheckNameAvailabilityRequest, options?: ScheduledActionsCheckNameAvailabilityOptionalParams) => Promise; + checkNameAvailabilityByScope: (scope: string, checkNameAvailabilityRequest: CheckNameAvailabilityRequest, options?: ScheduledActionsCheckNameAvailabilityByScopeOptionalParams) => Promise; + createOrUpdate: (name: string, scheduledAction: ScheduledAction, options?: ScheduledActionsCreateOrUpdateOptionalParams) => Promise; + createOrUpdateByScope: (scope: string, name: string, scheduledAction: ScheduledAction, options?: ScheduledActionsCreateOrUpdateByScopeOptionalParams) => Promise; + delete: (name: string, options?: ScheduledActionsDeleteOptionalParams) => Promise; + deleteByScope: (scope: string, name: string, options?: ScheduledActionsDeleteByScopeOptionalParams) => Promise; + get: (name: string, options?: ScheduledActionsGetOptionalParams) => Promise; + getByScope: (scope: string, name: string, options?: ScheduledActionsGetByScopeOptionalParams) => Promise; + list: (options?: ScheduledActionsListOptionalParams) => PagedAsyncIterableIterator; + listByScope: (scope: string, options?: ScheduledActionsListByScopeOptionalParams) => PagedAsyncIterableIterator; + run: (name: string, options?: ScheduledActionsRunOptionalParams) => Promise; + runByScope: (scope: string, name: string, options?: ScheduledActionsRunByScopeOptionalParams) => Promise; } // @public -export interface ScheduledActionsGetByScopeOptionalParams extends coreClient.OperationOptions { +export interface ScheduledActionsRunByScopeOptionalParams extends OperationOptions { } // @public -export type ScheduledActionsGetByScopeResponse = ScheduledAction; +export interface ScheduledActionsRunOptionalParams extends OperationOptions { +} // @public -export interface ScheduledActionsGetOptionalParams extends coreClient.OperationOptions { -} +export type ScheduledActionStatus = string; // @public -export type ScheduledActionsGetResponse = ScheduledAction; +export type ScheduleFrequency = string; // @public -export interface ScheduledActionsListByScopeNextOptionalParams extends coreClient.OperationOptions { +export interface ScheduleProperties { + dayOfMonth?: number; + daysOfWeek?: DaysOfWeek[]; + endDate: Date; + frequency: ScheduleFrequency; + hourOfDay?: number; + startDate: Date; + weeksOfMonth?: WeeksOfMonth[]; } // @public -export type ScheduledActionsListByScopeNextResponse = ScheduledActionListResult; +export type Scope = string; // @public -export interface ScheduledActionsListByScopeOptionalParams extends coreClient.OperationOptions { - filter?: string; +export interface Setting extends ProxyResource { + kind: SettingsKind; } // @public -export type ScheduledActionsListByScopeResponse = ScheduledActionListResult; - -// @public -export interface ScheduledActionsListNextOptionalParams extends coreClient.OperationOptions { +export interface SettingsCreateOrUpdateByScopeOptionalParams extends OperationOptions { } // @public -export type ScheduledActionsListNextResponse = ScheduledActionListResult; +export interface SettingsDeleteByScopeOptionalParams extends OperationOptions { +} // @public -export interface ScheduledActionsListOptionalParams extends coreClient.OperationOptions { - filter?: string; +export interface SettingsGetByScopeOptionalParams extends OperationOptions { } // @public -export type ScheduledActionsListResponse = ScheduledActionListResult; +export type SettingsKind = string; // @public -export interface ScheduledActionsRunByScopeOptionalParams extends coreClient.OperationOptions { +export interface SettingsListOptionalParams extends OperationOptions { } // @public -export interface ScheduledActionsRunOptionalParams extends coreClient.OperationOptions { +export interface SettingsListResult { + readonly value?: SettingUnion[]; } // @public -export type ScheduledActionStatus = string; - -// @public -export type ScheduleFrequency = string; +export interface SettingsOperations { + createOrUpdateByScope: (scope: string, typeParam: SettingType, setting: SettingUnion, options?: SettingsCreateOrUpdateByScopeOptionalParams) => Promise; + deleteByScope: (scope: string, typeParam: SettingType, options?: SettingsDeleteByScopeOptionalParams) => Promise; + getByScope: (scope: string, typeParam: SettingType, options?: SettingsGetByScopeOptionalParams) => Promise; + list: (scope: string, options?: SettingsListOptionalParams) => Promise; +} // @public -export interface ScheduleProperties { - dayOfMonth?: number; - daysOfWeek?: DaysOfWeek[]; - endDate: Date; - frequency: ScheduleFrequency; - hourOfDay?: number; - startDate: Date; - weeksOfMonth?: WeeksOfMonth[]; -} +export type SettingType = string; // @public -export type Scope = string; +export type SettingUnion = TagInheritanceSetting | Setting; // @public export interface SharedScopeBenefitRecommendationProperties extends BenefitRecommendationProperties { @@ -1930,6 +2380,11 @@ export interface SingleScopeBenefitRecommendationProperties extends BenefitRecom readonly subscriptionId?: string; } +// @public +export interface SourceCostAllocationResource extends CostAllocationResource { + values: string[]; +} + // @public export interface Status { status?: ReportOperationStatusType; @@ -1938,6 +2393,16 @@ export interface Status { // @public export type StatusType = string; +// @public +export interface SystemAssignedServiceIdentity { + readonly principalId?: string; + readonly tenantId?: string; + type: SystemAssignedServiceIdentityType; +} + +// @public +export type SystemAssignedServiceIdentityType = string; + // @public export interface SystemData { createdAt?: Date; @@ -1948,114 +2413,116 @@ export interface SystemData { lastModifiedByType?: CreatedByType; } +// @public +export interface TagInheritanceProperties { + preferContainerTags: boolean; +} + +// @public +export interface TagInheritanceSetting extends Setting { + kind: "taginheritance"; + properties?: TagInheritanceProperties; +} + +// @public +export interface TargetCostAllocationResource extends CostAllocationResource { + policyType: CostAllocationPolicyType; + values: CostAllocationProportion[]; +} + // @public export type Term = string; +// @public +export type ThresholdType = string; + // @public export type TimeframeType = string; // @public -export interface View extends CostManagementProxyResource { +export type TimeGrainType = string; + +// @public +export interface View extends ProxyResource { + accumulated?: AccumulatedType; + chart?: ChartType; + readonly createdOn?: Date; + readonly currency?: string; + dateRange?: string; + displayName?: string; + eTag?: string; + kpis?: KpiProperties[]; + metric?: MetricType; + modifiedOn?: Date; + pivots?: PivotProperties[]; + query?: ReportConfigDefinition; + scope?: string; +} + +// @public +export interface ViewProperties { accumulated?: AccumulatedType; chart?: ChartType; readonly createdOn?: Date; readonly currency?: string; dataSet?: ReportConfigDataset; - readonly dateRange?: string; + dateRange?: string; displayName?: string; includeMonetaryCommitment?: boolean; kpis?: KpiProperties[]; metric?: MetricType; - readonly modifiedOn?: Date; + modifiedOn?: Date; pivots?: PivotProperties[]; scope?: string; timeframe?: ReportTimeframeType; timePeriod?: ReportConfigTimePeriod; - typePropertiesQueryType?: ReportType; -} - -// @public -export interface ViewListResult { - readonly nextLink?: string; - readonly value?: View[]; -} - -// @public -export interface Views { - createOrUpdate(viewName: string, parameters: View, options?: ViewsCreateOrUpdateOptionalParams): Promise; - createOrUpdateByScope(scope: string, viewName: string, parameters: View, options?: ViewsCreateOrUpdateByScopeOptionalParams): Promise; - delete(viewName: string, options?: ViewsDeleteOptionalParams): Promise; - deleteByScope(scope: string, viewName: string, options?: ViewsDeleteByScopeOptionalParams): Promise; - get(viewName: string, options?: ViewsGetOptionalParams): Promise; - getByScope(scope: string, viewName: string, options?: ViewsGetByScopeOptionalParams): Promise; - list(options?: ViewsListOptionalParams): PagedAsyncIterableIterator; - listByScope(scope: string, options?: ViewsListByScopeOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface ViewsCreateOrUpdateByScopeOptionalParams extends coreClient.OperationOptions { + type?: ReportType; } // @public -export type ViewsCreateOrUpdateByScopeResponse = View; - -// @public -export interface ViewsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +export interface ViewsCreateOrUpdateByScopeOptionalParams extends OperationOptions { } // @public -export type ViewsCreateOrUpdateResponse = View; - -// @public -export interface ViewsDeleteByScopeOptionalParams extends coreClient.OperationOptions { +export interface ViewsCreateOrUpdateOptionalParams extends OperationOptions { } // @public -export interface ViewsDeleteOptionalParams extends coreClient.OperationOptions { +export interface ViewsDeleteByScopeOptionalParams extends OperationOptions { } // @public -export interface ViewsGetByScopeOptionalParams extends coreClient.OperationOptions { +export interface ViewsDeleteOptionalParams extends OperationOptions { } // @public -export type ViewsGetByScopeResponse = View; - -// @public -export interface ViewsGetOptionalParams extends coreClient.OperationOptions { +export interface ViewsGetByScopeOptionalParams extends OperationOptions { } // @public -export type ViewsGetResponse = View; - -// @public -export interface ViewsListByScopeNextOptionalParams extends coreClient.OperationOptions { +export interface ViewsGetOptionalParams extends OperationOptions { } // @public -export type ViewsListByScopeNextResponse = ViewListResult; - -// @public -export interface ViewsListByScopeOptionalParams extends coreClient.OperationOptions { +export interface ViewsListByScopeOptionalParams extends OperationOptions { } // @public -export type ViewsListByScopeResponse = ViewListResult; - -// @public -export interface ViewsListNextOptionalParams extends coreClient.OperationOptions { +export interface ViewsListOptionalParams extends OperationOptions { } // @public -export type ViewsListNextResponse = ViewListResult; - -// @public -export interface ViewsListOptionalParams extends coreClient.OperationOptions { +export interface ViewsOperations { + createOrUpdate: (viewName: string, parameters: View, options?: ViewsCreateOrUpdateOptionalParams) => Promise; + createOrUpdateByScope: (scope: string, viewName: string, parameters: View, options?: ViewsCreateOrUpdateByScopeOptionalParams) => Promise; + delete: (viewName: string, options?: ViewsDeleteOptionalParams) => Promise; + deleteByScope: (scope: string, viewName: string, options?: ViewsDeleteByScopeOptionalParams) => Promise; + get: (viewName: string, options?: ViewsGetOptionalParams) => Promise; + getByScope: (scope: string, viewName: string, options?: ViewsGetByScopeOptionalParams) => Promise; + list: (options?: ViewsListOptionalParams) => PagedAsyncIterableIterator; + listByScope: (scope: string, options?: ViewsListByScopeOptionalParams) => PagedAsyncIterableIterator; } -// @public -export type ViewsListResponse = ViewListResult; - // @public export type WeeksOfMonth = string; diff --git a/sdk/cost-management/arm-costmanagement/sample.env b/sdk/cost-management/arm-costmanagement/sample.env index 672847a3fea0..508439fc7d62 100644 --- a/sdk/cost-management/arm-costmanagement/sample.env +++ b/sdk/cost-management/arm-costmanagement/sample.env @@ -1,4 +1 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/alertsDismissSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/alertsDismissSample.ts index 9e200801be25..729daf69a91b 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/alertsDismissSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/alertsDismissSample.ts @@ -1,42 +1,40 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Dismisses the specified alert - * - * @summary Dismisses the specified alert - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DismissResourceGroupAlerts.json - */ - -import type { DismissAlertPayload } from "@azure/arm-costmanagement"; import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to dismisses the specified alert + * + * @summary dismisses the specified alert + * x-ms-original-file: 2025-03-01/DismissResourceGroupAlerts.json + */ async function patchResourceGroupAlerts(): Promise { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"; - const alertId = "22222222-2222-2222-2222-222222222222"; - const parameters: DismissAlertPayload = { status: "Dismissed" }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.dismiss(scope, alertId, parameters); + const result = await client.alerts.dismiss( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", + "22222222-2222-2222-2222-222222222222", + { status: "Dismissed" }, + ); console.log(result); } /** - * This sample demonstrates how to Dismisses the specified alert + * This sample demonstrates how to dismisses the specified alert * - * @summary Dismisses the specified alert - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DismissSubscriptionAlerts.json + * @summary dismisses the specified alert + * x-ms-original-file: 2025-03-01/DismissSubscriptionAlerts.json */ async function patchSubscriptionAlerts(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const alertId = "22222222-2222-2222-2222-222222222222"; - const parameters: DismissAlertPayload = { status: "Dismissed" }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.dismiss(scope, alertId, parameters); + const result = await client.alerts.dismiss( + "subscriptions/00000000-0000-0000-0000-000000000000", + "22222222-2222-2222-2222-222222222222", + { status: "Dismissed" }, + ); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/alertsGetSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/alertsGetSample.ts index e05b2d22b91d..3549f35f0a5a 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/alertsGetSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/alertsGetSample.ts @@ -1,39 +1,38 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Gets the alert for the scope by alert ID. - * - * @summary Gets the alert for the scope by alert ID. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SingleResourceGroupAlert.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to gets the alert for the scope by alert ID. + * + * @summary gets the alert for the scope by alert ID. + * x-ms-original-file: 2025-03-01/SingleResourceGroupAlert.json + */ async function singleResourceGroupAlerts(): Promise { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"; - const alertId = "22222222-2222-2222-2222-222222222222"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.get(scope, alertId); + const result = await client.alerts.get( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", + "22222222-2222-2222-2222-222222222222", + ); console.log(result); } /** - * This sample demonstrates how to Gets the alert for the scope by alert ID. + * This sample demonstrates how to gets the alert for the scope by alert ID. * - * @summary Gets the alert for the scope by alert ID. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SingleSubscriptionAlert.json + * @summary gets the alert for the scope by alert ID. + * x-ms-original-file: 2025-03-01/SingleSubscriptionAlert.json */ async function singleSubscriptionAlerts(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const alertId = "22222222-2222-2222-2222-222222222222"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.get(scope, alertId); + const result = await client.alerts.get( + "subscriptions/00000000-0000-0000-0000-000000000000", + "22222222-2222-2222-2222-222222222222", + ); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/alertsListExternalSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/alertsListExternalSample.ts index 9cd10561a9a9..8f4d35082df1 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/alertsListExternalSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/alertsListExternalSample.ts @@ -1,44 +1,32 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Lists the Alerts for external cloud provider type defined. - * - * @summary Lists the Alerts for external cloud provider type defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalBillingAccountAlerts.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to lists the Alerts for external cloud provider type defined. + * + * @summary lists the Alerts for external cloud provider type defined. + * x-ms-original-file: 2025-03-01/ExternalBillingAccountAlerts.json + */ async function externalBillingAccountAlerts(): Promise { - const externalCloudProviderType = "externalBillingAccounts"; - const externalCloudProviderId = "100"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.listExternal( - externalCloudProviderType, - externalCloudProviderId, - ); + const result = await client.alerts.listExternal("externalBillingAccounts", "100"); console.log(result); } /** - * This sample demonstrates how to Lists the Alerts for external cloud provider type defined. + * This sample demonstrates how to lists the Alerts for external cloud provider type defined. * - * @summary Lists the Alerts for external cloud provider type defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalSubscriptionAlerts.json + * @summary lists the Alerts for external cloud provider type defined. + * x-ms-original-file: 2025-03-01/ExternalSubscriptionAlerts.json */ async function externalSubscriptionAlerts(): Promise { - const externalCloudProviderType = "externalSubscriptions"; - const externalCloudProviderId = "100"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.listExternal( - externalCloudProviderType, - externalCloudProviderId, - ); + const result = await client.alerts.listExternal("externalSubscriptions", "100"); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/alertsListSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/alertsListSample.ts index 24300e155ae5..c7c3bd90935e 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/alertsListSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/alertsListSample.ts @@ -1,108 +1,107 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Lists the alerts for scope defined. - * - * @summary Lists the alerts for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountAlerts.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to lists the alerts for scope defined. + * + * @summary lists the alerts for scope defined. + * x-ms-original-file: 2025-03-01/BillingAccountAlerts.json + */ async function billingAccountAlerts(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.list(scope); + const result = await client.alerts.list("providers/Microsoft.Billing/billingAccounts/12345-6789"); console.log(result); } /** - * This sample demonstrates how to Lists the alerts for scope defined. + * This sample demonstrates how to lists the alerts for scope defined. * - * @summary Lists the alerts for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingProfileAlerts.json + * @summary lists the alerts for scope defined. + * x-ms-original-file: 2025-03-01/BillingProfileAlerts.json */ async function billingProfileAlerts(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.list(scope); + const result = await client.alerts.list( + "providers/Microsoft.Billing/billingAccounts/12345-6789/billingProfiles/13579", + ); console.log(result); } /** - * This sample demonstrates how to Lists the alerts for scope defined. + * This sample demonstrates how to lists the alerts for scope defined. * - * @summary Lists the alerts for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentAlerts.json + * @summary lists the alerts for scope defined. + * x-ms-original-file: 2025-03-01/DepartmentAlerts.json */ async function departmentAlerts(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.list(scope); + const result = await client.alerts.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123", + ); console.log(result); } /** - * This sample demonstrates how to Lists the alerts for scope defined. + * This sample demonstrates how to lists the alerts for scope defined. * - * @summary Lists the alerts for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountAlerts.json + * @summary lists the alerts for scope defined. + * x-ms-original-file: 2025-03-01/EnrollmentAccountAlerts.json */ async function enrollmentAccountAlerts(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.list(scope); + const result = await client.alerts.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456", + ); console.log(result); } /** - * This sample demonstrates how to Lists the alerts for scope defined. + * This sample demonstrates how to lists the alerts for scope defined. * - * @summary Lists the alerts for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/InvoiceSectionAlerts.json + * @summary lists the alerts for scope defined. + * x-ms-original-file: 2025-03-01/InvoiceSectionAlerts.json */ async function invoiceSectionAlerts(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.list(scope); + const result = await client.alerts.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", + ); console.log(result); } /** - * This sample demonstrates how to Lists the alerts for scope defined. + * This sample demonstrates how to lists the alerts for scope defined. * - * @summary Lists the alerts for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ResourceGroupAlerts.json + * @summary lists the alerts for scope defined. + * x-ms-original-file: 2025-03-01/ResourceGroupAlerts.json */ async function resourceGroupAlerts(): Promise { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.list(scope); + const result = await client.alerts.list( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", + ); console.log(result); } /** - * This sample demonstrates how to Lists the alerts for scope defined. + * This sample demonstrates how to lists the alerts for scope defined. * - * @summary Lists the alerts for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SubscriptionAlerts.json + * @summary lists the alerts for scope defined. + * x-ms-original-file: 2025-03-01/SubscriptionAlerts.json */ async function subscriptionAlerts(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.list(scope); + const result = await client.alerts.list("subscriptions/00000000-0000-0000-0000-000000000000"); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/benefitRecommendationsListSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/benefitRecommendationsListSample.ts index c262a2e96e8c..d0ebfd4394e3 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/benefitRecommendationsListSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/benefitRecommendationsListSample.ts @@ -1,29 +1,29 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to List of recommendations for purchasing savings plan. - * - * @summary List of recommendations for purchasing savings plan. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitRecommendationsByBillingAccount.json - */ - -import type { BenefitRecommendationsListOptionalParams } from "@azure/arm-costmanagement"; import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to list of recommendations for purchasing savings plan. + * + * @summary list of recommendations for purchasing savings plan. + * x-ms-original-file: 2025-03-01/BenefitRecommendationsByBillingAccount.json + */ async function benefitRecommendationsBillingAccountList(): Promise { - const filter = "properties/lookBackPeriod eq 'Last7Days' AND properties/term eq 'P1Y'"; - const expand = "properties/usage,properties/allRecommendationDetails"; - const billingScope = "providers/Microsoft.Billing/billingAccounts/123456"; - const options: BenefitRecommendationsListOptionalParams = { filter, expand }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.benefitRecommendations.list(billingScope, options)) { + for await (const item of client.benefitRecommendations.list( + "providers/Microsoft.Billing/billingAccounts/123456", + { + filter: "properties/lookBackPeriod eq 'Last7Days' AND properties/term eq 'P1Y'", + expand: "properties/usage,properties/allRecommendationDetails", + }, + )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/benefitUtilizationSummariesListByBillingAccountIdSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/benefitUtilizationSummariesListByBillingAccountIdSample.ts index ce1cdcf11672..3bed0018763d 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/benefitUtilizationSummariesListByBillingAccountIdSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/benefitUtilizationSummariesListByBillingAccountIdSample.ts @@ -1,33 +1,25 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. - * - * @summary Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitUtilizationSummaries/SavingsPlan-BillingAccount.json - */ - -import type { BenefitUtilizationSummariesListByBillingAccountIdOptionalParams } from "@azure/arm-costmanagement"; import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. + * + * @summary lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/SavingsPlan-BillingAccount.json + */ async function savingsPlanUtilizationSummariesBillingAccount(): Promise { - const billingAccountId = "12345"; - const filter = "properties/usageDate ge 2022-10-15 and properties/usageDate le 2022-10-18"; - const options: BenefitUtilizationSummariesListByBillingAccountIdOptionalParams = { - filter, - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.benefitUtilizationSummaries.listByBillingAccountId( - billingAccountId, - options, - )) { + for await (const item of client.benefitUtilizationSummaries.listByBillingAccountId("12345", { + filter: "properties/usageDate ge 2022-10-15 and properties/usageDate le 2022-10-18", + })) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/benefitUtilizationSummariesListByBillingProfileIdSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/benefitUtilizationSummariesListByBillingProfileIdSample.ts index bf26fb98f6e7..6556886148a9 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/benefitUtilizationSummariesListByBillingProfileIdSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/benefitUtilizationSummariesListByBillingProfileIdSample.ts @@ -1,36 +1,27 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. - * - * @summary Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitUtilizationSummaries/SavingsPlan-BillingProfile.json - */ - -import type { BenefitUtilizationSummariesListByBillingProfileIdOptionalParams } from "@azure/arm-costmanagement"; import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. + * + * @summary lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/SavingsPlan-BillingProfile.json + */ async function savingsPlanUtilizationSummariesBillingProfile(): Promise { - const billingAccountId = - "c0a00000-0e04-5ee3-000e-f0c6e00000ec:c0a00000-0e04-5ee3-000e-f0c6e00000ec"; - const billingProfileId = "200e5e90-000e-4960-8dcd-8d00a02db000"; - const filter = "properties/usageDate ge 2022-10-15 and properties/usageDate le 2022-10-18"; - const options: BenefitUtilizationSummariesListByBillingProfileIdOptionalParams = { - filter, - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); for await (const item of client.benefitUtilizationSummaries.listByBillingProfileId( - billingAccountId, - billingProfileId, - options, + "c0a00000-0e04-5ee3-000e-f0c6e00000ec:c0a00000-0e04-5ee3-000e-f0c6e00000ec", + "200e5e90-000e-4960-8dcd-8d00a02db000", + { filter: "properties/usageDate ge 2022-10-15 and properties/usageDate le 2022-10-18" }, )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/benefitUtilizationSummariesListBySavingsPlanIdSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/benefitUtilizationSummariesListBySavingsPlanIdSample.ts index 2c00b2f15948..9f99cdc708d2 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/benefitUtilizationSummariesListBySavingsPlanIdSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/benefitUtilizationSummariesListBySavingsPlanIdSample.ts @@ -1,29 +1,26 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Lists the savings plan utilization summaries for daily or monthly grain. - * - * @summary Lists the savings plan utilization summaries for daily or monthly grain. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanId-Monthly.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to lists the savings plan utilization summaries for daily or monthly grain. + * + * @summary lists the savings plan utilization summaries for daily or monthly grain. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanId-Monthly.json + */ async function savingsPlanUtilizationSummariesMonthlyWithSavingsPlanId(): Promise { - const savingsPlanOrderId = "66cccc66-6ccc-6c66-666c-66cc6c6c66c6"; - const savingsPlanId = "222d22dd-d2d2-2dd2-222d-2dd2222ddddd"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); for await (const item of client.benefitUtilizationSummaries.listBySavingsPlanId( - savingsPlanOrderId, - savingsPlanId, + "66cccc66-6ccc-6c66-666c-66cc6c6c66c6", + "222d22dd-d2d2-2dd2-222d-2dd2222ddddd", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/benefitUtilizationSummariesListBySavingsPlanOrderSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/benefitUtilizationSummariesListBySavingsPlanOrderSample.ts index 957c8c4f045a..341a4a209acf 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/benefitUtilizationSummariesListBySavingsPlanOrderSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/benefitUtilizationSummariesListBySavingsPlanOrderSample.ts @@ -1,27 +1,25 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Lists the savings plan utilization summaries for daily or monthly grain. - * - * @summary Lists the savings plan utilization summaries for daily or monthly grain. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanOrderId-Daily.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to lists the savings plan utilization summaries for daily or monthly grain. + * + * @summary lists the savings plan utilization summaries for daily or monthly grain. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanOrderId-Daily.json + */ async function savingsPlanUtilizationSummariesDaily(): Promise { - const savingsPlanOrderId = "66cccc66-6ccc-6c66-666c-66cc6c6c66c6"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); for await (const item of client.benefitUtilizationSummaries.listBySavingsPlanOrder( - savingsPlanOrderId, + "66cccc66-6ccc-6c66-666c-66cc6c6c66c6", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/budgetsCreateOrUpdateSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/budgetsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..64d669ff4452 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples-dev/budgetsCreateOrUpdateSample.ts @@ -0,0 +1,448 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/Cost/CreateOrUpdate-Cost-Subscription-Budget.json + */ +async function createOrUpdateCostSubscriptionBudget(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "subscriptions/00000000-0000-0000-0000-000000000000", + "TestBudget", + { + eTag: '"1d34d016a593709"', + amount: 100.65, + category: "Cost", + filter: { + and: [ + { + dimensions: { + name: "ResourceId", + operator: "In", + values: [ + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/MSVM2", + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/platformcloudplatformGeneric1", + ], + }, + }, + { tags: { name: "category", operator: "In", values: ["Dev", "Prod"] } }, + { tags: { name: "department", operator: "In", values: ["engineering", "sales"] } }, + ], + }, + notifications: { + Actual_GreaterThan_80_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + contactGroups: [ + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/microsoft.insights/actionGroups/SampleActionGroup", + ], + contactRoles: ["Contributor", "Reader"], + enabled: true, + locale: "en-us", + operator: "GreaterThan", + threshold: 80, + thresholdType: "Actual", + }, + }, + timeGrain: "Monthly", + timePeriod: { + endDate: new Date("2024-10-31T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/EA/BillingAccountEA-AlertRule-ReservationIdFilter.json + */ +async function createOrUpdateReservationUtilizationBillingAccountEAAlertRuleReservationIdFilter(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: { + dimensions: { + name: "ReservationId", + operator: "In", + values: [ + "00000000-0000-0000-0000-000000000000", + "00000000-0000-0000-0000-000000000001", + "00000000-0000-0000-0000-000000000002", + ], + }, + }, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Weekly", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last7Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/EA/BillingAccountEA-AlertRule-ReservedResourceTypeFilter.json + */ +async function createOrUpdateReservationUtilizationBillingAccountEAAlertRuleReservedResourceTypeFilter(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: { + dimensions: { + name: "ReservedResourceType", + operator: "In", + values: ["VirtualMachines", "SqlDatabases", "CosmosDb"], + }, + }, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Weekly", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last7Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/EA/BillingAccountEA-AlertRule.json + */ +async function createOrUpdateReservationUtilizationBillingAccountEAAlertRule(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: {}, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Weekly", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last7Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/MCA/BillingProfile-AlertRule-ReservationIdFilter.json + */ +async function createOrUpdateReservationUtilizationBillingProfileMCAAlertRuleReservationIdFilter(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/KKKK-LLLL-MMM-NNN", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: { + dimensions: { + name: "ReservationId", + operator: "In", + values: [ + "00000000-0000-0000-0000-000000000000", + "00000000-0000-0000-0000-000000000001", + "00000000-0000-0000-0000-000000000002", + ], + }, + }, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Daily", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last30Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/MCA/BillingProfile-AlertRule-ReservedResourceTypeFilter.json + */ +async function createOrUpdateReservationUtilizationBillingProfileMCAAlertRuleReservedResourceTypeFilter(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/KKKK-LLLL-MMM-NNN", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: { + dimensions: { + name: "ReservedResourceType", + operator: "In", + values: ["VirtualMachines", "SqlDatabases", "CosmosDb"], + }, + }, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Daily", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last30Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/MCA/BillingProfile-AlertRule.json + */ +async function createOrUpdateReservationUtilizationBillingProfileMCAAlertRuleJson(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/KKKK-LLLL-MMM-NNN", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: {}, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Daily", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last30Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/MCA/Customer-AlertRule-ReservationIdFilter.json + */ +async function createOrUpdateReservationUtilizationCustomerCSPAlertRuleReservationIdFilter(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/customers/000000-1111-2222-3333-444444444444", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: { + dimensions: { + name: "ReservationId", + operator: "In", + values: [ + "00000000-0000-0000-0000-000000000000", + "00000000-0000-0000-0000-000000000001", + "00000000-0000-0000-0000-000000000002", + ], + }, + }, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Daily", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last30Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/MCA/Customer-AlertRule-ReservedResourceTypeFilter.json + */ +async function createOrUpdateReservationUtilizationCustomerCSPAlertRuleReservedResourceTypeFilter(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/customers/000000-1111-2222-3333-444444444444", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: { + dimensions: { + name: "ReservedResourceType", + operator: "In", + values: ["VirtualMachines", "SqlDatabases", "CosmosDb"], + }, + }, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Daily", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last30Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/MCA/Customer-AlertRule.json + */ +async function createOrUpdateReservationUtilizationCustomerCSPAlertRuleJson(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/customers/000000-1111-2222-3333-444444444444", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: {}, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Daily", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last30Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +async function main(): Promise { + await createOrUpdateCostSubscriptionBudget(); + await createOrUpdateReservationUtilizationBillingAccountEAAlertRuleReservationIdFilter(); + await createOrUpdateReservationUtilizationBillingAccountEAAlertRuleReservedResourceTypeFilter(); + await createOrUpdateReservationUtilizationBillingAccountEAAlertRule(); + await createOrUpdateReservationUtilizationBillingProfileMCAAlertRuleReservationIdFilter(); + await createOrUpdateReservationUtilizationBillingProfileMCAAlertRuleReservedResourceTypeFilter(); + await createOrUpdateReservationUtilizationBillingProfileMCAAlertRuleJson(); + await createOrUpdateReservationUtilizationCustomerCSPAlertRuleReservationIdFilter(); + await createOrUpdateReservationUtilizationCustomerCSPAlertRuleReservedResourceTypeFilter(); + await createOrUpdateReservationUtilizationCustomerCSPAlertRuleJson(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/budgetsDeleteSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/budgetsDeleteSample.ts new file mode 100644 index 000000000000..4af444432dee --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples-dev/budgetsDeleteSample.ts @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to the operation to delete a budget. + * + * @summary the operation to delete a budget. + * x-ms-original-file: 2025-03-01/Budgets/Delete/DeleteBudget.json + */ +async function deleteBudget(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + await client.budgets.delete("subscriptions/00000000-0000-0000-0000-000000000000", "TestBudget"); +} + +async function main(): Promise { + await deleteBudget(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/budgetsGetSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/budgetsGetSample.ts new file mode 100644 index 000000000000..99ea5931b095 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples-dev/budgetsGetSample.ts @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets the budget for the scope by budget name. + * + * @summary gets the budget for the scope by budget name. + * x-ms-original-file: 2025-03-01/Budgets/Get/Cost/Get-Cost-Budget.json + */ +async function getCostBudget(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.get( + "subscriptions/00000000-0000-0000-0000-000000000000", + "TestBudget", + ); + console.log(result); +} + +/** + * This sample demonstrates how to gets the budget for the scope by budget name. + * + * @summary gets the budget for the scope by budget name. + * x-ms-original-file: 2025-03-01/Budgets/Get/ReservationUtilization/Get-ReservationUtilization-AlertRule.json + */ +async function getReservationUtilizationAlertRule(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.get( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/KKKK-LLLL-MMM-NNN", + "TestAlertRule", + ); + console.log(result); +} + +async function main(): Promise { + await getCostBudget(); + await getReservationUtilizationAlertRule(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/budgetsListSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/budgetsListSample.ts new file mode 100644 index 000000000000..c86fb9aedf21 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples-dev/budgetsListSample.ts @@ -0,0 +1,294 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/EA/BillingAccountBudgetsList-EA-CategoryTypeFilter.json + */ +async function billingAccountBudgetsListEACategoryTypeFilter(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/123456", + { filter: "properties/category eq 'ReservationUtilization'" }, + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/EA/BillingAccountBudgetsList-EA.json + */ +async function billingAccountBudgetsListEA(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/123456", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/EA/DepartmentBudgetsList.json + */ +async function departmentBudgetsListEA(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/123456/departments/789101", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/EA/EnrollmentAccountBudgetsList.json + */ +async function enrollmentAccountBudgetsListEA(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/123456/enrollmentAccounts/473845", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/MCA/BillingAccountBudgetsList-MCA-CategoryTypeFilter.json + */ +async function billingAccountBudgetsListMCACategoryTypeFilter(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01", + { filter: "properties/category eq 'ReservationUtilization'" }, + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/MCA/BillingAccountBudgetsList-MCA.json + */ +async function billingAccountBudgetsListMCA(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/MCA/BillingProfileBudgetsList-CategoryTypeFilter.json + */ +async function billingProfileBudgetsListMCACategoryTypeFilter(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/MYDEVTESTBP", + { filter: "properties/category eq 'ReservationUtilization'" }, + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/MCA/BillingProfileBudgetsList.json + */ +async function billingProfileBudgetsListMCA(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/MYDEVTESTBP", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/MCA/CustomerBudgetsList-CategoryTypeFilter.json + */ +async function customerBudgetsListMCACSPCategoryTypeFilter(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/customers/000000-1111-2222-3333-444444444444", + { filter: "properties/category eq 'ReservationUtilization'" }, + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/MCA/CustomerBudgetsList.json + */ +async function customerBudgetsListMCACSP(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/customers/000000-1111-2222-3333-444444444444", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/MCA/InvoiceSectionBudgetsList.json + */ +async function invoiceSectionBudgetsListMCA(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/MYDEVTESTBP/invoiceSections/AAAA-BBBB-CCC-DDD", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/RBAC/ManagementGroupBudgetsList.json + */ +async function managementGroupBudgetsList(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "Microsoft.Management/managementGroups/MYDEVTESTMG", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/RBAC/ResourceGroupBudgetsList.json + */ +async function resourceGroupBudgetsList(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/RBAC/SubscriptionBudgetsList.json + */ +async function subscriptionBudgetsList(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "subscriptions/00000000-0000-0000-0000-000000000000", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await billingAccountBudgetsListEACategoryTypeFilter(); + await billingAccountBudgetsListEA(); + await departmentBudgetsListEA(); + await enrollmentAccountBudgetsListEA(); + await billingAccountBudgetsListMCACategoryTypeFilter(); + await billingAccountBudgetsListMCA(); + await billingProfileBudgetsListMCACategoryTypeFilter(); + await billingProfileBudgetsListMCA(); + await customerBudgetsListMCACSPCategoryTypeFilter(); + await customerBudgetsListMCACSP(); + await invoiceSectionBudgetsListMCA(); + await managementGroupBudgetsList(); + await resourceGroupBudgetsList(); + await subscriptionBudgetsList(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/costAllocationRulesCheckNameAvailabilitySample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/costAllocationRulesCheckNameAvailabilitySample.ts new file mode 100644 index 000000000000..2d1ea22a11f4 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples-dev/costAllocationRulesCheckNameAvailabilitySample.ts @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to checks availability and correctness of a name for a cost allocation rule + * + * @summary checks availability and correctness of a name for a cost allocation rule + * x-ms-original-file: 2025-03-01/CostAllocationRuleCheckNameAvailability.json + */ +async function costAllocationRuleCheckNameAvailability(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.costAllocationRules.checkNameAvailability("100", { + name: "testRule", + type: "Microsoft.CostManagement/costAllocationRules", + }); + console.log(result); +} + +async function main(): Promise { + await costAllocationRuleCheckNameAvailability(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/costAllocationRulesCreateOrUpdateSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/costAllocationRulesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..0882c11621f7 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples-dev/costAllocationRulesCreateOrUpdateSample.ts @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment. + * + * @summary create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment. + * x-ms-original-file: 2025-03-01/CostAllocationRuleCreate.json + */ +async function costAllocationRulesCreateResourceGroup(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.costAllocationRules.createOrUpdate("100", "testRule", { + properties: { + description: "This is a testRule", + status: "Active", + details: { + sourceResources: [ + { + name: "ResourceGroupName", + resourceType: "Dimension", + values: ["sampleRG", "secondRG"], + }, + ], + targetResources: [ + { + name: "ResourceGroupName", + policyType: "FixedProportion", + resourceType: "Dimension", + values: [ + { name: "destinationRG", percentage: 45 }, + { name: "destinationRG2", percentage: 54 }, + ], + }, + ], + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment. + * + * @summary create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment. + * x-ms-original-file: 2025-03-01/CostAllocationRuleCreateTag.json + */ +async function costAllocationRulesCreateTag(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.costAllocationRules.createOrUpdate("100", "testRule", { + properties: { + description: "This is a testRule", + status: "Active", + details: { + sourceResources: [{ name: "category", resourceType: "Tag", values: ["devops"] }], + targetResources: [ + { + name: "ResourceGroupName", + policyType: "FixedProportion", + resourceType: "Dimension", + values: [ + { name: "destinationRG", percentage: 33.33 }, + { name: "destinationRG2", percentage: 33.33 }, + { name: "destinationRG3", percentage: 33.34 }, + ], + }, + ], + }, + }, + }); + console.log(result); +} + +async function main(): Promise { + await costAllocationRulesCreateResourceGroup(); + await costAllocationRulesCreateTag(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/costAllocationRulesDeleteSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/costAllocationRulesDeleteSample.ts new file mode 100644 index 000000000000..e401589fd3c8 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples-dev/costAllocationRulesDeleteSample.ts @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete cost allocation rule for billing account or enterprise enrollment. + * + * @summary delete cost allocation rule for billing account or enterprise enrollment. + * x-ms-original-file: 2025-03-01/CostAllocationRuleDelete.json + */ +async function deleteCostAllocationRule(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + await client.costAllocationRules.delete("100", "testRule"); +} + +async function main(): Promise { + await deleteCostAllocationRule(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/costAllocationRulesGetSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/costAllocationRulesGetSample.ts new file mode 100644 index 000000000000..cd0f33b02c4f --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples-dev/costAllocationRulesGetSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a cost allocation rule by rule name and billing account or enterprise enrollment. + * + * @summary get a cost allocation rule by rule name and billing account or enterprise enrollment. + * x-ms-original-file: 2025-03-01/CostAllocationRuleGet.json + */ +async function costAllocationRules(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.costAllocationRules.get("100", "testRule"); + console.log(result); +} + +async function main(): Promise { + await costAllocationRules(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/costAllocationRulesListSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/costAllocationRulesListSample.ts new file mode 100644 index 000000000000..788d7777128f --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples-dev/costAllocationRulesListSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get the list of all cost allocation rules for a billing account or enterprise enrollment. + * + * @summary get the list of all cost allocation rules for a billing account or enterprise enrollment. + * x-ms-original-file: 2025-03-01/CostAllocationRulesList.json + */ +async function costAllocationRulesList(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.costAllocationRules.list("100")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await costAllocationRulesList(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/dimensionsByExternalCloudProviderTypeSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/dimensionsListByExternalCloudProviderTypeSample.ts similarity index 55% rename from sdk/cost-management/arm-costmanagement/samples-dev/dimensionsByExternalCloudProviderTypeSample.ts rename to sdk/cost-management/arm-costmanagement/samples-dev/dimensionsListByExternalCloudProviderTypeSample.ts index ad5cb7545787..e9283372526c 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/dimensionsByExternalCloudProviderTypeSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/dimensionsListByExternalCloudProviderTypeSample.ts @@ -1,50 +1,46 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Lists the dimensions by the external cloud provider type. - * - * @summary Lists the dimensions by the external cloud provider type. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalBillingAccountsDimensions.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to lists the dimensions by the external cloud provider type. + * + * @summary lists the dimensions by the external cloud provider type. + * x-ms-original-file: 2025-03-01/ExternalBillingAccountsDimensions.json + */ async function externalBillingAccountDimensionList(): Promise { - const externalCloudProviderType = "externalBillingAccounts"; - const externalCloudProviderId = "100"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); for await (const item of client.dimensions.listByExternalCloudProviderType( - externalCloudProviderType, - externalCloudProviderId, + "externalBillingAccounts", + "100", )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the external cloud provider type. + * This sample demonstrates how to lists the dimensions by the external cloud provider type. * - * @summary Lists the dimensions by the external cloud provider type. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalSubscriptionsDimensions.json + * @summary lists the dimensions by the external cloud provider type. + * x-ms-original-file: 2025-03-01/ExternalSubscriptionsDimensions.json */ async function externalSubscriptionDimensionList(): Promise { - const externalCloudProviderType = "externalSubscriptions"; - const externalCloudProviderId = "100"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); for await (const item of client.dimensions.listByExternalCloudProviderType( - externalCloudProviderType, - externalCloudProviderId, + "externalSubscriptions", + "100", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/dimensionsListSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/dimensionsListSample.ts index 04fe52fc08ae..2292fe52c313 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/dimensionsListSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/dimensionsListSample.ts @@ -1,541 +1,543 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Lists the dimensions by the defined scope. - * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountDimensionsList.json - */ - -import type { DimensionsListOptionalParams } from "@azure/arm-costmanagement"; import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to lists the dimensions by the defined scope. + * + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/BillingAccountDimensionsList.json + */ async function billingAccountDimensionsListLegacy(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/100"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingAccountDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/BillingAccountDimensionsListExpandAndTop.json */ -async function billingAccountDimensionsListMca(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789"; +async function billingAccountDimensionsListExpandAndTopLegacy(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountDimensionsListExpandAndTop.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/BillingAccountDimensionsListWithFilter.json */ -async function billingAccountDimensionsListExpandAndTopLegacy(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/100"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { expand, top }; +async function billingAccountDimensionsListWithFilterLegacy(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100", + { filter: "properties/category eq 'resourceId'", expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingAccountDimensionsListExpandAndTop.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/DepartmentDimensionsList.json */ -async function billingAccountDimensionsListExpandAndTopMca(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { expand, top }; +async function departmentDimensionsListLegacy(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100/departments/123", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountDimensionsListWithFilter.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/DepartmentDimensionsListExpandAndTop.json */ -async function billingAccountDimensionsListWithFilterLegacy(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/100"; - const filter = "properties/category eq 'resourceId'"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { filter, expand, top }; +async function departmentDimensionsListExpandAndTopLegacy(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100/departments/123", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingAccountDimensionsListWithFilter.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/DepartmentDimensionsListWithFilter.json */ -async function billingAccountDimensionsListWithFilterMca(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789"; - const filter = "properties/category eq 'resourceId'"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { filter, expand, top }; +async function departmentDimensionsListWithFilterLegacy(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100/departments/123", + { filter: "properties/category eq 'resourceId'", expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingProfileDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/EnrollmentAccountDimensionsList.json */ -async function billingProfileDimensionsListMca(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; +async function enrollmentAccountDimensionsListLegacy(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingProfileDimensionsListExpandAndTop.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/EnrollmentAccountDimensionsListExpandAndTop.json */ -async function billingProfileDimensionsListExpandAndTopMca(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { expand, top }; +async function enrollmentAccountDimensionsListExpandAndTopLegacy(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingProfileDimensionsListWithFilter.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/EnrollmentAccountDimensionsListWithFilter.json */ -async function billingProfileDimensionsListWithFilterMca(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; - const filter = "properties/category eq 'resourceId'"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { filter, expand, top }; +async function enrollmentAccountDimensionsListWithFilterLegacy(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + { filter: "properties/category eq 'resourceId'", expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCACustomerDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCABillingAccountDimensionsList.json */ -async function customerDimensionsListMca(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"; +async function billingAccountDimensionsListMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCACustomerDimensionsListExpandAndTop.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCABillingAccountDimensionsListExpandAndTop.json */ -async function customerDimensionsListExpandAndTopMca(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { expand, top }; +async function billingAccountDimensionsListExpandAndTopMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCACustomerDimensionsListWithFilter.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCABillingAccountDimensionsListWithFilter.json */ -async function customerDimensionsListWithFilterMca(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"; - const filter = "properties/category eq 'resourceId'"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { filter, expand, top }; +async function billingAccountDimensionsListWithFilterMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789", + { filter: "properties/category eq 'resourceId'", expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCABillingProfileDimensionsList.json */ -async function departmentDimensionsListLegacy(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/100/departments/123"; +async function billingProfileDimensionsListMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentDimensionsListExpandAndTop.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCABillingProfileDimensionsListExpandAndTop.json */ -async function departmentDimensionsListExpandAndTopLegacy(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/100/departments/123"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { expand, top }; +async function billingProfileDimensionsListExpandAndTopMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentDimensionsListWithFilter.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCABillingProfileDimensionsListWithFilter.json */ -async function departmentDimensionsListWithFilterLegacy(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/100/departments/123"; - const filter = "properties/category eq 'resourceId'"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { filter, expand, top }; +async function billingProfileDimensionsListWithFilterMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + { filter: "properties/category eq 'resourceId'", expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCACustomerDimensionsList.json */ -async function enrollmentAccountDimensionsListLegacy(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; +async function customerDimensionsListMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountDimensionsListExpandAndTop.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCACustomerDimensionsListExpandAndTop.json */ -async function enrollmentAccountDimensionsListExpandAndTopLegacy(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { expand, top }; +async function customerDimensionsListExpandAndTopMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountDimensionsListWithFilter.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCACustomerDimensionsListWithFilter.json */ -async function enrollmentAccountDimensionsListWithFilterLegacy(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const filter = "properties/category eq 'resourceId'"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { filter, expand, top }; +async function customerDimensionsListWithFilterMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", + { filter: "properties/category eq 'resourceId'", expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCAInvoiceSectionDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCAInvoiceSectionDimensionsList.json */ -async function invoiceSectionDimensionsListMca(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876"; +async function invoiceSectionDimensionsListMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCAInvoiceSectionDimensionsListExpandAndTop.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCAInvoiceSectionDimensionsListExpandAndTop.json */ -async function invoiceSectionDimensionsListExpandAndTopMca(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { expand, top }; +async function invoiceSectionDimensionsListExpandAndTopMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCAInvoiceSectionDimensionsListWithFilter.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCAInvoiceSectionDimensionsListWithFilter.json */ -async function invoiceSectionDimensionsListWithFilterMca(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876"; - const filter = "properties/category eq 'resourceId'"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { filter, expand, top }; +async function invoiceSectionDimensionsListWithFilterMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", + { filter: "properties/category eq 'resourceId'", expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ManagementGroupDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/ManagementGroupDimensionsList.json */ async function managementGroupDimensionsListLegacy(): Promise { - const scope = "providers/Microsoft.Management/managementGroups/MyMgId"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Management/managementGroups/MyMgId", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ManagementGroupDimensionsListExpandAndTop.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/ManagementGroupDimensionsListExpandAndTop.json */ async function managementGroupDimensionsListExpandAndTopLegacy(): Promise { - const scope = "providers/Microsoft.Management/managementGroups/MyMgId"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { expand, top }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Management/managementGroups/MyMgId", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ManagementGroupDimensionsListWithFilter.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/ManagementGroupDimensionsListWithFilter.json */ async function managementGroupDimensionsListWithFilterLegacy(): Promise { - const scope = "providers/Microsoft.Management/managementGroups/MyMgId"; - const filter = "properties/category eq 'resourceId'"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { filter, expand, top }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Management/managementGroups/MyMgId", + { filter: "properties/category eq 'resourceId'", expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ResourceGroupDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/ResourceGroupDimensionsList.json */ async function resourceGroupDimensionsListLegacy(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/system.orlando"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { expand, top }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/system.orlando", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SubscriptionDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/SubscriptionDimensionsList.json */ async function subscriptionDimensionsListLegacy(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { expand, top }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "subscriptions/00000000-0000-0000-0000-000000000000", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } async function main(): Promise { await billingAccountDimensionsListLegacy(); - await billingAccountDimensionsListMca(); await billingAccountDimensionsListExpandAndTopLegacy(); - await billingAccountDimensionsListExpandAndTopMca(); await billingAccountDimensionsListWithFilterLegacy(); - await billingAccountDimensionsListWithFilterMca(); - await billingProfileDimensionsListMca(); - await billingProfileDimensionsListExpandAndTopMca(); - await billingProfileDimensionsListWithFilterMca(); - await customerDimensionsListMca(); - await customerDimensionsListExpandAndTopMca(); - await customerDimensionsListWithFilterMca(); await departmentDimensionsListLegacy(); await departmentDimensionsListExpandAndTopLegacy(); await departmentDimensionsListWithFilterLegacy(); await enrollmentAccountDimensionsListLegacy(); await enrollmentAccountDimensionsListExpandAndTopLegacy(); await enrollmentAccountDimensionsListWithFilterLegacy(); - await invoiceSectionDimensionsListMca(); - await invoiceSectionDimensionsListExpandAndTopMca(); - await invoiceSectionDimensionsListWithFilterMca(); + await billingAccountDimensionsListMCA(); + await billingAccountDimensionsListExpandAndTopMCA(); + await billingAccountDimensionsListWithFilterMCA(); + await billingProfileDimensionsListMCA(); + await billingProfileDimensionsListExpandAndTopMCA(); + await billingProfileDimensionsListWithFilterMCA(); + await customerDimensionsListMCA(); + await customerDimensionsListExpandAndTopMCA(); + await customerDimensionsListWithFilterMCA(); + await invoiceSectionDimensionsListMCA(); + await invoiceSectionDimensionsListExpandAndTopMCA(); + await invoiceSectionDimensionsListWithFilterMCA(); await managementGroupDimensionsListLegacy(); await managementGroupDimensionsListExpandAndTopLegacy(); await managementGroupDimensionsListWithFilterLegacy(); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/exportsCreateOrUpdateSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/exportsCreateOrUpdateSample.ts index 213e2d6a0635..0d664de6e29f 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/exportsCreateOrUpdateSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/exportsCreateOrUpdateSample.ts @@ -1,278 +1,587 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to 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. - * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateByBillingAccount.json - */ - -import type { Export } from "@azure/arm-costmanagement"; import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByBillingAccount.json + */ async function exportCreateOrUpdateByBillingAccount(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/123456"; - const exportName = "TestExport"; - const parameters: Export = { - format: "Csv", - definition: { - type: "ActualCost", - dataSet: { - configuration: { - columns: ["Date", "MeterId", "ResourceId", "ResourceLocation", "Quantity"], - }, - granularity: "Daily", + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ActualCost", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }, - deliveryInfo: { - destination: { - container: "exports", - resourceId: - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", - rootFolderPath: "ad-hoc", + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, }, - }, - schedule: { - recurrence: "Weekly", - recurrencePeriod: { - from: new Date("2020-06-01T00:00:00Z"), - to: new Date("2020-10-31T00:00:00Z"), + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2020-06-01T00:00:00Z"), + to: new Date("2020-06-30T00:00:00Z"), + }, + status: "Active", }, - status: "Active", }, - }; + ); + console.log(result); +} + +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByBillingAccountCustom.json + */ +async function exportCreateOrUpdateByBillingAccountCustom(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.createOrUpdate(scope, exportName, parameters); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ActualCost", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timePeriod: { + from: new Date("2025-04-03T00:00:00.000Z"), + to: new Date("2025-04-03T00:00:00.000Z"), + }, + timeframe: "Custom", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, + }, + exportDescription: "This is a test export.", + partitionData: true, + schedule: { status: "Inactive" }, + }, + ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateByDepartment.json + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByBillingAccountMonthly.json */ -async function exportCreateOrUpdateByDepartment(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12/departments/1234"; - const exportName = "TestExport"; - const parameters: Export = { - format: "Csv", - definition: { - type: "ActualCost", - dataSet: { - configuration: { - columns: ["Date", "MeterId", "ResourceId", "ResourceLocation", "Quantity"], +async function exportCreateOrUpdateByBillingAccountMonthly(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ActualCost", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timeframe: "TheLastMonth", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", }, - granularity: "Daily", }, - timeframe: "MonthToDate", - }, - deliveryInfo: { - destination: { - container: "exports", - resourceId: - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", - rootFolderPath: "ad-hoc", + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Monthly", + recurrencePeriod: { + from: new Date("2020-06-05T00:00:00Z"), + to: new Date("2030-06-30T00:00:00Z"), + }, + status: "Active", }, }, - schedule: { - recurrence: "Weekly", - recurrencePeriod: { - from: new Date("2020-06-01T00:00:00Z"), - to: new Date("2020-10-31T00:00:00Z"), + ); + console.log(result); +} + +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByBillingAccountPricesheet.json + */ +async function exportCreateOrUpdateByBillingAccountPricesheet(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "PriceSheet", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timeframe: "TheCurrentMonth", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, + }, + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2023-06-01T00:00:00Z"), + to: new Date("2023-06-30T00:00:00Z"), + }, + status: "Active", }, - status: "Active", }, - }; + ); + console.log(result); +} + +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByBillingAccountReservationDetails.json + */ +async function exportCreateOrUpdateByBillingAccountReservationDetails(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.createOrUpdate(scope, exportName, parameters); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ReservationDetails", + dataSet: { configuration: { dataVersion: "2023-03-01" }, granularity: "Daily" }, + timeframe: "MonthToDate", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, + }, + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2023-06-01T00:00:00Z"), + to: new Date("2023-06-30T00:00:00Z"), + }, + status: "Active", + }, + }, + ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateByEnrollmentAccount.json + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByBillingAccountReservationRecommendation.json */ -async function exportCreateOrUpdateByEnrollmentAccount(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const exportName = "TestExport"; - const parameters: Export = { - format: "Csv", - definition: { - type: "ActualCost", - dataSet: { - configuration: { - columns: ["Date", "MeterId", "ResourceId", "ResourceLocation", "Quantity"], +async function exportCreateOrUpdateByBillingAccountReservationRecommendation(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ReservationRecommendations", + dataSet: { + configuration: { + dataVersion: "2023-05-01", + filters: [ + { name: "ReservationScope", value: "Single" }, + { name: "ResourceType", value: "VirtualMachines" }, + { name: "LookBackPeriod", value: "Last7Days" }, + ], + }, }, - granularity: "Daily", + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }, - deliveryInfo: { - destination: { - container: "exports", - resourceId: - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", - rootFolderPath: "ad-hoc", + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, }, - }, - schedule: { - recurrence: "Weekly", - recurrencePeriod: { - from: new Date("2020-06-01T00:00:00Z"), - to: new Date("2020-10-31T00:00:00Z"), + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2023-06-01T00:00:00Z"), + to: new Date("2023-06-30T00:00:00Z"), + }, + status: "Active", }, - status: "Active", }, - }; + ); + console.log(result); +} + +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByBillingAccountReservationTransactions.json + */ +async function exportCreateOrUpdateExportCreateOrUpdateByBillingAccountReservationTransactionsByBillingAccount(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.createOrUpdate(scope, exportName, parameters); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ReservationTransactions", + dataSet: { configuration: { dataVersion: "2023-05-01" } }, + timeframe: "MonthToDate", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, + }, + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2023-06-01T00:00:00Z"), + to: new Date("2023-06-30T00:00:00Z"), + }, + status: "Active", + }, + }, + ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateByManagementGroup.json + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByDepartment.json */ -async function exportCreateOrUpdateByManagementGroup(): Promise { - const scope = "providers/Microsoft.Management/managementGroups/TestMG"; - const exportName = "TestExport"; - const parameters: Export = { - format: "Csv", - definition: { - type: "ActualCost", - dataSet: { - configuration: { - columns: ["Date", "MeterId", "ResourceId", "ResourceLocation", "Quantity"], +async function exportCreateOrUpdateByDepartment(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/12/departments/1234", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Parquet", + compressionMode: "snappy", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ActualCost", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timeframe: "MonthToDate", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", }, - granularity: "Daily", }, - timeframe: "MonthToDate", - }, - deliveryInfo: { - destination: { - container: "exports", - resourceId: - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", - rootFolderPath: "ad-hoc", + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2020-06-01T00:00:00Z"), + to: new Date("2020-06-30T00:00:00Z"), + }, + status: "Active", }, }, - schedule: { - recurrence: "Weekly", - recurrencePeriod: { - from: new Date("2020-06-01T00:00:00Z"), - to: new Date("2020-10-31T00:00:00Z"), + ); + console.log(result); +} + +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByEnrollmentAccount.json + */ +async function exportCreateOrUpdateByEnrollmentAccount(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ActualCost", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timeframe: "MonthToDate", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, + }, + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2020-06-01T00:00:00Z"), + to: new Date("2020-06-30T00:00:00Z"), + }, + status: "Active", }, - status: "Active", }, - }; + ); + console.log(result); +} + +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByManagementGroup.json + */ +async function exportCreateOrUpdateByManagementGroup(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.createOrUpdate(scope, exportName, parameters); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Management/managementGroups/TestMG", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ActualCost", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timeframe: "MonthToDate", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, + }, + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2020-06-01T00:00:00Z"), + to: new Date("2020-06-30T00:00:00Z"), + }, + status: "Active", + }, + }, + ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateByResourceGroup.json + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByResourceGroup.json */ async function exportCreateOrUpdateByResourceGroup(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; - const exportName = "TestExport"; - const parameters: Export = { - format: "Csv", - definition: { - type: "ActualCost", - dataSet: { - configuration: { - columns: ["Date", "MeterId", "ResourceId", "ResourceLocation", "Quantity"], - }, - granularity: "Daily", + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.exports.createOrUpdate( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ActualCost", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }, - deliveryInfo: { - destination: { - container: "exports", - resourceId: - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", - rootFolderPath: "ad-hoc", + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, }, - }, - schedule: { - recurrence: "Weekly", - recurrencePeriod: { - from: new Date("2020-06-01T00:00:00Z"), - to: new Date("2020-10-31T00:00:00Z"), + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2020-06-01T00:00:00Z"), + to: new Date("2020-06-30T00:00:00Z"), + }, + status: "Active", }, - status: "Active", }, - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.exports.createOrUpdate(scope, exportName, parameters); + ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateBySubscription.json + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateBySubscription.json */ async function exportCreateOrUpdateBySubscription(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const exportName = "TestExport"; - const parameters: Export = { - format: "Csv", - definition: { - type: "ActualCost", - dataSet: { - configuration: { - columns: ["Date", "MeterId", "ResourceId", "ResourceLocation", "Quantity"], - }, - granularity: "Daily", + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.exports.createOrUpdate( + "subscriptions/00000000-0000-0000-0000-000000000000", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ActualCost", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }, - deliveryInfo: { - destination: { - container: "exports", - resourceId: - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", - rootFolderPath: "ad-hoc", + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, }, - }, - schedule: { - recurrence: "Weekly", - recurrencePeriod: { - from: new Date("2020-06-01T00:00:00Z"), - to: new Date("2020-10-31T00:00:00Z"), + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2020-06-01T00:00:00Z"), + to: new Date("2020-06-30T00:00:00Z"), + }, + status: "Active", }, - status: "Active", }, - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.exports.createOrUpdate(scope, exportName, parameters); + ); console.log(result); } async function main(): Promise { await exportCreateOrUpdateByBillingAccount(); + await exportCreateOrUpdateByBillingAccountCustom(); + await exportCreateOrUpdateByBillingAccountMonthly(); + await exportCreateOrUpdateByBillingAccountPricesheet(); + await exportCreateOrUpdateByBillingAccountReservationDetails(); + await exportCreateOrUpdateByBillingAccountReservationRecommendation(); + await exportCreateOrUpdateExportCreateOrUpdateByBillingAccountReservationTransactionsByBillingAccount(); await exportCreateOrUpdateByDepartment(); await exportCreateOrUpdateByEnrollmentAccount(); await exportCreateOrUpdateByManagementGroup(); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/exportsDeleteSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/exportsDeleteSample.ts index e66438d70da6..24348b04694a 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/exportsDeleteSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/exportsDeleteSample.ts @@ -1,99 +1,91 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to The operation to delete a export. - * - * @summary The operation to delete a export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteByBillingAccount.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to the operation to delete a export. + * + * @summary the operation to delete a export. + * x-ms-original-file: 2025-03-01/ExportDeleteByBillingAccount.json + */ async function exportDeleteByBillingAccount(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/123456"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.delete(scope, exportName); - console.log(result); + await client.exports.delete("providers/Microsoft.Billing/billingAccounts/123456", "TestExport"); } /** - * This sample demonstrates how to The operation to delete a export. + * This sample demonstrates how to the operation to delete a export. * - * @summary The operation to delete a export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteByDepartment.json + * @summary the operation to delete a export. + * x-ms-original-file: 2025-03-01/ExportDeleteByDepartment.json */ async function exportDeleteByDepartment(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12/departments/1234"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.delete(scope, exportName); - console.log(result); + await client.exports.delete( + "providers/Microsoft.Billing/billingAccounts/12/departments/1234", + "TestExport", + ); } /** - * This sample demonstrates how to The operation to delete a export. + * This sample demonstrates how to the operation to delete a export. * - * @summary The operation to delete a export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteByEnrollmentAccount.json + * @summary the operation to delete a export. + * x-ms-original-file: 2025-03-01/ExportDeleteByEnrollmentAccount.json */ async function exportDeleteByEnrollmentAccount(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.delete(scope, exportName); - console.log(result); + await client.exports.delete( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + "TestExport", + ); } /** - * This sample demonstrates how to The operation to delete a export. + * This sample demonstrates how to the operation to delete a export. * - * @summary The operation to delete a export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteByManagementGroup.json + * @summary the operation to delete a export. + * x-ms-original-file: 2025-03-01/ExportDeleteByManagementGroup.json */ async function exportDeleteByManagementGroup(): Promise { - const scope = "providers/Microsoft.Management/managementGroups/TestMG"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.delete(scope, exportName); - console.log(result); + await client.exports.delete( + "providers/Microsoft.Management/managementGroups/TestMG", + "TestExport", + ); } /** - * This sample demonstrates how to The operation to delete a export. + * This sample demonstrates how to the operation to delete a export. * - * @summary The operation to delete a export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteByResourceGroup.json + * @summary the operation to delete a export. + * x-ms-original-file: 2025-03-01/ExportDeleteByResourceGroup.json */ async function exportDeleteByResourceGroup(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.delete(scope, exportName); - console.log(result); + await client.exports.delete( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + "TestExport", + ); } /** - * This sample demonstrates how to The operation to delete a export. + * This sample demonstrates how to the operation to delete a export. * - * @summary The operation to delete a export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteBySubscription.json + * @summary the operation to delete a export. + * x-ms-original-file: 2025-03-01/ExportDeleteBySubscription.json */ async function exportDeleteBySubscription(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.delete(scope, exportName); - console.log(result); + await client.exports.delete("subscriptions/00000000-0000-0000-0000-000000000000", "TestExport"); } async function main(): Promise { diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/exportsExecuteSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/exportsExecuteSample.ts index 2e39dec50418..80acc1696b79 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/exportsExecuteSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/exportsExecuteSample.ts @@ -1,103 +1,108 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to The operation to run an export. - * - * @summary The operation to run an export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunByBillingAccount.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to the operation to run an export. + * + * @summary the operation to run an export. + * x-ms-original-file: 2025-03-01/ExportRunByBillingAccount.json + */ async function exportRunByBillingAccount(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/123456"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.execute(scope, exportName); - console.log(result); + await client.exports.execute("providers/Microsoft.Billing/billingAccounts/123456", "TestExport"); +} + +/** + * This sample demonstrates how to the operation to run an export. + * + * @summary the operation to run an export. + * x-ms-original-file: 2025-03-01/ExportRunByBillingAccountWithOptionalRequestBody.json + */ +async function exportRunByBillingAccountWithOptionalRequestBody(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + await client.exports.execute("providers/Microsoft.Billing/billingAccounts/123456", "TestExport"); } /** - * This sample demonstrates how to The operation to run an export. + * This sample demonstrates how to the operation to run an export. * - * @summary The operation to run an export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunByDepartment.json + * @summary the operation to run an export. + * x-ms-original-file: 2025-03-01/ExportRunByDepartment.json */ async function exportRunByDepartment(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12/departments/1234"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.execute(scope, exportName); - console.log(result); + await client.exports.execute( + "providers/Microsoft.Billing/billingAccounts/12/departments/1234", + "TestExport", + ); } /** - * This sample demonstrates how to The operation to run an export. + * This sample demonstrates how to the operation to run an export. * - * @summary The operation to run an export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunByEnrollmentAccount.json + * @summary the operation to run an export. + * x-ms-original-file: 2025-03-01/ExportRunByEnrollmentAccount.json */ async function exportRunByEnrollmentAccount(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.execute(scope, exportName); - console.log(result); + await client.exports.execute( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + "TestExport", + ); } /** - * This sample demonstrates how to The operation to run an export. + * This sample demonstrates how to the operation to run an export. * - * @summary The operation to run an export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunByManagementGroup.json + * @summary the operation to run an export. + * x-ms-original-file: 2025-03-01/ExportRunByManagementGroup.json */ async function exportRunByManagementGroup(): Promise { - const scope = "providers/Microsoft.Management/managementGroups/TestMG"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.execute(scope, exportName); - console.log(result); + await client.exports.execute( + "providers/Microsoft.Management/managementGroups/TestMG", + "TestExport", + ); } /** - * This sample demonstrates how to The operation to run an export. + * This sample demonstrates how to the operation to run an export. * - * @summary The operation to run an export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunByResourceGroup.json + * @summary the operation to run an export. + * x-ms-original-file: 2025-03-01/ExportRunByResourceGroup.json */ async function exportRunByResourceGroup(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.execute(scope, exportName); - console.log(result); + await client.exports.execute( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + "TestExport", + ); } /** - * This sample demonstrates how to The operation to run an export. + * This sample demonstrates how to the operation to run an export. * - * @summary The operation to run an export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunBySubscription.json + * @summary the operation to run an export. + * x-ms-original-file: 2025-03-01/ExportRunBySubscription.json */ async function exportRunBySubscription(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.execute(scope, exportName); - console.log(result); + await client.exports.execute("subscriptions/00000000-0000-0000-0000-000000000000", "TestExport"); } async function main(): Promise { await exportRunByBillingAccount(); + await exportRunByBillingAccountWithOptionalRequestBody(); await exportRunByDepartment(); await exportRunByEnrollmentAccount(); await exportRunByManagementGroup(); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/exportsGetExecutionHistorySample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/exportsGetExecutionHistorySample.ts index 31862f02ca21..27fb24ba8033 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/exportsGetExecutionHistorySample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/exportsGetExecutionHistorySample.ts @@ -1,98 +1,102 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to The operation to get the run history of an export for the defined scope and export name. - * - * @summary The operation to get the run history of an export for the defined scope and export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetByBillingAccount.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to the operation to get the run history of an export for the defined scope and export name. + * + * @summary the operation to get the run history of an export for the defined scope and export name. + * x-ms-original-file: 2025-03-01/ExportRunHistoryGetByBillingAccount.json + */ async function exportRunHistoryGetByBillingAccount(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/123456"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.getExecutionHistory(scope, exportName); + const result = await client.exports.getExecutionHistory( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the run history of an export for the defined scope and export name. + * This sample demonstrates how to the operation to get the run history of an export for the defined scope and export name. * - * @summary The operation to get the run history of an export for the defined scope and export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetByDepartment.json + * @summary the operation to get the run history of an export for the defined scope and export name. + * x-ms-original-file: 2025-03-01/ExportRunHistoryGetByDepartment.json */ async function exportRunHistoryGetByDepartment(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12/departments/1234"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.getExecutionHistory(scope, exportName); + const result = await client.exports.getExecutionHistory( + "providers/Microsoft.Billing/billingAccounts/12/departments/1234", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the run history of an export for the defined scope and export name. + * This sample demonstrates how to the operation to get the run history of an export for the defined scope and export name. * - * @summary The operation to get the run history of an export for the defined scope and export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetByEnrollmentAccount.json + * @summary the operation to get the run history of an export for the defined scope and export name. + * x-ms-original-file: 2025-03-01/ExportRunHistoryGetByEnrollmentAccount.json */ async function exportRunHistoryGetByEnrollmentAccount(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.getExecutionHistory(scope, exportName); + const result = await client.exports.getExecutionHistory( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the run history of an export for the defined scope and export name. + * This sample demonstrates how to the operation to get the run history of an export for the defined scope and export name. * - * @summary The operation to get the run history of an export for the defined scope and export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetByManagementGroup.json + * @summary the operation to get the run history of an export for the defined scope and export name. + * x-ms-original-file: 2025-03-01/ExportRunHistoryGetByManagementGroup.json */ async function exportRunHistoryGetByManagementGroup(): Promise { - const scope = "providers/Microsoft.Management/managementGroups/TestMG"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.getExecutionHistory(scope, exportName); + const result = await client.exports.getExecutionHistory( + "providers/Microsoft.Management/managementGroups/TestMG", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the run history of an export for the defined scope and export name. + * This sample demonstrates how to the operation to get the run history of an export for the defined scope and export name. * - * @summary The operation to get the run history of an export for the defined scope and export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetByResourceGroup.json + * @summary the operation to get the run history of an export for the defined scope and export name. + * x-ms-original-file: 2025-03-01/ExportRunHistoryGetByResourceGroup.json */ async function exportRunHistoryGetByResourceGroup(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.getExecutionHistory(scope, exportName); + const result = await client.exports.getExecutionHistory( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the run history of an export for the defined scope and export name. + * This sample demonstrates how to the operation to get the run history of an export for the defined scope and export name. * - * @summary The operation to get the run history of an export for the defined scope and export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetBySubscription.json + * @summary the operation to get the run history of an export for the defined scope and export name. + * x-ms-original-file: 2025-03-01/ExportRunHistoryGetBySubscription.json */ async function exportRunHistoryGetBySubscription(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.getExecutionHistory(scope, exportName); + const result = await client.exports.getExecutionHistory( + "subscriptions/00000000-0000-0000-0000-000000000000", + "TestExport", + ); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/exportsGetSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/exportsGetSample.ts index 664ac1b0ebcf..afc0cc231482 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/exportsGetSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/exportsGetSample.ts @@ -1,98 +1,102 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to The operation to get the export for the defined scope by export name. - * - * @summary The operation to get the export for the defined scope by export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetByBillingAccount.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to the operation to get the export for the defined scope by export name. + * + * @summary the operation to get the export for the defined scope by export name. + * x-ms-original-file: 2025-03-01/ExportGetByBillingAccount.json + */ async function exportGetByBillingAccount(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/123456"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.get(scope, exportName); + const result = await client.exports.get( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the export for the defined scope by export name. + * This sample demonstrates how to the operation to get the export for the defined scope by export name. * - * @summary The operation to get the export for the defined scope by export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetByDepartment.json + * @summary the operation to get the export for the defined scope by export name. + * x-ms-original-file: 2025-03-01/ExportGetByDepartment.json */ async function exportGetByDepartment(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12/departments/1234"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.get(scope, exportName); + const result = await client.exports.get( + "providers/Microsoft.Billing/billingAccounts/12/departments/1234", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the export for the defined scope by export name. + * This sample demonstrates how to the operation to get the export for the defined scope by export name. * - * @summary The operation to get the export for the defined scope by export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetByEnrollmentAccount.json + * @summary the operation to get the export for the defined scope by export name. + * x-ms-original-file: 2025-03-01/ExportGetByEnrollmentAccount.json */ async function exportGetByEnrollmentAccount(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.get(scope, exportName); + const result = await client.exports.get( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the export for the defined scope by export name. + * This sample demonstrates how to the operation to get the export for the defined scope by export name. * - * @summary The operation to get the export for the defined scope by export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetByManagementGroup.json + * @summary the operation to get the export for the defined scope by export name. + * x-ms-original-file: 2025-03-01/ExportGetByManagementGroup.json */ async function exportGetByManagementGroup(): Promise { - const scope = "providers/Microsoft.Management/managementGroups/TestMG"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.get(scope, exportName); + const result = await client.exports.get( + "providers/Microsoft.Management/managementGroups/TestMG", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the export for the defined scope by export name. + * This sample demonstrates how to the operation to get the export for the defined scope by export name. * - * @summary The operation to get the export for the defined scope by export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetByResourceGroup.json + * @summary the operation to get the export for the defined scope by export name. + * x-ms-original-file: 2025-03-01/ExportGetByResourceGroup.json */ async function exportGetByResourceGroup(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.get(scope, exportName); + const result = await client.exports.get( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the export for the defined scope by export name. + * This sample demonstrates how to the operation to get the export for the defined scope by export name. * - * @summary The operation to get the export for the defined scope by export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetBySubscription.json + * @summary the operation to get the export for the defined scope by export name. + * x-ms-original-file: 2025-03-01/ExportGetBySubscription.json */ async function exportGetBySubscription(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.get(scope, exportName); + const result = await client.exports.get( + "subscriptions/00000000-0000-0000-0000-000000000000", + "TestExport", + ); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/exportsListSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/exportsListSample.ts index 4f0655b47bb1..59f873610271 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/exportsListSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/exportsListSample.ts @@ -1,92 +1,92 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to The operation to list all exports at the given scope. - * - * @summary The operation to list all exports at the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetByBillingAccount.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to the operation to list all exports at the given scope. + * + * @summary the operation to list all exports at the given scope. + * x-ms-original-file: 2025-03-01/ExportsGetByBillingAccount.json + */ async function exportsGetByBillingAccount(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/123456"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.list(scope); + const result = await client.exports.list("providers/Microsoft.Billing/billingAccounts/123456"); console.log(result); } /** - * This sample demonstrates how to The operation to list all exports at the given scope. + * This sample demonstrates how to the operation to list all exports at the given scope. * - * @summary The operation to list all exports at the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetByDepartment.json + * @summary the operation to list all exports at the given scope. + * x-ms-original-file: 2025-03-01/ExportsGetByDepartment.json */ async function exportsGetByDepartment(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12/departments/123"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.list(scope); + const result = await client.exports.list( + "providers/Microsoft.Billing/billingAccounts/12/departments/123", + ); console.log(result); } /** - * This sample demonstrates how to The operation to list all exports at the given scope. + * This sample demonstrates how to the operation to list all exports at the given scope. * - * @summary The operation to list all exports at the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetByEnrollmentAccount.json + * @summary the operation to list all exports at the given scope. + * x-ms-original-file: 2025-03-01/ExportsGetByEnrollmentAccount.json */ async function exportsGetByEnrollmentAccount(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.list(scope); + const result = await client.exports.list( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + ); console.log(result); } /** - * This sample demonstrates how to The operation to list all exports at the given scope. + * This sample demonstrates how to the operation to list all exports at the given scope. * - * @summary The operation to list all exports at the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetByManagementGroup.json + * @summary the operation to list all exports at the given scope. + * x-ms-original-file: 2025-03-01/ExportsGetByManagementGroup.json */ async function exportsGetByManagementGroup(): Promise { - const scope = "providers/Microsoft.Management/managementGroups/TestMG"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.list(scope); + const result = await client.exports.list( + "providers/Microsoft.Management/managementGroups/TestMG", + ); console.log(result); } /** - * This sample demonstrates how to The operation to list all exports at the given scope. + * This sample demonstrates how to the operation to list all exports at the given scope. * - * @summary The operation to list all exports at the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetByResourceGroup.json + * @summary the operation to list all exports at the given scope. + * x-ms-original-file: 2025-03-01/ExportsGetByResourceGroup.json */ async function exportsGetByResourceGroup(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.list(scope); + const result = await client.exports.list( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + ); console.log(result); } /** - * This sample demonstrates how to The operation to list all exports at the given scope. + * This sample demonstrates how to the operation to list all exports at the given scope. * - * @summary The operation to list all exports at the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetBySubscription.json + * @summary the operation to list all exports at the given scope. + * x-ms-original-file: 2025-03-01/ExportsGetBySubscription.json */ async function exportsGetBySubscription(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.list(scope); + const result = await client.exports.list("subscriptions/00000000-0000-0000-0000-000000000000"); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/forecastExternalCloudProviderUsageSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/forecastExternalCloudProviderUsageSample.ts index fb5f785c282d..05e5f68fd173 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/forecastExternalCloudProviderUsageSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/forecastExternalCloudProviderUsageSample.ts @@ -1,82 +1,64 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Lists the forecast charges for external cloud provider type defined. - * - * @summary Lists the forecast charges for external cloud provider type defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalBillingAccountForecast.json - */ - -import type { ForecastDefinition } from "@azure/arm-costmanagement"; import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to lists the forecast charges for external cloud provider type defined. + * + * @summary lists the forecast charges for external cloud provider type defined. + * x-ms-original-file: 2025-03-01/ExternalBillingAccountForecast.json + */ async function externalBillingAccountForecast(): Promise { - const externalCloudProviderType = "externalBillingAccounts"; - const externalCloudProviderId = "100"; - const parameters: ForecastDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "Cost", function: "Sum" } }, - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.forecast.externalCloudProviderUsage( + "externalBillingAccounts", + "100", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "Cost", function: "Sum" } }, + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", - }, - timePeriod: { - from: new Date("2022-08-01T00:00:00+00:00"), - to: new Date("2022-08-31T23:59:59+00:00"), + timePeriod: { + from: new Date("2022-08-01T00:00:00+00:00"), + to: new Date("2022-08-31T23:59:59+00:00"), + }, + timeframe: "Custom", }, - timeframe: "Custom", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.forecast.externalCloudProviderUsage( - externalCloudProviderType, - externalCloudProviderId, - parameters, ); console.log(result); } /** - * This sample demonstrates how to Lists the forecast charges for external cloud provider type defined. + * This sample demonstrates how to lists the forecast charges for external cloud provider type defined. * - * @summary Lists the forecast charges for external cloud provider type defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalSubscriptionForecast.json + * @summary lists the forecast charges for external cloud provider type defined. + * x-ms-original-file: 2025-03-01/ExternalSubscriptionForecast.json */ async function externalSubscriptionForecast(): Promise { - const externalCloudProviderType = "externalSubscriptions"; - const externalCloudProviderId = "100"; - const parameters: ForecastDefinition = { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.forecast.externalCloudProviderUsage("externalSubscriptions", "100", { type: "Usage", dataset: { aggregation: { totalCost: { name: "Cost", function: "Sum" } }, @@ -91,22 +73,10 @@ async function externalSubscriptionForecast(): Promise { values: ["East US", "West Europe"], }, }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], - }, - }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, ], }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], - }, - }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, ], }, granularity: "Daily", @@ -116,14 +86,7 @@ async function externalSubscriptionForecast(): Promise { to: new Date("2022-08-31T23:59:59+00:00"), }, timeframe: "Custom", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.forecast.externalCloudProviderUsage( - externalCloudProviderType, - externalCloudProviderId, - parameters, - ); + }); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/forecastUsageSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/forecastUsageSample.ts index d7fb09d4964b..f576b0ccf3da 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/forecastUsageSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/forecastUsageSample.ts @@ -1,365 +1,295 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Lists the forecast charges for scope defined. - * - * @summary Lists the forecast charges for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountForecast.json - */ - -import type { ForecastDefinition } from "@azure/arm-costmanagement"; import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to lists the forecast charges for scope defined. + * + * @summary lists the forecast charges for scope defined. + * x-ms-original-file: 2025-03-01/BillingAccountForecast.json + */ async function billingAccountForecast(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789"; - const parameters: ForecastDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "Cost", function: "Sum" } }, - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.forecast.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "Cost", function: "Sum" } }, + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", - }, - includeActualCost: false, - includeFreshPartialCost: false, - timePeriod: { - from: new Date("2022-08-01T00:00:00+00:00"), - to: new Date("2022-08-31T23:59:59+00:00"), + includeActualCost: false, + includeFreshPartialCost: false, + timePeriod: { + from: new Date("2022-08-01T00:00:00+00:00"), + to: new Date("2022-08-31T23:59:59+00:00"), + }, + timeframe: "Custom", }, - timeframe: "Custom", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.forecast.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Lists the forecast charges for scope defined. + * This sample demonstrates how to lists the forecast charges for scope defined. * - * @summary Lists the forecast charges for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingProfileForecast.json + * @summary lists the forecast charges for scope defined. + * x-ms-original-file: 2025-03-01/BillingProfileForecast.json */ async function billingProfileForecast(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; - const parameters: ForecastDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "Cost", function: "Sum" } }, - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.forecast.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "Cost", function: "Sum" } }, + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", - }, - includeActualCost: false, - includeFreshPartialCost: false, - timePeriod: { - from: new Date("2022-08-01T00:00:00+00:00"), - to: new Date("2022-08-31T23:59:59+00:00"), + includeActualCost: false, + includeFreshPartialCost: false, + timePeriod: { + from: new Date("2022-08-01T00:00:00+00:00"), + to: new Date("2022-08-31T23:59:59+00:00"), + }, + timeframe: "Custom", }, - timeframe: "Custom", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.forecast.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Lists the forecast charges for scope defined. + * This sample demonstrates how to lists the forecast charges for scope defined. * - * @summary Lists the forecast charges for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentForecast.json + * @summary lists the forecast charges for scope defined. + * x-ms-original-file: 2025-03-01/DepartmentForecast.json */ async function departmentForecast(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123"; - const parameters: ForecastDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "Cost", function: "Sum" } }, - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.forecast.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "Cost", function: "Sum" } }, + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", - }, - includeActualCost: false, - includeFreshPartialCost: false, - timePeriod: { - from: new Date("2022-08-01T00:00:00+00:00"), - to: new Date("2022-08-31T23:59:59+00:00"), + includeActualCost: false, + includeFreshPartialCost: false, + timePeriod: { + from: new Date("2022-08-01T00:00:00+00:00"), + to: new Date("2022-08-31T23:59:59+00:00"), + }, + timeframe: "Custom", }, - timeframe: "Custom", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.forecast.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Lists the forecast charges for scope defined. + * This sample demonstrates how to lists the forecast charges for scope defined. * - * @summary Lists the forecast charges for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountForecast.json + * @summary lists the forecast charges for scope defined. + * x-ms-original-file: 2025-03-01/EnrollmentAccountForecast.json */ async function enrollmentAccountForecast(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456"; - const parameters: ForecastDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "Cost", function: "Sum" } }, - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.forecast.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "Cost", function: "Sum" } }, + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", - }, - includeActualCost: false, - includeFreshPartialCost: false, - timePeriod: { - from: new Date("2022-08-01T00:00:00+00:00"), - to: new Date("2022-08-31T23:59:59+00:00"), + includeActualCost: false, + includeFreshPartialCost: false, + timePeriod: { + from: new Date("2022-08-01T00:00:00+00:00"), + to: new Date("2022-08-31T23:59:59+00:00"), + }, + timeframe: "Custom", }, - timeframe: "Custom", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.forecast.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Lists the forecast charges for scope defined. + * This sample demonstrates how to lists the forecast charges for scope defined. * - * @summary Lists the forecast charges for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/InvoiceSectionForecast.json + * @summary lists the forecast charges for scope defined. + * x-ms-original-file: 2025-03-01/InvoiceSectionForecast.json */ async function invoiceSectionForecast(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876"; - const parameters: ForecastDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "Cost", function: "Sum" } }, - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.forecast.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "Cost", function: "Sum" } }, + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", - }, - includeActualCost: false, - includeFreshPartialCost: false, - timePeriod: { - from: new Date("2022-08-01T00:00:00+00:00"), - to: new Date("2022-08-31T23:59:59+00:00"), + includeActualCost: false, + includeFreshPartialCost: false, + timePeriod: { + from: new Date("2022-08-01T00:00:00+00:00"), + to: new Date("2022-08-31T23:59:59+00:00"), + }, + timeframe: "Custom", }, - timeframe: "Custom", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.forecast.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Lists the forecast charges for scope defined. + * This sample demonstrates how to lists the forecast charges for scope defined. * - * @summary Lists the forecast charges for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ResourceGroupForecast.json + * @summary lists the forecast charges for scope defined. + * x-ms-original-file: 2025-03-01/ResourceGroupForecast.json */ async function resourceGroupForecast(): Promise { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"; - const parameters: ForecastDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "Cost", function: "Sum" } }, - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.forecast.usage( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "Cost", function: "Sum" } }, + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", - }, - includeActualCost: false, - includeFreshPartialCost: false, - timePeriod: { - from: new Date("2022-08-01T00:00:00+00:00"), - to: new Date("2022-08-31T23:59:59+00:00"), + includeActualCost: false, + includeFreshPartialCost: false, + timePeriod: { + from: new Date("2022-08-01T00:00:00+00:00"), + to: new Date("2022-08-31T23:59:59+00:00"), + }, + timeframe: "Custom", }, - timeframe: "Custom", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.forecast.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Lists the forecast charges for scope defined. + * This sample demonstrates how to lists the forecast charges for scope defined. * - * @summary Lists the forecast charges for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SubscriptionForecast.json + * @summary lists the forecast charges for scope defined. + * x-ms-original-file: 2025-03-01/SubscriptionForecast.json */ async function subscriptionForecast(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const parameters: ForecastDefinition = { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.forecast.usage("subscriptions/00000000-0000-0000-0000-000000000000", { type: "Usage", dataset: { aggregation: { totalCost: { name: "Cost", function: "Sum" } }, @@ -374,22 +304,10 @@ async function subscriptionForecast(): Promise { values: ["East US", "West Europe"], }, }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], - }, - }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, ], }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], - }, - }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, ], }, granularity: "Daily", @@ -401,10 +319,7 @@ async function subscriptionForecast(): Promise { to: new Date("2022-08-31T23:59:59+00:00"), }, timeframe: "Custom", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.forecast.usage(scope, parameters); + }); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/generateBenefitUtilizationSummariesReportGenerateByBillingAccountSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/generateBenefitUtilizationSummariesReportGenerateByBillingAccountSample.ts new file mode 100644 index 000000000000..05cc7b517761 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples-dev/generateBenefitUtilizationSummariesReportGenerateByBillingAccountSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. + * + * @summary triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByBillingAccount.json + */ +async function generateUtilizationSummariesReportByBillingAccount(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.generateBenefitUtilizationSummariesReport.generateByBillingAccount( + "8099099", + { + endDate: new Date("2022-08-31T00:00:00Z"), + grain: "Daily", + kind: "Reservation", + startDate: new Date("2022-06-01T00:00:00Z"), + }, + ); + console.log(result); +} + +async function main(): Promise { + await generateUtilizationSummariesReportByBillingAccount(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/generateBenefitUtilizationSummariesReportGenerateByBillingProfileSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/generateBenefitUtilizationSummariesReportGenerateByBillingProfileSample.ts new file mode 100644 index 000000000000..0c520caaf357 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples-dev/generateBenefitUtilizationSummariesReportGenerateByBillingProfileSample.ts @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. + * + * @summary triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByBillingProfile.json + */ +async function generateUtilizationSummariesReportByBillingProfile(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.generateBenefitUtilizationSummariesReport.generateByBillingProfile( + "00000000-0000-0000-0000-000000000000", + "CZSFR-SDFXC-DSDF", + { + endDate: new Date("2022-08-31T00:00:00Z"), + grain: "Daily", + kind: "Reservation", + startDate: new Date("2022-06-01T00:00:00Z"), + }, + ); + console.log(result); +} + +async function main(): Promise { + await generateUtilizationSummariesReportByBillingProfile(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/generateBenefitUtilizationSummariesReportGenerateByReservationIdSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/generateBenefitUtilizationSummariesReportGenerateByReservationIdSample.ts new file mode 100644 index 000000000000..ffbcdffff4fa --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples-dev/generateBenefitUtilizationSummariesReportGenerateByReservationIdSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to triggers generation of a benefit utilization summaries report for the provided reservation. + * + * @summary triggers generation of a benefit utilization summaries report for the provided reservation. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByReservation.json + */ +async function generateUtilizationSummariesReportByReservation(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.generateBenefitUtilizationSummariesReport.generateByReservationId( + "00000000-0000-0000-0000-000000000000", + "00000000-0000-0000-0000-000000000000", + { + endDate: new Date("2022-08-31T00:00:00Z"), + grain: "Daily", + startDate: new Date("2022-06-01T00:00:00Z"), + }, + ); + console.log(result); +} + +async function main(): Promise { + await generateUtilizationSummariesReportByReservation(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/generateBenefitUtilizationSummariesReportGenerateByReservationOrderIdSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/generateBenefitUtilizationSummariesReportGenerateByReservationOrderIdSample.ts new file mode 100644 index 000000000000..21b0e5f73419 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples-dev/generateBenefitUtilizationSummariesReportGenerateByReservationOrderIdSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to triggers generation of a benefit utilization summaries report for the provided reservation order. + * + * @summary triggers generation of a benefit utilization summaries report for the provided reservation order. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByReservationOrder.json + */ +async function generateUtilizationSummariesReportByReservationOrder(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = + await client.generateBenefitUtilizationSummariesReport.generateByReservationOrderId( + "00000000-0000-0000-0000-000000000000", + { + endDate: new Date("2022-08-31T00:00:00Z"), + grain: "Daily", + startDate: new Date("2022-06-01T00:00:00Z"), + }, + ); + console.log(result); +} + +async function main(): Promise { + await generateUtilizationSummariesReportByReservationOrder(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/generateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/generateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdSample.ts new file mode 100644 index 000000000000..b4bd2f7a28e7 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples-dev/generateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to triggers generation of a benefit utilization summaries report for the provided savings plan. + * + * @summary triggers generation of a benefit utilization summaries report for the provided savings plan. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportBySavingsPlan.json + */ +async function generateUtilizationSummariesReportBySavingsPlan(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.generateBenefitUtilizationSummariesReport.generateBySavingsPlanId( + "00000000-0000-0000-0000-000000000000", + "00000000-0000-0000-0000-000000000000", + { + endDate: new Date("2022-08-31T00:00:00Z"), + grain: "Daily", + startDate: new Date("2022-06-01T00:00:00Z"), + }, + ); + console.log(result); +} + +async function main(): Promise { + await generateUtilizationSummariesReportBySavingsPlan(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/generateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/generateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdSample.ts new file mode 100644 index 000000000000..9f40ed084f11 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples-dev/generateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to triggers generation of a benefit utilization summaries report for the provided savings plan order. + * + * @summary triggers generation of a benefit utilization summaries report for the provided savings plan order. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportBySavingsPlanOrder.json + */ +async function generateUtilizationSummariesReportBySavingsPlanOrder(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = + await client.generateBenefitUtilizationSummariesReport.generateBySavingsPlanOrderId( + "00000000-0000-0000-0000-000000000000", + { + endDate: new Date("2022-08-31T00:00:00Z"), + grain: "Daily", + startDate: new Date("2022-06-01T00:00:00Z"), + }, + ); + console.log(result); +} + +async function main(): Promise { + await generateUtilizationSummariesReportBySavingsPlanOrder(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/generateCostDetailsReportCreateOperationSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/generateCostDetailsReportCreateOperationSample.ts index 4fa610224d14..402084ea55ac 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/generateCostDetailsReportCreateOperationSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/generateCostDetailsReportCreateOperationSample.ts @@ -1,155 +1,117 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * - * @summary This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod.json - */ - -import type { GenerateCostDetailsReportRequestDefinition } from "@azure/arm-costmanagement"; import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields + * + * @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields + * x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod.json + */ async function generateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345"; - const parameters: GenerateCostDetailsReportRequestDefinition = { - billingPeriod: "202205", - metric: "ActualCost", - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateCostDetailsReport.beginCreateOperationAndWait( - scope, - parameters, + const result = await client.generateCostDetailsReport.createOperation( + "providers/Microsoft.Billing/billingAccounts/12345", + { billingPeriod: "202205", metric: "ActualCost" }, ); console.log(result); } /** - * This sample demonstrates how to This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields + * This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields * - * @summary This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByBillingProfileAndInvoiceId.json + * @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields + * x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByBillingProfileAndInvoiceId.json */ async function generateCostDetailsReportByBillingProfileAndInvoiceId(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; - const parameters: GenerateCostDetailsReportRequestDefinition = { - invoiceId: "M1234567", - metric: "ActualCost", - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateCostDetailsReport.beginCreateOperationAndWait( - scope, - parameters, + const result = await client.generateCostDetailsReport.createOperation( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + { invoiceId: "M1234567", metric: "ActualCost" }, ); console.log(result); } /** - * This sample demonstrates how to This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields + * This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields * - * @summary This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByBillingProfileAndInvoiceIdAndCustomerId.json + * @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields + * x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByBillingProfileAndInvoiceIdAndCustomerId.json */ async function generateCostDetailsReportByBillingProfileAndInvoiceIdAndCustomerId(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579"; - const parameters: GenerateCostDetailsReportRequestDefinition = { - invoiceId: "M1234567", - metric: "ActualCost", - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateCostDetailsReport.beginCreateOperationAndWait( - scope, - parameters, + const result = await client.generateCostDetailsReport.createOperation( + "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579", + { invoiceId: "M1234567", metric: "ActualCost" }, ); console.log(result); } /** - * This sample demonstrates how to This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields + * This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields * - * @summary This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByCustomerAndTimePeriod.json + * @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields + * x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByCustomerAndTimePeriod.json */ async function generateCostDetailsReportByCustomerAndTimePeriod(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579"; - const parameters: GenerateCostDetailsReportRequestDefinition = { - metric: "ActualCost", - timePeriod: { end: "2020-03-15", start: "2020-03-01" }, - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateCostDetailsReport.beginCreateOperationAndWait( - scope, - parameters, + const result = await client.generateCostDetailsReport.createOperation( + "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579", + { metric: "ActualCost", timePeriod: { end: "2020-03-15", start: "2020-03-01" } }, ); console.log(result); } /** - * This sample demonstrates how to This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields + * This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields * - * @summary This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByDepartmentsAndTimePeriod.json + * @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields + * x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByDepartmentsAndTimePeriod.json */ async function generateCostDetailsReportByDepartmentsAndTimePeriod(): Promise { - const scope = "providers/Microsoft.Billing/departments/12345"; - const parameters: GenerateCostDetailsReportRequestDefinition = { - metric: "ActualCost", - timePeriod: { end: "2020-03-15", start: "2020-03-01" }, - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateCostDetailsReport.beginCreateOperationAndWait( - scope, - parameters, + const result = await client.generateCostDetailsReport.createOperation( + "providers/Microsoft.Billing/departments/12345", + { metric: "ActualCost", timePeriod: { end: "2020-03-15", start: "2020-03-01" } }, ); console.log(result); } /** - * This sample demonstrates how to This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields + * This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields * - * @summary This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByEnrollmentAccountsAndTimePeriod.json + * @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields + * x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByEnrollmentAccountsAndTimePeriod.json */ async function generateCostDetailsReportByEnrollmentAccountsAndTimePeriod(): Promise { - const scope = "providers/Microsoft.Billing/enrollmentAccounts/1234"; - const parameters: GenerateCostDetailsReportRequestDefinition = { - metric: "ActualCost", - timePeriod: { end: "2020-03-15", start: "2020-03-01" }, - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateCostDetailsReport.beginCreateOperationAndWait( - scope, - parameters, + const result = await client.generateCostDetailsReport.createOperation( + "providers/Microsoft.Billing/enrollmentAccounts/1234", + { metric: "ActualCost", timePeriod: { end: "2020-03-15", start: "2020-03-01" } }, ); console.log(result); } /** - * This sample demonstrates how to This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields + * This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields * - * @summary This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportBySubscriptionAndTimePeriod.json + * @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields + * x-ms-original-file: 2025-03-01/GenerateCostDetailsReportBySubscriptionAndTimePeriod.json */ async function generateCostDetailsReportBySubscriptionAndTimePeriod(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const parameters: GenerateCostDetailsReportRequestDefinition = { - metric: "ActualCost", - timePeriod: { end: "2020-03-15", start: "2020-03-01" }, - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateCostDetailsReport.beginCreateOperationAndWait( - scope, - parameters, + const result = await client.generateCostDetailsReport.createOperation( + "subscriptions/00000000-0000-0000-0000-000000000000", + { metric: "ActualCost", timePeriod: { end: "2020-03-15", start: "2020-03-01" } }, ); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/generateCostDetailsReportGetOperationResultsSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/generateCostDetailsReportGetOperationResultsSample.ts index 6c79f763cf95..8fecb7092340 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/generateCostDetailsReportGetOperationResultsSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/generateCostDetailsReportGetOperationResultsSample.ts @@ -1,25 +1,21 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get the result of the specified operation. This link is provided in the CostDetails creation request response Location header. - * - * @summary Get the result of the specified operation. This link is provided in the CostDetails creation request response Location header. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/CostDetailsOperationResultsBySubscriptionScope.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get the result of the specified operation. This link is provided in the CostDetails creation request response Location header. + * + * @summary get the result of the specified operation. This link is provided in the CostDetails creation request response Location header. + * x-ms-original-file: 2025-03-01/CostDetailsOperationResultsBySubscriptionScope.json + */ async function getDetailsOfTheOperationResult(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const operationId = "00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateCostDetailsReport.beginGetOperationResultsAndWait( - scope, - operationId, + const result = await client.generateCostDetailsReport.getOperationResults( + "subscriptions/00000000-0000-0000-0000-000000000000", + "00000000-0000-0000-0000-000000000000", ); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/generateDetailedCostReportCreateOperationSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/generateDetailedCostReportCreateOperationSample.ts index 658d24f36d1b..26e96c773629 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/generateDetailedCostReportCreateOperationSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/generateDetailedCostReportCreateOperationSample.ts @@ -1,114 +1,85 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to 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. - * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportByBillingAccountLegacyAndBillingPeriod.json - */ - -import type { GenerateDetailedCostReportDefinition } from "@azure/arm-costmanagement"; import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/GenerateDetailedCostReportByBillingAccountLegacyAndBillingPeriod.json + */ async function generateDetailedCostReportByBillingAccountLegacyAndBillingPeriod(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345"; - const parameters: GenerateDetailedCostReportDefinition = { - billingPeriod: "202008", - metric: "ActualCost", - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateDetailedCostReport.beginCreateOperationAndWait( - scope, - parameters, + const result = await client.generateDetailedCostReport.createOperation( + "providers/Microsoft.Billing/billingAccounts/12345", + { billingPeriod: "202008", metric: "ActualCost" }, ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportByBillingProfileAndInvoiceId.json + * @summary 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. + * x-ms-original-file: 2025-03-01/GenerateDetailedCostReportByBillingProfileAndInvoiceId.json */ async function generateDetailedCostReportByBillingProfileAndInvoiceId(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; - const parameters: GenerateDetailedCostReportDefinition = { - invoiceId: "M1234567", - metric: "ActualCost", - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateDetailedCostReport.beginCreateOperationAndWait( - scope, - parameters, + const result = await client.generateDetailedCostReport.createOperation( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + { invoiceId: "M1234567", metric: "ActualCost" }, ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportByBillingProfileAndInvoiceIdAndCustomerId.json + * @summary 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. + * x-ms-original-file: 2025-03-01/GenerateDetailedCostReportByBillingProfileAndInvoiceIdAndCustomerId.json */ async function generateDetailedCostReportByBillingProfileAndInvoiceIdAndCustomerId(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; - const parameters: GenerateDetailedCostReportDefinition = { - customerId: "456789", - invoiceId: "M1234567", - metric: "ActualCost", - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateDetailedCostReport.beginCreateOperationAndWait( - scope, - parameters, + const result = await client.generateDetailedCostReport.createOperation( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + { customerId: "456789", invoiceId: "M1234567", metric: "ActualCost" }, ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportByCustomerAndTimePeriod.json + * @summary 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. + * x-ms-original-file: 2025-03-01/GenerateDetailedCostReportByCustomerAndTimePeriod.json */ async function generateDetailedCostReportByCustomerAndTimePeriod(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579"; - const parameters: GenerateDetailedCostReportDefinition = { - metric: "ActualCost", - timePeriod: { end: "2020-03-15", start: "2020-03-01" }, - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateDetailedCostReport.beginCreateOperationAndWait( - scope, - parameters, + const result = await client.generateDetailedCostReport.createOperation( + "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579", + { metric: "ActualCost", timePeriod: { end: "2020-03-15", start: "2020-03-01" } }, ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportBySubscriptionAndTimePeriod.json + * @summary 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. + * x-ms-original-file: 2025-03-01/GenerateDetailedCostReportBySubscriptionAndTimePeriod.json */ async function generateDetailedCostReportBySubscriptionAndTimePeriod(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const parameters: GenerateDetailedCostReportDefinition = { - metric: "ActualCost", - timePeriod: { end: "2020-03-15", start: "2020-03-01" }, - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateDetailedCostReport.beginCreateOperationAndWait( - scope, - parameters, + const result = await client.generateDetailedCostReport.createOperation( + "subscriptions/00000000-0000-0000-0000-000000000000", + { metric: "ActualCost", timePeriod: { end: "2020-03-15", start: "2020-03-01" } }, ); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/generateDetailedCostReportOperationResultsGetSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/generateDetailedCostReportOperationResultsGetSample.ts index 1445f0985ce9..ea8e08dbf946 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/generateDetailedCostReportOperationResultsGetSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/generateDetailedCostReportOperationResultsGetSample.ts @@ -1,25 +1,21 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Gets the result of the specified operation. The link with this operationId is provided as a response header of the initial request. - * - * @summary Gets the result of the specified operation. The link with this operationId is provided as a response header of the initial request. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportOperationResultsBySubscriptionScope.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to gets the result of the specified operation. The link with this operationId is provided as a response header of the initial request. + * + * @summary gets the result of the specified operation. The link with this operationId is provided as a response header of the initial request. + * x-ms-original-file: 2025-03-01/GenerateDetailedCostReportOperationResultsBySubscriptionScope.json + */ async function getDetailsOfTheOperationResult(): Promise { - const operationId = "00000000-0000-0000-0000-000000000000"; - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateDetailedCostReportOperationResults.beginGetAndWait( - operationId, - scope, + const result = await client.generateDetailedCostReportOperationResults.get( + "00000000-0000-0000-0000-000000000000", + "subscriptions/00000000-0000-0000-0000-000000000000", ); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/generateDetailedCostReportOperationStatusGetSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/generateDetailedCostReportOperationStatusGetSample.ts index f33d9062210e..04c2a2c9ad03 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/generateDetailedCostReportOperationStatusGetSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/generateDetailedCostReportOperationStatusGetSample.ts @@ -1,23 +1,22 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get the status of the specified operation. This link is provided in the GenerateDetailedCostReport creation request response header. - * - * @summary Get the status of the specified operation. This link is provided in the GenerateDetailedCostReport creation request response header. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportOperationStatusBySubscriptionScope.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get the status of the specified operation. This link is provided in the GenerateDetailedCostReport creation request response header. + * + * @summary get the status of the specified operation. This link is provided in the GenerateDetailedCostReport creation request response header. + * x-ms-original-file: 2025-03-01/GenerateDetailedCostReportOperationStatusBySubscriptionScope.json + */ async function getDetailsOfTheOperationStatus(): Promise { - const operationId = "00000000-0000-0000-0000-000000000000"; - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateDetailedCostReportOperationStatus.get(operationId, scope); + const result = await client.generateDetailedCostReportOperationStatus.get( + "00000000-0000-0000-0000-000000000000", + "subscriptions/00000000-0000-0000-0000-000000000000", + ); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/generateReservationDetailsReportByBillingAccountIdSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/generateReservationDetailsReportByBillingAccountIdSample.ts index f78980b85320..74adeaa72fec 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/generateReservationDetailsReportByBillingAccountIdSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/generateReservationDetailsReportByBillingAccountIdSample.ts @@ -1,27 +1,22 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to 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://learn.microsoft.com/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role - * - * @summary 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://learn.microsoft.com/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateReservationDetailsReportByBillingAccount.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to 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 + * + * @summary 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 + * x-ms-original-file: 2025-03-01/GenerateReservationDetailsReportByBillingAccount.json + */ async function reservationDetails(): Promise { - const billingAccountId = "9845612"; - const startDate = "2020-01-01"; - const endDate = "2020-01-30"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateReservationDetailsReport.beginByBillingAccountIdAndWait( - billingAccountId, - startDate, - endDate, + const result = await client.generateReservationDetailsReport.byBillingAccountId( + "9845612", + "2020-01-01", + "2020-01-30", ); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/generateReservationDetailsReportByBillingProfileIdSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/generateReservationDetailsReportByBillingProfileIdSample.ts index ec9064c25617..69e7a369c4d8 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/generateReservationDetailsReportByBillingProfileIdSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/generateReservationDetailsReportByBillingProfileIdSample.ts @@ -1,29 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to 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://learn.microsoft.com/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access - * - * @summary 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://learn.microsoft.com/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateReservationDetailsReportByBillingProfile.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to 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 + * + * @summary 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 + * x-ms-original-file: 2025-03-01/GenerateReservationDetailsReportByBillingProfile.json + */ async function reservationDetails(): Promise { - const billingAccountId = "00000000-0000-0000-0000-000000000000"; - const billingProfileId = "CZSFR-SDFXC-DSDF"; - const startDate = "2020-01-01"; - const endDate = "2020-01-30"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateReservationDetailsReport.beginByBillingProfileIdAndWait( - billingAccountId, - billingProfileId, - startDate, - endDate, + const result = await client.generateReservationDetailsReport.byBillingProfileId( + "00000000-0000-0000-0000-000000000000", + "CZSFR-SDFXC-DSDF", + "2020-01-01", + "2020-01-30", ); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/operationsListSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/operationsListSample.ts index 32d2a5f1f138..de6fa34cc976 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/operationsListSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/operationsListSample.ts @@ -1,17 +1,15 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Lists all of the available cost management REST API operations. - * - * @summary Lists all of the available cost management REST API operations. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/OperationList.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to list the operations for the provider + * + * @summary list the operations for the provider + * x-ms-original-file: 2025-03-01/OperationList.json + */ async function operationList(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); @@ -19,6 +17,7 @@ async function operationList(): Promise { for await (const item of client.operations.list()) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/priceSheetDownloadByBillingAccountSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/priceSheetDownloadByBillingAccountSample.ts new file mode 100644 index 000000000000..8e4c12e3c044 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples-dev/priceSheetDownloadByBillingAccountSample.ts @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to generates the pricesheet for the provided billing period asynchronously based on the Enrollment ID. This is for Enterprise Agreement customers. + * + * **Migrate to version 2025-03-01** + * + * You can use the 2025-03-01 API version with the new URI: + * + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.CostManagement/pricesheets/default/download' + * + * With a new schema detailed below, the new version of the price sheet provides additional information and includes prices for Azure Reserved Instances (RI) for the current billing period. We recommend downloading an Azure Price Sheet for when entering a new billing period if you would maintain an ongoing record of past Azure Reserved Instance (RI) pricing. + * + * The EA Azure price sheet is available for billing periods in the past 13 months. To request a price sheet for a billing period older than 13 months, please contact support. + * + * The Azure price sheet download experience has been updated from a single .csv file to a zip file containing multiple .csv files, each with max size of 75MB. The 2023-11-01 version has been upgraded to use http POST method; details can be found below. + * + * All versions of the Microsoft.Consumption Azure Price Sheet - Download by Billing Account (including 2022-06-01, 2021-10-01, 2020-01-01-preview, 2019-10-01, 2019-05-01) are scheduled to be retired on 01 June 2026 and will no longer be supported after this date. + * + * @summary generates the pricesheet for the provided billing period asynchronously based on the Enrollment ID. This is for Enterprise Agreement customers. + * + * **Migrate to version 2025-03-01** + * + * You can use the 2025-03-01 API version with the new URI: + * + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.CostManagement/pricesheets/default/download' + * + * With a new schema detailed below, the new version of the price sheet provides additional information and includes prices for Azure Reserved Instances (RI) for the current billing period. We recommend downloading an Azure Price Sheet for when entering a new billing period if you would maintain an ongoing record of past Azure Reserved Instance (RI) pricing. + * + * The EA Azure price sheet is available for billing periods in the past 13 months. To request a price sheet for a billing period older than 13 months, please contact support. + * + * The Azure price sheet download experience has been updated from a single .csv file to a zip file containing multiple .csv files, each with max size of 75MB. The 2023-11-01 version has been upgraded to use http POST method; details can be found below. + * + * All versions of the Microsoft.Consumption Azure Price Sheet - Download by Billing Account (including 2022-06-01, 2021-10-01, 2020-01-01-preview, 2019-10-01, 2019-05-01) are scheduled to be retired on 01 June 2026 and will no longer be supported after this date. + * x-ms-original-file: 2025-03-01/EAPriceSheetForBillingPeriod.json + */ +async function eaPriceSheetForBillingPeriod(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.priceSheet.downloadByBillingAccount("0000000", "202311"); + console.log(result); +} + +async function main(): Promise { + await eaPriceSheetForBillingPeriod(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/priceSheetDownloadByBillingProfileSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/priceSheetDownloadByBillingProfileSample.ts index 8983f51e3a3b..cabc95ca36c8 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/priceSheetDownloadByBillingProfileSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/priceSheetDownloadByBillingProfileSample.ts @@ -1,26 +1,29 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to 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. - * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PricesheetDownloadByBillingProfile.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to 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. + * + * You can use the new 2023-09-01 API version for billing periods January 2023 onwards. Azure Reserved Instance (RI) pricing is only available through the new version of the API. + * + * Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv/json file to a Zip file containing multiple csv/json files, each with max size of 75MB. + * + * @summary 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. + * + * You can use the new 2023-09-01 API version for billing periods January 2023 onwards. Azure Reserved Instance (RI) pricing is only available through the new version of the API. + * + * Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv/json file to a Zip file containing multiple csv/json files, each with max size of 75MB. + * x-ms-original-file: 2025-03-01/PricesheetDownloadByBillingProfile.json + */ async function pricesheetDownloadByBillingProfile(): Promise { - const billingAccountName = - "7c05a543-80ff-571e-9f98-1063b3b53cf2:99ad03ad-2d1b-4889-a452-090ad407d25f_2019-05-31"; - const billingProfileName = "2USN-TPCD-BG7-TGB"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.priceSheet.beginDownloadByBillingProfileAndWait( - billingAccountName, - billingProfileName, + const result = await client.priceSheet.downloadByBillingProfile( + "7c05a543-80ff-571e-9f98-1063b3b53cf2:99ad03ad-2d1b-4889-a452-090ad407d25f_2019-05-31", + "2USN-TPCD-BG7-TGB", ); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/priceSheetDownloadSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/priceSheetDownloadByInvoiceSample.ts similarity index 59% rename from sdk/cost-management/arm-costmanagement/samples-dev/priceSheetDownloadSample.ts rename to sdk/cost-management/arm-costmanagement/samples-dev/priceSheetDownloadByInvoiceSample.ts index ebf88b6e206e..cb43bf813647 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/priceSheetDownloadSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/priceSheetDownloadByInvoiceSample.ts @@ -1,28 +1,22 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to 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. - * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PricesheetDownload.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/PricesheetDownload.json + */ async function pricesheetDownload(): Promise { - const billingAccountName = - "7c05a543-80ff-571e-9f98-1063b3b53cf2:99ad03ad-2d1b-4889-a452-090ad407d25f_2019-05-31"; - const billingProfileName = "2USN-TPCD-BG7-TGB"; - const invoiceName = "T000940677"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.priceSheet.beginDownloadAndWait( - billingAccountName, - billingProfileName, - invoiceName, + const result = await client.priceSheet.downloadByInvoice( + "7c05a543-80ff-571e-9f98-1063b3b53cf2:99ad03ad-2d1b-4889-a452-090ad407d25f_2019-05-31", + "2USN-TPCD-BG7-TGB", + "T000940677", ); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/queryUsageByExternalCloudProviderTypeSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/queryUsageByExternalCloudProviderTypeSample.ts index 8572409902fa..8673c54109d0 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/queryUsageByExternalCloudProviderTypeSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/queryUsageByExternalCloudProviderTypeSample.ts @@ -1,118 +1,85 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Query the usage data for external cloud provider type defined. - * - * @summary Query the usage data for external cloud provider type defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalBillingAccountsQuery.json - */ - -import type { QueryDefinition } from "@azure/arm-costmanagement"; import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to query the usage data for external cloud provider type defined. + * + * @summary query the usage data for external cloud provider type defined. + * x-ms-original-file: 2025-03-01/ExternalBillingAccountsQuery.json + */ async function externalBillingAccountQueryList(): Promise { - const externalCloudProviderType = "externalBillingAccounts"; - const externalCloudProviderId = "100"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usageByExternalCloudProviderType( + "externalBillingAccounts", + "100", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usageByExternalCloudProviderType( - externalCloudProviderType, - externalCloudProviderId, - parameters, ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for external cloud provider type defined. + * This sample demonstrates how to query the usage data for external cloud provider type defined. * - * @summary Query the usage data for external cloud provider type defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalSubscriptionsQuery.json + * @summary query the usage data for external cloud provider type defined. + * x-ms-original-file: 2025-03-01/ExternalSubscriptionsQuery.json */ async function externalSubscriptionsQuery(): Promise { - const externalCloudProviderType = "externalSubscriptions"; - const externalCloudProviderId = "100"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usageByExternalCloudProviderType( + "externalSubscriptions", + "100", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usageByExternalCloudProviderType( - externalCloudProviderType, - externalCloudProviderId, - parameters, ); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/queryUsageSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/queryUsageSample.ts index eba4c64938d5..6094c6056deb 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/queryUsageSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/queryUsageSample.ts @@ -1,71 +1,19 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Query the usage data for scope defined. - * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountQuery.json - */ - -import type { QueryDefinition } from "@azure/arm-costmanagement"; import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -async function billingAccountQueryLegacy(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/70664866"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], - }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], - }, - }, - ], - }, - granularity: "Daily", - }, - timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); - console.log(result); -} /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingAccountQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/BillingAccountQuery.json */ -async function billingAccountQueryMca(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789"; - const parameters: QueryDefinition = { +async function billingAccountQueryLegacy(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage("providers/Microsoft.Billing/billingAccounts/70664866", { type: "Usage", dataset: { filter: { @@ -79,43 +27,29 @@ async function billingAccountQueryMca(): Promise { values: ["East US", "West Europe"], }, }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], - }, - }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, ], }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], - }, - }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, ], }, granularity: "Daily", }, timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + }); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/BillingAccountQueryGrouping.json */ async function billingAccountQueryGroupingLegacy(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/70664866"; - const parameters: QueryDefinition = { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage("providers/Microsoft.Billing/billingAccounts/70664866", { type: "Usage", dataset: { aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, @@ -123,560 +57,524 @@ async function billingAccountQueryGroupingLegacy(): Promise { grouping: [{ name: "ResourceGroup", type: "Dimension" }], }, timeframe: "TheLastMonth", - }; + }); + console.log(result); +} + +/** + * This sample demonstrates how to query the usage data for scope defined. + * + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/DepartmentQuery.json + */ +async function departmentQueryLegacy(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/100/departments/123", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, + }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], + }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", + }, + timeframe: "MonthToDate", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingAccountQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/DepartmentQueryGrouping.json */ -async function billingAccountQueryGroupingMca(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "None", - grouping: [{ name: "ResourceGroup", type: "Dimension" }], - }, - timeframe: "TheLastMonth", - }; +async function departmentQueryGroupingLegacy(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/100/departments/123", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "None", + grouping: [{ name: "ResourceGroup", type: "Dimension" }], + }, + timeframe: "TheLastMonth", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingProfileQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/EnrollmentAccountQuery.json */ -async function billingProfileQueryMca(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], +async function enrollmentAccountQueryLegacy(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingProfileQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/EnrollmentAccountQueryGrouping.json */ -async function billingProfileQueryGroupingMca(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "None", - grouping: [{ name: "ResourceGroup", type: "Dimension" }], - }, - timeframe: "TheLastMonth", - }; +async function enrollmentAccountQueryGroupingLegacy(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "Daily", + grouping: [{ name: "ResourceGroup", type: "Dimension" }], + }, + timeframe: "TheLastMonth", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCACustomerQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/MCABillingAccountQuery.json */ -async function customerQueryMca(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], +async function billingAccountQueryMCA(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCACustomerQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/MCABillingAccountQueryGrouping.json */ -async function customerQueryGroupingMca(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "None", - grouping: [{ name: "ResourceGroup", type: "Dimension" }], - }, - timeframe: "TheLastMonth", - }; +async function billingAccountQueryGroupingMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "None", + grouping: [{ name: "ResourceGroup", type: "Dimension" }], + }, + timeframe: "TheLastMonth", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/MCABillingProfileQuery.json */ -async function departmentQueryLegacy(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/100/departments/123"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], +async function billingProfileQueryMCA(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/MCABillingProfileQueryGrouping.json */ -async function departmentQueryGroupingLegacy(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/100/departments/123"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "None", - grouping: [{ name: "ResourceGroup", type: "Dimension" }], - }, - timeframe: "TheLastMonth", - }; +async function billingProfileQueryGroupingMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "None", + grouping: [{ name: "ResourceGroup", type: "Dimension" }], + }, + timeframe: "TheLastMonth", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/MCACustomerQuery.json */ -async function enrollmentAccountQueryLegacy(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], +async function customerQueryMCA(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/MCACustomerQueryGrouping.json */ -async function enrollmentAccountQueryGroupingLegacy(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "Daily", - grouping: [{ name: "ResourceGroup", type: "Dimension" }], - }, - timeframe: "TheLastMonth", - }; +async function customerQueryGroupingMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "None", + grouping: [{ name: "ResourceGroup", type: "Dimension" }], + }, + timeframe: "TheLastMonth", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCAInvoiceSectionQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/MCAInvoiceSectionQuery.json */ -async function invoiceSectionQueryMca(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], +async function invoiceSectionQueryMCA(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCAInvoiceSectionQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/MCAInvoiceSectionQueryGrouping.json */ -async function invoiceSectionQueryGroupingMca(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "None", - grouping: [{ name: "ResourceGroup", type: "Dimension" }], - }, - timeframe: "TheLastMonth", - }; +async function invoiceSectionQueryGroupingMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "None", + grouping: [{ name: "ResourceGroup", type: "Dimension" }], + }, + timeframe: "TheLastMonth", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ManagementGroupQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/ManagementGroupQuery.json */ async function managementGroupQueryLegacy(): Promise { - const scope = "providers/Microsoft.Management/managementGroups/MyMgId"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage( + "providers/Microsoft.Management/managementGroups/MyMgId", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ManagementGroupQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/ManagementGroupQueryGrouping.json */ async function managementGroupQueryGroupingLegacy(): Promise { - const scope = "providers/Microsoft.Management/managementGroups/MyMgId"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "None", - grouping: [{ name: "ResourceGroup", type: "Dimension" }], - }, - timeframe: "TheLastMonth", - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Management/managementGroups/MyMgId", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "None", + grouping: [{ name: "ResourceGroup", type: "Dimension" }], + }, + timeframe: "TheLastMonth", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ResourceGroupQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/ResourceGroupQuery.json */ async function resourceGroupQueryLegacy(): Promise { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ResourceGroupQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/ResourceGroupQueryGrouping.json */ async function resourceGroupQueryGroupingLegacy(): Promise { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "Daily", - grouping: [{ name: "ResourceType", type: "Dimension" }], - }, - timeframe: "TheLastMonth", - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "Daily", + grouping: [{ name: "ResourceType", type: "Dimension" }], + }, + timeframe: "TheLastMonth", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SubscriptionQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/SubscriptionQuery.json */ async function subscriptionQueryLegacy(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const parameters: QueryDefinition = { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage("subscriptions/00000000-0000-0000-0000-000000000000", { type: "Usage", dataset: { filter: { @@ -690,43 +588,29 @@ async function subscriptionQueryLegacy(): Promise { values: ["East US", "West Europe"], }, }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], - }, - }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, ], }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], - }, - }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, ], }, granularity: "Daily", }, timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + }); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SubscriptionQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/SubscriptionQueryGrouping.json */ async function subscriptionQueryGroupingLegacy(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const parameters: QueryDefinition = { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage("subscriptions/00000000-0000-0000-0000-000000000000", { type: "Usage", dataset: { aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, @@ -734,28 +618,25 @@ async function subscriptionQueryGroupingLegacy(): Promise { grouping: [{ name: "ResourceGroup", type: "Dimension" }], }, timeframe: "TheLastMonth", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + }); console.log(result); } async function main(): Promise { await billingAccountQueryLegacy(); - await billingAccountQueryMca(); await billingAccountQueryGroupingLegacy(); - await billingAccountQueryGroupingMca(); - await billingProfileQueryMca(); - await billingProfileQueryGroupingMca(); - await customerQueryMca(); - await customerQueryGroupingMca(); await departmentQueryLegacy(); await departmentQueryGroupingLegacy(); await enrollmentAccountQueryLegacy(); await enrollmentAccountQueryGroupingLegacy(); - await invoiceSectionQueryMca(); - await invoiceSectionQueryGroupingMca(); + await billingAccountQueryMCA(); + await billingAccountQueryGroupingMCA(); + await billingProfileQueryMCA(); + await billingProfileQueryGroupingMCA(); + await customerQueryMCA(); + await customerQueryGroupingMCA(); + await invoiceSectionQueryMCA(); + await invoiceSectionQueryGroupingMCA(); await managementGroupQueryLegacy(); await managementGroupQueryGroupingLegacy(); await resourceGroupQueryLegacy(); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsCheckNameAvailabilityByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsCheckNameAvailabilityByScopeSample.ts index 3d0b99e15789..394513bc53f1 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsCheckNameAvailabilityByScopeSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsCheckNameAvailabilityByScopeSample.ts @@ -1,29 +1,21 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Checks availability and correctness of the name for a scheduled action within the given scope. - * - * @summary Checks availability and correctness of the name for a scheduled action within the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/checkNameAvailability-shared-scheduledAction.json - */ - -import type { CheckNameAvailabilityRequest } from "@azure/arm-costmanagement"; import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to checks availability and correctness of the name for a scheduled action within the given scope. + * + * @summary checks availability and correctness of the name for a scheduled action within the given scope. + * x-ms-original-file: 2025-03-01/scheduledActions/checkNameAvailability-shared-scheduledAction.json + */ async function scheduledActionCheckNameAvailabilityByScope(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const checkNameAvailabilityRequest: CheckNameAvailabilityRequest = { - name: "testName", - type: "Microsoft.CostManagement/ScheduledActions", - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const result = await client.scheduledActions.checkNameAvailabilityByScope( - scope, - checkNameAvailabilityRequest, + "subscriptions/00000000-0000-0000-0000-000000000000", + { name: "testName", type: "Microsoft.CostManagement/ScheduledActions" }, ); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsCheckNameAvailabilitySample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsCheckNameAvailabilitySample.ts index aad0cb9f6639..c0e2b0bf9f09 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsCheckNameAvailabilitySample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsCheckNameAvailabilitySample.ts @@ -1,26 +1,22 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Checks availability and correctness of the name for a scheduled action. - * - * @summary Checks availability and correctness of the name for a scheduled action. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/checkNameAvailability-private-scheduledAction.json - */ - -import type { CheckNameAvailabilityRequest } from "@azure/arm-costmanagement"; import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to checks availability and correctness of the name for a scheduled action. + * + * @summary checks availability and correctness of the name for a scheduled action. + * x-ms-original-file: 2025-03-01/scheduledActions/checkNameAvailability-private-scheduledAction.json + */ async function scheduledActionCheckNameAvailability(): Promise { - const checkNameAvailabilityRequest: CheckNameAvailabilityRequest = { - name: "testName", - type: "Microsoft.CostManagement/ScheduledActions", - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.scheduledActions.checkNameAvailability(checkNameAvailabilityRequest); + const result = await client.scheduledActions.checkNameAvailability({ + name: "testName", + type: "Microsoft.CostManagement/ScheduledActions", + }); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsCreateOrUpdateByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsCreateOrUpdateByScopeSample.ts index dfa89fda60a1..156f0102a271 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsCreateOrUpdateByScopeSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsCreateOrUpdateByScopeSample.ts @@ -1,100 +1,80 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Create or update a shared scheduled action within the given scope. - * - * @summary Create or update a shared scheduled action within the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-insightAlert-createOrUpdate-shared.json - */ - -import type { - ScheduledAction, - ScheduledActionsCreateOrUpdateByScopeOptionalParams, -} from "@azure/arm-costmanagement"; import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; -async function createOrUpdateInsightAlertScheduledActionByScope(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const name = "dailyAnomalyByResource"; - const ifMatch = ""; - const scheduledAction: ScheduledAction = { - displayName: "Daily anomaly by resource", - kind: "InsightAlert", - notification: { - subject: "Cost anomaly detected in the resource", - to: ["user@gmail.com", "team@gmail.com"], - }, - schedule: { - endDate: new Date("2021-06-19T22:21:51.1287144Z"), - frequency: "Daily", - startDate: new Date("2020-06-19T22:21:51.1287144Z"), - }, - status: "Enabled", - viewId: "/providers/Microsoft.CostManagement/views/swaggerExample", - }; - const options: ScheduledActionsCreateOrUpdateByScopeOptionalParams = { - ifMatch, - }; +/** + * This sample demonstrates how to create or update a shared scheduled action within the given scope. + * + * @summary create or update a shared scheduled action within the given scope. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-createOrUpdate-shared.json + */ +async function createOrUpdateScheduledActionByScope(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const result = await client.scheduledActions.createOrUpdateByScope( - scope, - name, - scheduledAction, - options, + "subscriptions/00000000-0000-0000-0000-000000000000", + "monthlyCostByResource", + { + kind: "Email", + displayName: "Monthly Cost By Resource", + fileDestination: { fileFormats: ["Csv"] }, + notification: { + subject: "Cost by resource this month", + to: ["user@gmail.com", "team@gmail.com"], + }, + schedule: { + daysOfWeek: ["Monday"], + endDate: new Date("2021-06-19T22:21:51.1287144Z"), + frequency: "Monthly", + hourOfDay: 10, + startDate: new Date("2020-06-19T22:21:51.1287144Z"), + weeksOfMonth: ["First", "Third"], + }, + status: "Enabled", + viewId: "/providers/Microsoft.CostManagement/views/swaggerExample", + }, + { ifMatch: "" }, ); console.log(result); } /** - * This sample demonstrates how to Create or update a shared scheduled action within the given scope. + * This sample demonstrates how to create or update a shared scheduled action within the given scope. * - * @summary Create or update a shared scheduled action within the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-createOrUpdate-shared.json + * @summary create or update a shared scheduled action within the given scope. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-insightAlert-createOrUpdate-shared.json */ -async function createOrUpdateScheduledActionByScope(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const name = "monthlyCostByResource"; - const ifMatch = ""; - const scheduledAction: ScheduledAction = { - displayName: "Monthly Cost By Resource", - fileDestination: { fileFormats: ["Csv"] }, - kind: "Email", - notification: { - subject: "Cost by resource this month", - to: ["user@gmail.com", "team@gmail.com"], - }, - schedule: { - daysOfWeek: ["Monday"], - endDate: new Date("2021-06-19T22:21:51.1287144Z"), - frequency: "Monthly", - hourOfDay: 10, - startDate: new Date("2020-06-19T22:21:51.1287144Z"), - weeksOfMonth: ["First", "Third"], - }, - status: "Enabled", - viewId: "/providers/Microsoft.CostManagement/views/swaggerExample", - }; - const options: ScheduledActionsCreateOrUpdateByScopeOptionalParams = { - ifMatch, - }; +async function createOrUpdateInsightAlertScheduledActionByScope(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const result = await client.scheduledActions.createOrUpdateByScope( - scope, - name, - scheduledAction, - options, + "subscriptions/00000000-0000-0000-0000-000000000000", + "dailyAnomalyByResource", + { + kind: "InsightAlert", + displayName: "Daily anomaly by resource", + notification: { + subject: "Cost anomaly detected in the resource", + to: ["user@gmail.com", "team@gmail.com"], + }, + schedule: { + endDate: new Date("2021-06-19T22:21:51.1287144Z"), + frequency: "Daily", + startDate: new Date("2020-06-19T22:21:51.1287144Z"), + }, + status: "Enabled", + viewId: "/providers/Microsoft.CostManagement/views/swaggerExample", + }, + { ifMatch: "" }, ); console.log(result); } async function main(): Promise { - await createOrUpdateInsightAlertScheduledActionByScope(); await createOrUpdateScheduledActionByScope(); + await createOrUpdateInsightAlertScheduledActionByScope(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsCreateOrUpdateSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsCreateOrUpdateSample.ts index 73f777e24157..6d9529d1164b 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsCreateOrUpdateSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsCreateOrUpdateSample.ts @@ -1,46 +1,40 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Create or update a private scheduled action. - * - * @summary Create or update a private scheduled action. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-createOrUpdate-private.json - */ - -import type { - ScheduledAction, - ScheduledActionsCreateOrUpdateOptionalParams, -} from "@azure/arm-costmanagement"; import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to create or update a private scheduled action. + * + * @summary create or update a private scheduled action. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-createOrUpdate-private.json + */ async function createOrUpdatePrivateScheduledAction(): Promise { - const name = "monthlyCostByResource"; - const ifMatch = ""; - const scheduledAction: ScheduledAction = { - displayName: "Monthly Cost By Resource", - kind: "Email", - notification: { - subject: "Cost by resource this month", - to: ["user@gmail.com", "team@gmail.com"], - }, - schedule: { - daysOfWeek: ["Monday"], - endDate: new Date("2021-06-19T22:21:51.1287144Z"), - frequency: "Monthly", - hourOfDay: 10, - startDate: new Date("2020-06-19T22:21:51.1287144Z"), - weeksOfMonth: ["First", "Third"], - }, - status: "Enabled", - viewId: "/providers/Microsoft.CostManagement/views/swaggerExample", - }; - const options: ScheduledActionsCreateOrUpdateOptionalParams = { ifMatch }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.scheduledActions.createOrUpdate(name, scheduledAction, options); + const result = await client.scheduledActions.createOrUpdate( + "monthlyCostByResource", + { + kind: "Email", + displayName: "Monthly Cost By Resource", + notification: { + subject: "Cost by resource this month", + to: ["user@gmail.com", "team@gmail.com"], + }, + schedule: { + daysOfWeek: ["Monday"], + endDate: new Date("2021-06-19T22:21:51.1287144Z"), + frequency: "Monthly", + hourOfDay: 10, + startDate: new Date("2020-06-19T22:21:51.1287144Z"), + weeksOfMonth: ["First", "Third"], + }, + status: "Enabled", + viewId: "/providers/Microsoft.CostManagement/views/swaggerExample", + }, + { ifMatch: "" }, + ); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsDeleteByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsDeleteByScopeSample.ts index 50d975909d67..c90a73712fde 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsDeleteByScopeSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsDeleteByScopeSample.ts @@ -1,24 +1,22 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Delete a scheduled action within the given scope. - * - * @summary Delete a scheduled action within the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-delete-shared.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to delete a scheduled action within the given scope. + * + * @summary delete a scheduled action within the given scope. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-delete-shared.json + */ async function scheduledActionDeleteByScope(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const name = "monthlyCostByResource"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.scheduledActions.deleteByScope(scope, name); - console.log(result); + await client.scheduledActions.deleteByScope( + "subscriptions/00000000-0000-0000-0000-000000000000", + "monthlyCostByResource", + ); } async function main(): Promise { diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsDeleteSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsDeleteSample.ts index 77927fe1729a..a98e831b0f17 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsDeleteSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsDeleteSample.ts @@ -1,23 +1,19 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Delete a private scheduled action. - * - * @summary Delete a private scheduled action. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-delete-private.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to delete a private scheduled action. + * + * @summary delete a private scheduled action. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-delete-private.json + */ async function privateScheduledActionDelete(): Promise { - const name = "monthlyCostByResource"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.scheduledActions.delete(name); - console.log(result); + await client.scheduledActions.delete("monthlyCostByResource"); } async function main(): Promise { diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsGetByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsGetByScopeSample.ts index ab133daa7e39..8974e1bcc6ea 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsGetByScopeSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsGetByScopeSample.ts @@ -1,23 +1,22 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get the shared scheduled action from the given scope by name. - * - * @summary Get the shared scheduled action from the given scope by name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-get-shared.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get the shared scheduled action from the given scope by name. + * + * @summary get the shared scheduled action from the given scope by name. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-get-shared.json + */ async function scheduledActionByScope(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const name = "monthlyCostByResource"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.scheduledActions.getByScope(scope, name); + const result = await client.scheduledActions.getByScope( + "subscriptions/00000000-0000-0000-0000-000000000000", + "monthlyCostByResource", + ); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsGetSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsGetSample.ts index 324358a0c2f8..3b809ee5b5aa 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsGetSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsGetSample.ts @@ -1,22 +1,19 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get the private scheduled action by name. - * - * @summary Get the private scheduled action by name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-get-private.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get the private scheduled action by name. + * + * @summary get the private scheduled action by name. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-get-private.json + */ async function privateScheduledAction(): Promise { - const name = "monthlyCostByResource"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.scheduledActions.get(name); + const result = await client.scheduledActions.get("monthlyCostByResource"); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsListByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsListByScopeSample.ts index 9232d1a92319..e6a6a55aca09 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsListByScopeSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsListByScopeSample.ts @@ -1,45 +1,45 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to List all shared scheduled actions within the given scope. - * - * @summary List all shared scheduled actions within the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledActions-list-shared.json - */ - -import type { ScheduledActionsListByScopeOptionalParams } from "@azure/arm-costmanagement"; import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to list all shared scheduled actions within the given scope. + * + * @summary list all shared scheduled actions within the given scope. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledActions-list-shared.json + */ async function scheduledActionsListByScope(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.scheduledActions.listByScope(scope)) { + for await (const item of client.scheduledActions.listByScope( + "subscriptions/00000000-0000-0000-0000-000000000000", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to List all shared scheduled actions within the given scope. + * This sample demonstrates how to list all shared scheduled actions within the given scope. * - * @summary List all shared scheduled actions within the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledActions-listWithFilter-shared.json + * @summary list all shared scheduled actions within the given scope. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledActions-listWithFilter-shared.json */ async function scheduledActionsListByScopeFilterByViewId(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const filter = "properties/viewId eq '/providers/Microsoft.CostManagement/views/swaggerExample'"; - const options: ScheduledActionsListByScopeOptionalParams = { filter }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.scheduledActions.listByScope(scope, options)) { + for await (const item of client.scheduledActions.listByScope( + "subscriptions/00000000-0000-0000-0000-000000000000", + { filter: "properties/viewId eq '/providers/Microsoft.CostManagement/views/swaggerExample'" }, + )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsListSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsListSample.ts index f2fac5b18387..f7a471c472a4 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsListSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsListSample.ts @@ -1,18 +1,15 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to List all private scheduled actions. - * - * @summary List all private scheduled actions. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledActions-list-private.json - */ - -import type { ScheduledActionsListOptionalParams } from "@azure/arm-costmanagement"; import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to list all private scheduled actions. + * + * @summary list all private scheduled actions. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledActions-list-private.json + */ async function privateScheduledActionsList(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); @@ -20,24 +17,26 @@ async function privateScheduledActionsList(): Promise { for await (const item of client.scheduledActions.list()) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to List all private scheduled actions. + * This sample demonstrates how to list all private scheduled actions. * - * @summary List all private scheduled actions. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledActions-listWithFilter-private.json + * @summary list all private scheduled actions. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledActions-listWithFilter-private.json */ async function privateScheduledActionsListFilterByViewId(): Promise { - const filter = "properties/viewId eq '/providers/Microsoft.CostManagement/views/swaggerExample'"; - const options: ScheduledActionsListOptionalParams = { filter }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.scheduledActions.list(options)) { + for await (const item of client.scheduledActions.list({ + filter: "properties/viewId eq '/providers/Microsoft.CostManagement/views/swaggerExample'", + })) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsRunByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsRunByScopeSample.ts index a223d1744b34..621b8543949c 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsRunByScopeSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsRunByScopeSample.ts @@ -1,24 +1,22 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Runs a shared scheduled action within the given scope. - * - * @summary Runs a shared scheduled action within the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-sendNow-shared.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to runs a shared scheduled action within the given scope. + * + * @summary runs a shared scheduled action within the given scope. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-sendNow-shared.json + */ async function scheduledActionRunByScope(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const name = "monthlyCostByResource"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.scheduledActions.runByScope(scope, name); - console.log(result); + await client.scheduledActions.runByScope( + "subscriptions/00000000-0000-0000-0000-000000000000", + "monthlyCostByResource", + ); } async function main(): Promise { diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsRunSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsRunSample.ts index b735140dccd0..5698f838a7e4 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsRunSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/scheduledActionsRunSample.ts @@ -1,23 +1,19 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Processes a private scheduled action. - * - * @summary Processes a private scheduled action. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-sendNow-private.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to processes a private scheduled action. + * + * @summary processes a private scheduled action. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-sendNow-private.json + */ async function scheduledActionSendNow(): Promise { - const name = "monthlyCostByResource"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.scheduledActions.run(name); - console.log(result); + await client.scheduledActions.run("monthlyCostByResource"); } async function main(): Promise { diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/settingsCreateOrUpdateByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/settingsCreateOrUpdateByScopeSample.ts new file mode 100644 index 000000000000..27e173b5c493 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples-dev/settingsCreateOrUpdateByScopeSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create or update a setting within the given scope. + * + * @summary create or update a setting within the given scope. + * x-ms-original-file: 2025-03-01/settings-createOrUpdate.json + */ +async function createOrUpdateSettingByScope(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.settings.createOrUpdateByScope( + "subscriptions/00000000-0000-0000-0000-000000000000", + "taginheritance", + { kind: "taginheritance", properties: { preferContainerTags: false } }, + ); + console.log(result); +} + +async function main(): Promise { + await createOrUpdateSettingByScope(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/settingsDeleteByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/settingsDeleteByScopeSample.ts new file mode 100644 index 000000000000..9097a97031ff --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples-dev/settingsDeleteByScopeSample.ts @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a setting within the given scope. + * + * @summary delete a setting within the given scope. + * x-ms-original-file: 2025-03-01/setting-delete.json + */ +async function settingDeleteByScope(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + await client.settings.deleteByScope( + "subscriptions/00000000-0000-0000-0000-000000000000", + "taginheritance", + ); +} + +async function main(): Promise { + await settingDeleteByScope(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/settingsGetByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/settingsGetByScopeSample.ts new file mode 100644 index 000000000000..780a4dc0fddc --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples-dev/settingsGetByScopeSample.ts @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get the setting from the given scope by name. + * + * @summary get the setting from the given scope by name. + * x-ms-original-file: 2025-03-01/setting-get.json + */ +async function settingByScope(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.settings.getByScope( + "subscriptions/00000000-0000-0000-0000-000000000000", + "taginheritance", + ); + console.log(result); +} + +async function main(): Promise { + await settingByScope(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/settingsListSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/settingsListSample.ts new file mode 100644 index 000000000000..0ef5ea4ce75d --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples-dev/settingsListSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list all cost management settings in the requested scope. + * + * @summary list all cost management settings in the requested scope. + * x-ms-original-file: 2025-03-01/settingsList.json + */ +async function settingsList(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.settings.list("subscriptions/00000000-0000-0000-0000-000000000000"); + console.log(result); +} + +async function main(): Promise { + await settingsList(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/viewsCreateOrUpdateByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/viewsCreateOrUpdateByScopeSample.ts index b4c1fccb1b1e..01a96996c4c8 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/viewsCreateOrUpdateByScopeSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/viewsCreateOrUpdateByScopeSample.ts @@ -1,52 +1,52 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to 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. - * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ViewCreateOrUpdateByResourceGroup.json - */ - -import type { View } from "@azure/arm-costmanagement"; import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/ViewCreateOrUpdateByResourceGroup.json + */ async function resourceGroupCreateOrUpdateView(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; - const viewName = "swaggerExample"; - const parameters: View = { - typePropertiesQueryType: "Usage", - accumulated: "true", - chart: "Table", - dataSet: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "Daily", - grouping: [], - sorting: [{ name: "UsageDate", direction: "Ascending" }], - }, - displayName: "swagger Example", - eTag: '"1d4ff9fe66f1d10"', - kpis: [ - { type: "Forecast", enabled: true, id: undefined }, - { - type: "Budget", - enabled: true, - id: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo", - }, - ], - metric: "ActualCost", - pivots: [ - { name: "ServiceName", type: "Dimension" }, - { name: "MeterCategory", type: "Dimension" }, - { name: "swaggerTagKey", type: "TagKey" }, - ], - timeframe: "MonthToDate", - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.views.createOrUpdateByScope(scope, viewName, parameters); + const result = await client.views.createOrUpdateByScope( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + "swaggerExample", + { + eTag: '"1d4ff9fe66f1d10"', + accumulated: "true", + chart: "Table", + displayName: "swagger Example", + kpis: [ + { type: "Forecast", enabled: true }, + { + type: "Budget", + enabled: true, + id: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo", + }, + ], + metric: "ActualCost", + pivots: [ + { name: "ServiceName", type: "Dimension" }, + { name: "MeterCategory", type: "Dimension" }, + { name: "swaggerTagKey", type: "TagKey" }, + ], + query: { + type: "Usage", + dataSet: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "Daily", + grouping: [], + sorting: [{ name: "UsageDate", direction: "Ascending" }], + }, + timeframe: "MonthToDate", + }, + }, + ); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/viewsCreateOrUpdateSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/viewsCreateOrUpdateSample.ts index 9b8be51e8a58..9e5b93b723a7 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/viewsCreateOrUpdateSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/viewsCreateOrUpdateSample.ts @@ -1,34 +1,25 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to 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. - * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PrivateViewCreateOrUpdate.json - */ - -import type { View } from "@azure/arm-costmanagement"; import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/PrivateViewCreateOrUpdate.json + */ async function createOrUpdatePrivateView(): Promise { - const viewName = "swaggerExample"; - const parameters: View = { - typePropertiesQueryType: "Usage", + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.views.createOrUpdate("swaggerExample", { + eTag: '"1d4ff9fe66f1d10"', accumulated: "true", chart: "Table", - dataSet: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "Daily", - grouping: [], - sorting: [{ name: "UsageDate", direction: "Ascending" }], - }, displayName: "swagger Example", - eTag: '"1d4ff9fe66f1d10"', kpis: [ - { type: "Forecast", enabled: true, id: undefined }, + { type: "Forecast", enabled: true }, { type: "Budget", enabled: true, @@ -41,11 +32,17 @@ async function createOrUpdatePrivateView(): Promise { { name: "MeterCategory", type: "Dimension" }, { name: "swaggerTagKey", type: "TagKey" }, ], - timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.views.createOrUpdate(viewName, parameters); + query: { + type: "Usage", + dataSet: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "Daily", + grouping: [], + sorting: [{ name: "UsageDate", direction: "Ascending" }], + }, + timeframe: "MonthToDate", + }, + }); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/viewsDeleteByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/viewsDeleteByScopeSample.ts index 4410f0936891..340c874d417b 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/viewsDeleteByScopeSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/viewsDeleteByScopeSample.ts @@ -1,24 +1,22 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to The operation to delete a view. - * - * @summary The operation to delete a view. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ViewDeleteByResourceGroup.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to the operation to delete a view. + * + * @summary the operation to delete a view. + * x-ms-original-file: 2025-03-01/ViewDeleteByResourceGroup.json + */ async function resourceGroupDeleteView(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; - const viewName = "TestView"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.views.deleteByScope(scope, viewName); - console.log(result); + await client.views.deleteByScope( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + "TestView", + ); } async function main(): Promise { diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/viewsDeleteSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/viewsDeleteSample.ts index 44bbf96e0153..f89ddce9cb44 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/viewsDeleteSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/viewsDeleteSample.ts @@ -1,23 +1,19 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to The operation to delete a view. - * - * @summary The operation to delete a view. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PrivateViewDelete.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to the operation to delete a view. + * + * @summary the operation to delete a view. + * x-ms-original-file: 2025-03-01/PrivateViewDelete.json + */ async function deletePrivateView(): Promise { - const viewName = "TestView"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.views.delete(viewName); - console.log(result); + await client.views.delete("TestView"); } async function main(): Promise { diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/viewsGetByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/viewsGetByScopeSample.ts index 49f8624e19ea..3969679a7f1a 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/viewsGetByScopeSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/viewsGetByScopeSample.ts @@ -1,23 +1,22 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Gets the view for the defined scope by view name. - * - * @summary Gets the view for the defined scope by view name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ViewByResourceGroup.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to gets the view for the defined scope by view name. + * + * @summary gets the view for the defined scope by view name. + * x-ms-original-file: 2025-03-01/ViewByResourceGroup.json + */ async function resourceGroupView(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; - const viewName = "swaggerExample"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.views.getByScope(scope, viewName); + const result = await client.views.getByScope( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + "swaggerExample", + ); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/viewsGetSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/viewsGetSample.ts index 47ab4e223d4c..e2c224892e59 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/viewsGetSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/viewsGetSample.ts @@ -1,22 +1,19 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Gets the view by view name. - * - * @summary Gets the view by view name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PrivateView.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to gets the view by view name. + * + * @summary gets the view by view name. + * x-ms-original-file: 2025-03-01/PrivateView.json + */ async function privateView(): Promise { - const viewName = "swaggerExample"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.views.get(viewName); + const result = await client.views.get("swaggerExample"); console.log(result); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/viewsListByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/viewsListByScopeSample.ts index 0451fba90f0d..63294fe27916 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/viewsListByScopeSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/viewsListByScopeSample.ts @@ -1,25 +1,25 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Lists all views at the given scope. - * - * @summary Lists all views at the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ViewListByResourceGroup.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to lists all views at the given scope. + * + * @summary lists all views at the given scope. + * x-ms-original-file: 2025-03-01/ViewListByResourceGroup.json + */ async function resourceGroupViewList(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (const item of client.views.listByScope(scope)) { + for await (const item of client.views.listByScope( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/cost-management/arm-costmanagement/samples-dev/viewsListSample.ts b/sdk/cost-management/arm-costmanagement/samples-dev/viewsListSample.ts index 90fa58b8cf23..b4b951d35b6c 100644 --- a/sdk/cost-management/arm-costmanagement/samples-dev/viewsListSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples-dev/viewsListSample.ts @@ -1,17 +1,15 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Lists all views by tenant and object. - * - * @summary Lists all views by tenant and object. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PrivateViewList.json - */ - import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to lists all views by tenant and object. + * + * @summary lists all views by tenant and object. + * x-ms-original-file: 2025-03-01/PrivateViewList.json + */ async function privateViewList(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); @@ -19,6 +17,7 @@ async function privateViewList(): Promise { for await (const item of client.views.list()) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/README.md b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/README.md index 1da6540a6006..53aed15f4e1b 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/README.md +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/README.md @@ -1,60 +1,80 @@ -# client library samples for JavaScript (Beta) - -These sample programs show how to use the JavaScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [alertsDismissSample.js][alertsdismisssample] | Dismisses the specified alert x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DismissResourceGroupAlerts.json | -| [alertsGetSample.js][alertsgetsample] | Gets the alert for the scope by alert ID. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SingleResourceGroupAlert.json | -| [alertsListExternalSample.js][alertslistexternalsample] | Lists the Alerts for external cloud provider type defined. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalBillingAccountAlerts.json | -| [alertsListSample.js][alertslistsample] | Lists the alerts for scope defined. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountAlerts.json | -| [benefitRecommendationsListSample.js][benefitrecommendationslistsample] | List of recommendations for purchasing savings plan. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitRecommendationsByBillingAccount.json | -| [benefitUtilizationSummariesListByBillingAccountIdSample.js][benefitutilizationsummarieslistbybillingaccountidsample] | Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitUtilizationSummaries/SavingsPlan-BillingAccount.json | -| [benefitUtilizationSummariesListByBillingProfileIdSample.js][benefitutilizationsummarieslistbybillingprofileidsample] | Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitUtilizationSummaries/SavingsPlan-BillingProfile.json | -| [benefitUtilizationSummariesListBySavingsPlanIdSample.js][benefitutilizationsummarieslistbysavingsplanidsample] | Lists the savings plan utilization summaries for daily or monthly grain. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanId-Monthly.json | -| [benefitUtilizationSummariesListBySavingsPlanOrderSample.js][benefitutilizationsummarieslistbysavingsplanordersample] | Lists the savings plan utilization summaries for daily or monthly grain. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanOrderId-Daily.json | -| [dimensionsByExternalCloudProviderTypeSample.js][dimensionsbyexternalcloudprovidertypesample] | Lists the dimensions by the external cloud provider type. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalBillingAccountsDimensions.json | -| [dimensionsListSample.js][dimensionslistsample] | Lists the dimensions by the defined scope. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountDimensionsList.json | -| [exportsCreateOrUpdateSample.js][exportscreateorupdatesample] | 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. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateByBillingAccount.json | -| [exportsDeleteSample.js][exportsdeletesample] | The operation to delete a export. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteByBillingAccount.json | -| [exportsExecuteSample.js][exportsexecutesample] | The operation to run an export. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunByBillingAccount.json | -| [exportsGetExecutionHistorySample.js][exportsgetexecutionhistorysample] | The operation to get the run history of an export for the defined scope and export name. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetByBillingAccount.json | -| [exportsGetSample.js][exportsgetsample] | The operation to get the export for the defined scope by export name. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetByBillingAccount.json | -| [exportsListSample.js][exportslistsample] | The operation to list all exports at the given scope. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetByBillingAccount.json | -| [forecastExternalCloudProviderUsageSample.js][forecastexternalcloudproviderusagesample] | Lists the forecast charges for external cloud provider type defined. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalBillingAccountForecast.json | -| [forecastUsageSample.js][forecastusagesample] | Lists the forecast charges for scope defined. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountForecast.json | -| [generateCostDetailsReportCreateOperationSample.js][generatecostdetailsreportcreateoperationsample] | This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod.json | -| [generateCostDetailsReportGetOperationResultsSample.js][generatecostdetailsreportgetoperationresultssample] | Get the result of the specified operation. This link is provided in the CostDetails creation request response Location header. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/CostDetailsOperationResultsBySubscriptionScope.json | -| [generateDetailedCostReportCreateOperationSample.js][generatedetailedcostreportcreateoperationsample] | 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. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportByBillingAccountLegacyAndBillingPeriod.json | -| [generateDetailedCostReportOperationResultsGetSample.js][generatedetailedcostreportoperationresultsgetsample] | Gets the result of the specified operation. The link with this operationId is provided as a response header of the initial request. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportOperationResultsBySubscriptionScope.json | -| [generateDetailedCostReportOperationStatusGetSample.js][generatedetailedcostreportoperationstatusgetsample] | Get the status of the specified operation. This link is provided in the GenerateDetailedCostReport creation request response header. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportOperationStatusBySubscriptionScope.json | -| [generateReservationDetailsReportByBillingAccountIdSample.js][generatereservationdetailsreportbybillingaccountidsample] | 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://learn.microsoft.com/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateReservationDetailsReportByBillingAccount.json | -| [generateReservationDetailsReportByBillingProfileIdSample.js][generatereservationdetailsreportbybillingprofileidsample] | 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://learn.microsoft.com/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateReservationDetailsReportByBillingProfile.json | -| [operationsListSample.js][operationslistsample] | Lists all of the available cost management REST API operations. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/OperationList.json | -| [priceSheetDownloadByBillingProfileSample.js][pricesheetdownloadbybillingprofilesample] | 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. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PricesheetDownloadByBillingProfile.json | -| [priceSheetDownloadSample.js][pricesheetdownloadsample] | 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. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PricesheetDownload.json | -| [queryUsageByExternalCloudProviderTypeSample.js][queryusagebyexternalcloudprovidertypesample] | Query the usage data for external cloud provider type defined. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalBillingAccountsQuery.json | -| [queryUsageSample.js][queryusagesample] | Query the usage data for scope defined. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountQuery.json | -| [scheduledActionsCheckNameAvailabilityByScopeSample.js][scheduledactionschecknameavailabilitybyscopesample] | Checks availability and correctness of the name for a scheduled action within the given scope. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/checkNameAvailability-shared-scheduledAction.json | -| [scheduledActionsCheckNameAvailabilitySample.js][scheduledactionschecknameavailabilitysample] | Checks availability and correctness of the name for a scheduled action. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/checkNameAvailability-private-scheduledAction.json | -| [scheduledActionsCreateOrUpdateByScopeSample.js][scheduledactionscreateorupdatebyscopesample] | Create or update a shared scheduled action within the given scope. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-insightAlert-createOrUpdate-shared.json | -| [scheduledActionsCreateOrUpdateSample.js][scheduledactionscreateorupdatesample] | Create or update a private scheduled action. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-createOrUpdate-private.json | -| [scheduledActionsDeleteByScopeSample.js][scheduledactionsdeletebyscopesample] | Delete a scheduled action within the given scope. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-delete-shared.json | -| [scheduledActionsDeleteSample.js][scheduledactionsdeletesample] | Delete a private scheduled action. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-delete-private.json | -| [scheduledActionsGetByScopeSample.js][scheduledactionsgetbyscopesample] | Get the shared scheduled action from the given scope by name. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-get-shared.json | -| [scheduledActionsGetSample.js][scheduledactionsgetsample] | Get the private scheduled action by name. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-get-private.json | -| [scheduledActionsListByScopeSample.js][scheduledactionslistbyscopesample] | List all shared scheduled actions within the given scope. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledActions-list-shared.json | -| [scheduledActionsListSample.js][scheduledactionslistsample] | List all private scheduled actions. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledActions-list-private.json | -| [scheduledActionsRunByScopeSample.js][scheduledactionsrunbyscopesample] | Runs a shared scheduled action within the given scope. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-sendNow-shared.json | -| [scheduledActionsRunSample.js][scheduledactionsrunsample] | Processes a private scheduled action. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-sendNow-private.json | -| [viewsCreateOrUpdateByScopeSample.js][viewscreateorupdatebyscopesample] | 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. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ViewCreateOrUpdateByResourceGroup.json | -| [viewsCreateOrUpdateSample.js][viewscreateorupdatesample] | 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. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PrivateViewCreateOrUpdate.json | -| [viewsDeleteByScopeSample.js][viewsdeletebyscopesample] | The operation to delete a view. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ViewDeleteByResourceGroup.json | -| [viewsDeleteSample.js][viewsdeletesample] | The operation to delete a view. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PrivateViewDelete.json | -| [viewsGetByScopeSample.js][viewsgetbyscopesample] | Gets the view for the defined scope by view name. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ViewByResourceGroup.json | -| [viewsGetSample.js][viewsgetsample] | Gets the view by view name. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PrivateView.json | -| [viewsListByScopeSample.js][viewslistbyscopesample] | Lists all views at the given scope. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ViewListByResourceGroup.json | -| [viewsListSample.js][viewslistsample] | Lists all views by tenant and object. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PrivateViewList.json | +# @azure/arm-costmanagement client library samples for JavaScript (Beta) + +These sample programs show how to use the JavaScript client libraries for @azure/arm-costmanagement in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [alertsDismissSample.js][alertsdismisssample] | dismisses the specified alert x-ms-original-file: 2025-03-01/DismissResourceGroupAlerts.json | +| [alertsGetSample.js][alertsgetsample] | gets the alert for the scope by alert ID. x-ms-original-file: 2025-03-01/SingleResourceGroupAlert.json | +| [alertsListExternalSample.js][alertslistexternalsample] | lists the Alerts for external cloud provider type defined. x-ms-original-file: 2025-03-01/ExternalBillingAccountAlerts.json | +| [alertsListSample.js][alertslistsample] | lists the alerts for scope defined. x-ms-original-file: 2025-03-01/BillingAccountAlerts.json | +| [benefitRecommendationsListSample.js][benefitrecommendationslistsample] | list of recommendations for purchasing savings plan. x-ms-original-file: 2025-03-01/BenefitRecommendationsByBillingAccount.json | +| [benefitUtilizationSummariesListByBillingAccountIdSample.js][benefitutilizationsummarieslistbybillingaccountidsample] | lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/SavingsPlan-BillingAccount.json | +| [benefitUtilizationSummariesListByBillingProfileIdSample.js][benefitutilizationsummarieslistbybillingprofileidsample] | lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/SavingsPlan-BillingProfile.json | +| [benefitUtilizationSummariesListBySavingsPlanIdSample.js][benefitutilizationsummarieslistbysavingsplanidsample] | lists the savings plan utilization summaries for daily or monthly grain. x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanId-Monthly.json | +| [benefitUtilizationSummariesListBySavingsPlanOrderSample.js][benefitutilizationsummarieslistbysavingsplanordersample] | lists the savings plan utilization summaries for daily or monthly grain. x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanOrderId-Daily.json | +| [budgetsCreateOrUpdateSample.js][budgetscreateorupdatesample] | the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/Cost/CreateOrUpdate-Cost-Subscription-Budget.json | +| [budgetsDeleteSample.js][budgetsdeletesample] | the operation to delete a budget. x-ms-original-file: 2025-03-01/Budgets/Delete/DeleteBudget.json | +| [budgetsGetSample.js][budgetsgetsample] | gets the budget for the scope by budget name. x-ms-original-file: 2025-03-01/Budgets/Get/Cost/Get-Cost-Budget.json | +| [budgetsListSample.js][budgetslistsample] | lists all budgets for the defined scope. x-ms-original-file: 2025-03-01/Budgets/List/EA/BillingAccountBudgetsList-EA-CategoryTypeFilter.json | +| [costAllocationRulesCheckNameAvailabilitySample.js][costallocationruleschecknameavailabilitysample] | checks availability and correctness of a name for a cost allocation rule x-ms-original-file: 2025-03-01/CostAllocationRuleCheckNameAvailability.json | +| [costAllocationRulesCreateOrUpdateSample.js][costallocationrulescreateorupdatesample] | create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment. x-ms-original-file: 2025-03-01/CostAllocationRuleCreate.json | +| [costAllocationRulesDeleteSample.js][costallocationrulesdeletesample] | delete cost allocation rule for billing account or enterprise enrollment. x-ms-original-file: 2025-03-01/CostAllocationRuleDelete.json | +| [costAllocationRulesGetSample.js][costallocationrulesgetsample] | get a cost allocation rule by rule name and billing account or enterprise enrollment. x-ms-original-file: 2025-03-01/CostAllocationRuleGet.json | +| [costAllocationRulesListSample.js][costallocationruleslistsample] | get the list of all cost allocation rules for a billing account or enterprise enrollment. x-ms-original-file: 2025-03-01/CostAllocationRulesList.json | +| [dimensionsListByExternalCloudProviderTypeSample.js][dimensionslistbyexternalcloudprovidertypesample] | lists the dimensions by the external cloud provider type. x-ms-original-file: 2025-03-01/ExternalBillingAccountsDimensions.json | +| [dimensionsListSample.js][dimensionslistsample] | lists the dimensions by the defined scope. x-ms-original-file: 2025-03-01/BillingAccountDimensionsList.json | +| [exportsCreateOrUpdateSample.js][exportscreateorupdatesample] | 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. x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByBillingAccount.json | +| [exportsDeleteSample.js][exportsdeletesample] | the operation to delete a export. x-ms-original-file: 2025-03-01/ExportDeleteByBillingAccount.json | +| [exportsExecuteSample.js][exportsexecutesample] | the operation to run an export. x-ms-original-file: 2025-03-01/ExportRunByBillingAccount.json | +| [exportsGetExecutionHistorySample.js][exportsgetexecutionhistorysample] | the operation to get the run history of an export for the defined scope and export name. x-ms-original-file: 2025-03-01/ExportRunHistoryGetByBillingAccount.json | +| [exportsGetSample.js][exportsgetsample] | the operation to get the export for the defined scope by export name. x-ms-original-file: 2025-03-01/ExportGetByBillingAccount.json | +| [exportsListSample.js][exportslistsample] | the operation to list all exports at the given scope. x-ms-original-file: 2025-03-01/ExportsGetByBillingAccount.json | +| [forecastExternalCloudProviderUsageSample.js][forecastexternalcloudproviderusagesample] | lists the forecast charges for external cloud provider type defined. x-ms-original-file: 2025-03-01/ExternalBillingAccountForecast.json | +| [forecastUsageSample.js][forecastusagesample] | lists the forecast charges for scope defined. x-ms-original-file: 2025-03-01/BillingAccountForecast.json | +| [generateBenefitUtilizationSummariesReportGenerateByBillingAccountSample.js][generatebenefitutilizationsummariesreportgeneratebybillingaccountsample] | triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByBillingAccount.json | +| [generateBenefitUtilizationSummariesReportGenerateByBillingProfileSample.js][generatebenefitutilizationsummariesreportgeneratebybillingprofilesample] | triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByBillingProfile.json | +| [generateBenefitUtilizationSummariesReportGenerateByReservationIdSample.js][generatebenefitutilizationsummariesreportgeneratebyreservationidsample] | triggers generation of a benefit utilization summaries report for the provided reservation. x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByReservation.json | +| [generateBenefitUtilizationSummariesReportGenerateByReservationOrderIdSample.js][generatebenefitutilizationsummariesreportgeneratebyreservationorderidsample] | triggers generation of a benefit utilization summaries report for the provided reservation order. x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByReservationOrder.json | +| [generateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdSample.js][generatebenefitutilizationsummariesreportgeneratebysavingsplanidsample] | triggers generation of a benefit utilization summaries report for the provided savings plan. x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportBySavingsPlan.json | +| [generateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdSample.js][generatebenefitutilizationsummariesreportgeneratebysavingsplanorderidsample] | triggers generation of a benefit utilization summaries report for the provided savings plan order. x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportBySavingsPlanOrder.json | +| [generateCostDetailsReportCreateOperationSample.js][generatecostdetailsreportcreateoperationsample] | this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod.json | +| [generateCostDetailsReportGetOperationResultsSample.js][generatecostdetailsreportgetoperationresultssample] | get the result of the specified operation. This link is provided in the CostDetails creation request response Location header. x-ms-original-file: 2025-03-01/CostDetailsOperationResultsBySubscriptionScope.json | +| [generateDetailedCostReportCreateOperationSample.js][generatedetailedcostreportcreateoperationsample] | 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. x-ms-original-file: 2025-03-01/GenerateDetailedCostReportByBillingAccountLegacyAndBillingPeriod.json | +| [generateDetailedCostReportOperationResultsGetSample.js][generatedetailedcostreportoperationresultsgetsample] | gets the result of the specified operation. The link with this operationId is provided as a response header of the initial request. x-ms-original-file: 2025-03-01/GenerateDetailedCostReportOperationResultsBySubscriptionScope.json | +| [generateDetailedCostReportOperationStatusGetSample.js][generatedetailedcostreportoperationstatusgetsample] | get the status of the specified operation. This link is provided in the GenerateDetailedCostReport creation request response header. x-ms-original-file: 2025-03-01/GenerateDetailedCostReportOperationStatusBySubscriptionScope.json | +| [generateReservationDetailsReportByBillingAccountIdSample.js][generatereservationdetailsreportbybillingaccountidsample] | 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 x-ms-original-file: 2025-03-01/GenerateReservationDetailsReportByBillingAccount.json | +| [generateReservationDetailsReportByBillingProfileIdSample.js][generatereservationdetailsreportbybillingprofileidsample] | 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 x-ms-original-file: 2025-03-01/GenerateReservationDetailsReportByBillingProfile.json | +| [operationsListSample.js][operationslistsample] | list the operations for the provider x-ms-original-file: 2025-03-01/OperationList.json | +| [priceSheetDownloadByBillingAccountSample.js][pricesheetdownloadbybillingaccountsample] | generates the pricesheet for the provided billing period asynchronously based on the Enrollment ID. This is for Enterprise Agreement customers. **Migrate to version 2025-03-01** You can use the 2025-03-01 API version with the new URI: '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.CostManagement/pricesheets/default/download' With a new schema detailed below, the new version of the price sheet provides additional information and includes prices for Azure Reserved Instances (RI) for the current billing period. We recommend downloading an Azure Price Sheet for when entering a new billing period if you would maintain an ongoing record of past Azure Reserved Instance (RI) pricing. The EA Azure price sheet is available for billing periods in the past 13 months. To request a price sheet for a billing period older than 13 months, please contact support. The Azure price sheet download experience has been updated from a single .csv file to a zip file containing multiple .csv files, each with max size of 75MB. The 2023-11-01 version has been upgraded to use http POST method; details can be found below. All versions of the Microsoft.Consumption Azure Price Sheet - Download by Billing Account (including 2022-06-01, 2021-10-01, 2020-01-01-preview, 2019-10-01, 2019-05-01) are scheduled to be retired on 01 June 2026 and will no longer be supported after this date. x-ms-original-file: 2025-03-01/EAPriceSheetForBillingPeriod.json | +| [priceSheetDownloadByBillingProfileSample.js][pricesheetdownloadbybillingprofilesample] | 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. You can use the new 2023-09-01 API version for billing periods January 2023 onwards. Azure Reserved Instance (RI) pricing is only available through the new version of the API. Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv/json file to a Zip file containing multiple csv/json files, each with max size of 75MB. x-ms-original-file: 2025-03-01/PricesheetDownloadByBillingProfile.json | +| [priceSheetDownloadByInvoiceSample.js][pricesheetdownloadbyinvoicesample] | 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. x-ms-original-file: 2025-03-01/PricesheetDownload.json | +| [queryUsageByExternalCloudProviderTypeSample.js][queryusagebyexternalcloudprovidertypesample] | query the usage data for external cloud provider type defined. x-ms-original-file: 2025-03-01/ExternalBillingAccountsQuery.json | +| [queryUsageSample.js][queryusagesample] | query the usage data for scope defined. x-ms-original-file: 2025-03-01/BillingAccountQuery.json | +| [scheduledActionsCheckNameAvailabilityByScopeSample.js][scheduledactionschecknameavailabilitybyscopesample] | checks availability and correctness of the name for a scheduled action within the given scope. x-ms-original-file: 2025-03-01/scheduledActions/checkNameAvailability-shared-scheduledAction.json | +| [scheduledActionsCheckNameAvailabilitySample.js][scheduledactionschecknameavailabilitysample] | checks availability and correctness of the name for a scheduled action. x-ms-original-file: 2025-03-01/scheduledActions/checkNameAvailability-private-scheduledAction.json | +| [scheduledActionsCreateOrUpdateByScopeSample.js][scheduledactionscreateorupdatebyscopesample] | create or update a shared scheduled action within the given scope. x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-createOrUpdate-shared.json | +| [scheduledActionsCreateOrUpdateSample.js][scheduledactionscreateorupdatesample] | create or update a private scheduled action. x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-createOrUpdate-private.json | +| [scheduledActionsDeleteByScopeSample.js][scheduledactionsdeletebyscopesample] | delete a scheduled action within the given scope. x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-delete-shared.json | +| [scheduledActionsDeleteSample.js][scheduledactionsdeletesample] | delete a private scheduled action. x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-delete-private.json | +| [scheduledActionsGetByScopeSample.js][scheduledactionsgetbyscopesample] | get the shared scheduled action from the given scope by name. x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-get-shared.json | +| [scheduledActionsGetSample.js][scheduledactionsgetsample] | get the private scheduled action by name. x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-get-private.json | +| [scheduledActionsListByScopeSample.js][scheduledactionslistbyscopesample] | list all shared scheduled actions within the given scope. x-ms-original-file: 2025-03-01/scheduledActions/scheduledActions-list-shared.json | +| [scheduledActionsListSample.js][scheduledactionslistsample] | list all private scheduled actions. x-ms-original-file: 2025-03-01/scheduledActions/scheduledActions-list-private.json | +| [scheduledActionsRunByScopeSample.js][scheduledactionsrunbyscopesample] | runs a shared scheduled action within the given scope. x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-sendNow-shared.json | +| [scheduledActionsRunSample.js][scheduledactionsrunsample] | processes a private scheduled action. x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-sendNow-private.json | +| [settingsCreateOrUpdateByScopeSample.js][settingscreateorupdatebyscopesample] | create or update a setting within the given scope. x-ms-original-file: 2025-03-01/settings-createOrUpdate.json | +| [settingsDeleteByScopeSample.js][settingsdeletebyscopesample] | delete a setting within the given scope. x-ms-original-file: 2025-03-01/setting-delete.json | +| [settingsGetByScopeSample.js][settingsgetbyscopesample] | get the setting from the given scope by name. x-ms-original-file: 2025-03-01/setting-get.json | +| [settingsListSample.js][settingslistsample] | list all cost management settings in the requested scope. x-ms-original-file: 2025-03-01/settingsList.json | +| [viewsCreateOrUpdateByScopeSample.js][viewscreateorupdatebyscopesample] | 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. x-ms-original-file: 2025-03-01/ViewCreateOrUpdateByResourceGroup.json | +| [viewsCreateOrUpdateSample.js][viewscreateorupdatesample] | 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. x-ms-original-file: 2025-03-01/PrivateViewCreateOrUpdate.json | +| [viewsDeleteByScopeSample.js][viewsdeletebyscopesample] | the operation to delete a view. x-ms-original-file: 2025-03-01/ViewDeleteByResourceGroup.json | +| [viewsDeleteSample.js][viewsdeletesample] | the operation to delete a view. x-ms-original-file: 2025-03-01/PrivateViewDelete.json | +| [viewsGetByScopeSample.js][viewsgetbyscopesample] | gets the view for the defined scope by view name. x-ms-original-file: 2025-03-01/ViewByResourceGroup.json | +| [viewsGetSample.js][viewsgetsample] | gets the view by view name. x-ms-original-file: 2025-03-01/PrivateView.json | +| [viewsListByScopeSample.js][viewslistbyscopesample] | lists all views at the given scope. x-ms-original-file: 2025-03-01/ViewListByResourceGroup.json | +| [viewsListSample.js][viewslistsample] | lists all views by tenant and object. x-ms-original-file: 2025-03-01/PrivateViewList.json | ## Prerequisites @@ -84,10 +104,10 @@ npm install node alertsDismissSample.js ``` -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): +Alternatively, run a single sample with the required environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): ```bash -cross-env node alertsDismissSample.js +node alertsDismissSample.js ``` ## Next Steps @@ -103,7 +123,16 @@ Take a look at our [API Documentation][apiref] for more information about the AP [benefitutilizationsummarieslistbybillingprofileidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/benefitUtilizationSummariesListByBillingProfileIdSample.js [benefitutilizationsummarieslistbysavingsplanidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/benefitUtilizationSummariesListBySavingsPlanIdSample.js [benefitutilizationsummarieslistbysavingsplanordersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/benefitUtilizationSummariesListBySavingsPlanOrderSample.js -[dimensionsbyexternalcloudprovidertypesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/dimensionsByExternalCloudProviderTypeSample.js +[budgetscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/budgetsCreateOrUpdateSample.js +[budgetsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/budgetsDeleteSample.js +[budgetsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/budgetsGetSample.js +[budgetslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/budgetsListSample.js +[costallocationruleschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/costAllocationRulesCheckNameAvailabilitySample.js +[costallocationrulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/costAllocationRulesCreateOrUpdateSample.js +[costallocationrulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/costAllocationRulesDeleteSample.js +[costallocationrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/costAllocationRulesGetSample.js +[costallocationruleslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/costAllocationRulesListSample.js +[dimensionslistbyexternalcloudprovidertypesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/dimensionsListByExternalCloudProviderTypeSample.js [dimensionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/dimensionsListSample.js [exportscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsCreateOrUpdateSample.js [exportsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsDeleteSample.js @@ -113,6 +142,12 @@ Take a look at our [API Documentation][apiref] for more information about the AP [exportslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsListSample.js [forecastexternalcloudproviderusagesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/forecastExternalCloudProviderUsageSample.js [forecastusagesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/forecastUsageSample.js +[generatebenefitutilizationsummariesreportgeneratebybillingaccountsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateBenefitUtilizationSummariesReportGenerateByBillingAccountSample.js +[generatebenefitutilizationsummariesreportgeneratebybillingprofilesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateBenefitUtilizationSummariesReportGenerateByBillingProfileSample.js +[generatebenefitutilizationsummariesreportgeneratebyreservationidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateBenefitUtilizationSummariesReportGenerateByReservationIdSample.js +[generatebenefitutilizationsummariesreportgeneratebyreservationorderidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateBenefitUtilizationSummariesReportGenerateByReservationOrderIdSample.js +[generatebenefitutilizationsummariesreportgeneratebysavingsplanidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdSample.js +[generatebenefitutilizationsummariesreportgeneratebysavingsplanorderidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdSample.js [generatecostdetailsreportcreateoperationsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateCostDetailsReportCreateOperationSample.js [generatecostdetailsreportgetoperationresultssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateCostDetailsReportGetOperationResultsSample.js [generatedetailedcostreportcreateoperationsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateDetailedCostReportCreateOperationSample.js @@ -121,8 +156,9 @@ Take a look at our [API Documentation][apiref] for more information about the AP [generatereservationdetailsreportbybillingaccountidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateReservationDetailsReportByBillingAccountIdSample.js [generatereservationdetailsreportbybillingprofileidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateReservationDetailsReportByBillingProfileIdSample.js [operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/operationsListSample.js +[pricesheetdownloadbybillingaccountsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/priceSheetDownloadByBillingAccountSample.js [pricesheetdownloadbybillingprofilesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/priceSheetDownloadByBillingProfileSample.js -[pricesheetdownloadsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/priceSheetDownloadSample.js +[pricesheetdownloadbyinvoicesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/priceSheetDownloadByInvoiceSample.js [queryusagebyexternalcloudprovidertypesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/queryUsageByExternalCloudProviderTypeSample.js [queryusagesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/queryUsageSample.js [scheduledactionschecknameavailabilitybyscopesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsCheckNameAvailabilityByScopeSample.js @@ -137,6 +173,10 @@ Take a look at our [API Documentation][apiref] for more information about the AP [scheduledactionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsListSample.js [scheduledactionsrunbyscopesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsRunByScopeSample.js [scheduledactionsrunsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsRunSample.js +[settingscreateorupdatebyscopesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/settingsCreateOrUpdateByScopeSample.js +[settingsdeletebyscopesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/settingsDeleteByScopeSample.js +[settingsgetbyscopesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/settingsGetByScopeSample.js +[settingslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/settingsListSample.js [viewscreateorupdatebyscopesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsCreateOrUpdateByScopeSample.js [viewscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsCreateOrUpdateSample.js [viewsdeletebyscopesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsDeleteByScopeSample.js diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/alertsDismissSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/alertsDismissSample.js index 1565f5ed676e..546c3d17482d 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/alertsDismissSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/alertsDismissSample.js @@ -1,53 +1,46 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Dismisses the specified alert + * This sample demonstrates how to dismisses the specified alert * - * @summary Dismisses the specified alert - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DismissResourceGroupAlerts.json + * @summary dismisses the specified alert + * x-ms-original-file: 2025-03-01/DismissResourceGroupAlerts.json */ async function patchResourceGroupAlerts() { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"; - const alertId = "22222222-2222-2222-2222-222222222222"; - const parameters = { status: "Dismissed" }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.dismiss(scope, alertId, parameters); + const result = await client.alerts.dismiss( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", + "22222222-2222-2222-2222-222222222222", + { status: "Dismissed" }, + ); console.log(result); } /** - * This sample demonstrates how to Dismisses the specified alert + * This sample demonstrates how to dismisses the specified alert * - * @summary Dismisses the specified alert - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DismissSubscriptionAlerts.json + * @summary dismisses the specified alert + * x-ms-original-file: 2025-03-01/DismissSubscriptionAlerts.json */ async function patchSubscriptionAlerts() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const alertId = "22222222-2222-2222-2222-222222222222"; - const parameters = { status: "Dismissed" }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.dismiss(scope, alertId, parameters); + const result = await client.alerts.dismiss( + "subscriptions/00000000-0000-0000-0000-000000000000", + "22222222-2222-2222-2222-222222222222", + { status: "Dismissed" }, + ); console.log(result); } async function main() { - patchResourceGroupAlerts(); - patchSubscriptionAlerts(); + await patchResourceGroupAlerts(); + await patchSubscriptionAlerts(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/alertsGetSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/alertsGetSample.js index 6c3788510c70..8d83dbd3f284 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/alertsGetSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/alertsGetSample.js @@ -1,51 +1,44 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Gets the alert for the scope by alert ID. + * This sample demonstrates how to gets the alert for the scope by alert ID. * - * @summary Gets the alert for the scope by alert ID. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SingleResourceGroupAlert.json + * @summary gets the alert for the scope by alert ID. + * x-ms-original-file: 2025-03-01/SingleResourceGroupAlert.json */ async function singleResourceGroupAlerts() { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"; - const alertId = "22222222-2222-2222-2222-222222222222"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.get(scope, alertId); + const result = await client.alerts.get( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", + "22222222-2222-2222-2222-222222222222", + ); console.log(result); } /** - * This sample demonstrates how to Gets the alert for the scope by alert ID. + * This sample demonstrates how to gets the alert for the scope by alert ID. * - * @summary Gets the alert for the scope by alert ID. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SingleSubscriptionAlert.json + * @summary gets the alert for the scope by alert ID. + * x-ms-original-file: 2025-03-01/SingleSubscriptionAlert.json */ async function singleSubscriptionAlerts() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const alertId = "22222222-2222-2222-2222-222222222222"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.get(scope, alertId); + const result = await client.alerts.get( + "subscriptions/00000000-0000-0000-0000-000000000000", + "22222222-2222-2222-2222-222222222222", + ); console.log(result); } async function main() { - singleResourceGroupAlerts(); - singleSubscriptionAlerts(); + await singleResourceGroupAlerts(); + await singleSubscriptionAlerts(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/alertsListExternalSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/alertsListExternalSample.js index 59a424decfe9..b9f3d064ef45 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/alertsListExternalSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/alertsListExternalSample.js @@ -1,56 +1,38 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Lists the Alerts for external cloud provider type defined. + * This sample demonstrates how to lists the Alerts for external cloud provider type defined. * - * @summary Lists the Alerts for external cloud provider type defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalBillingAccountAlerts.json + * @summary lists the Alerts for external cloud provider type defined. + * x-ms-original-file: 2025-03-01/ExternalBillingAccountAlerts.json */ async function externalBillingAccountAlerts() { - const externalCloudProviderType = "externalBillingAccounts"; - const externalCloudProviderId = "100"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.listExternal( - externalCloudProviderType, - externalCloudProviderId - ); + const result = await client.alerts.listExternal("externalBillingAccounts", "100"); console.log(result); } /** - * This sample demonstrates how to Lists the Alerts for external cloud provider type defined. + * This sample demonstrates how to lists the Alerts for external cloud provider type defined. * - * @summary Lists the Alerts for external cloud provider type defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalSubscriptionAlerts.json + * @summary lists the Alerts for external cloud provider type defined. + * x-ms-original-file: 2025-03-01/ExternalSubscriptionAlerts.json */ async function externalSubscriptionAlerts() { - const externalCloudProviderType = "externalSubscriptions"; - const externalCloudProviderId = "100"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.listExternal( - externalCloudProviderType, - externalCloudProviderId - ); + const result = await client.alerts.listExternal("externalSubscriptions", "100"); console.log(result); } async function main() { - externalBillingAccountAlerts(); - externalSubscriptionAlerts(); + await externalBillingAccountAlerts(); + await externalSubscriptionAlerts(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/alertsListSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/alertsListSample.js index 647d57fee82b..92aad0baddf5 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/alertsListSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/alertsListSample.js @@ -1,125 +1,118 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Lists the alerts for scope defined. + * This sample demonstrates how to lists the alerts for scope defined. * - * @summary Lists the alerts for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountAlerts.json + * @summary lists the alerts for scope defined. + * x-ms-original-file: 2025-03-01/BillingAccountAlerts.json */ async function billingAccountAlerts() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.list(scope); + const result = await client.alerts.list("providers/Microsoft.Billing/billingAccounts/12345-6789"); console.log(result); } /** - * This sample demonstrates how to Lists the alerts for scope defined. + * This sample demonstrates how to lists the alerts for scope defined. * - * @summary Lists the alerts for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingProfileAlerts.json + * @summary lists the alerts for scope defined. + * x-ms-original-file: 2025-03-01/BillingProfileAlerts.json */ async function billingProfileAlerts() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.list(scope); + const result = await client.alerts.list( + "providers/Microsoft.Billing/billingAccounts/12345-6789/billingProfiles/13579", + ); console.log(result); } /** - * This sample demonstrates how to Lists the alerts for scope defined. + * This sample demonstrates how to lists the alerts for scope defined. * - * @summary Lists the alerts for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentAlerts.json + * @summary lists the alerts for scope defined. + * x-ms-original-file: 2025-03-01/DepartmentAlerts.json */ async function departmentAlerts() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.list(scope); + const result = await client.alerts.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123", + ); console.log(result); } /** - * This sample demonstrates how to Lists the alerts for scope defined. + * This sample demonstrates how to lists the alerts for scope defined. * - * @summary Lists the alerts for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountAlerts.json + * @summary lists the alerts for scope defined. + * x-ms-original-file: 2025-03-01/EnrollmentAccountAlerts.json */ async function enrollmentAccountAlerts() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.list(scope); + const result = await client.alerts.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456", + ); console.log(result); } /** - * This sample demonstrates how to Lists the alerts for scope defined. + * This sample demonstrates how to lists the alerts for scope defined. * - * @summary Lists the alerts for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/InvoiceSectionAlerts.json + * @summary lists the alerts for scope defined. + * x-ms-original-file: 2025-03-01/InvoiceSectionAlerts.json */ async function invoiceSectionAlerts() { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.list(scope); + const result = await client.alerts.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", + ); console.log(result); } /** - * This sample demonstrates how to Lists the alerts for scope defined. + * This sample demonstrates how to lists the alerts for scope defined. * - * @summary Lists the alerts for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ResourceGroupAlerts.json + * @summary lists the alerts for scope defined. + * x-ms-original-file: 2025-03-01/ResourceGroupAlerts.json */ async function resourceGroupAlerts() { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.list(scope); + const result = await client.alerts.list( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", + ); console.log(result); } /** - * This sample demonstrates how to Lists the alerts for scope defined. + * This sample demonstrates how to lists the alerts for scope defined. * - * @summary Lists the alerts for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SubscriptionAlerts.json + * @summary lists the alerts for scope defined. + * x-ms-original-file: 2025-03-01/SubscriptionAlerts.json */ async function subscriptionAlerts() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.list(scope); + const result = await client.alerts.list("subscriptions/00000000-0000-0000-0000-000000000000"); console.log(result); } async function main() { - billingAccountAlerts(); - billingProfileAlerts(); - departmentAlerts(); - enrollmentAccountAlerts(); - invoiceSectionAlerts(); - resourceGroupAlerts(); - subscriptionAlerts(); + await billingAccountAlerts(); + await billingProfileAlerts(); + await departmentAlerts(); + await enrollmentAccountAlerts(); + await invoiceSectionAlerts(); + await resourceGroupAlerts(); + await subscriptionAlerts(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/benefitRecommendationsListSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/benefitRecommendationsListSample.js index 435fdceca25d..1465e3afe0e4 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/benefitRecommendationsListSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/benefitRecommendationsListSample.js @@ -1,39 +1,34 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to List of recommendations for purchasing savings plan. + * This sample demonstrates how to list of recommendations for purchasing savings plan. * - * @summary List of recommendations for purchasing savings plan. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitRecommendationsByBillingAccount.json + * @summary list of recommendations for purchasing savings plan. + * x-ms-original-file: 2025-03-01/BenefitRecommendationsByBillingAccount.json */ async function benefitRecommendationsBillingAccountList() { - const filter = "properties/lookBackPeriod eq 'Last7Days' AND properties/term eq 'P1Y'"; - const expand = "properties/usage,properties/allRecommendationDetails"; - const billingScope = "providers/Microsoft.Billing/billingAccounts/123456"; - const options = { filter, expand }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.benefitRecommendations.list(billingScope, options)) { + for await (const item of client.benefitRecommendations.list( + "providers/Microsoft.Billing/billingAccounts/123456", + { + filter: "properties/lookBackPeriod eq 'Last7Days' AND properties/term eq 'P1Y'", + expand: "properties/usage,properties/allRecommendationDetails", + }, + )) { resArray.push(item); } + console.log(resArray); } async function main() { - benefitRecommendationsBillingAccountList(); + await benefitRecommendationsBillingAccountList(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/benefitUtilizationSummariesListByBillingAccountIdSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/benefitUtilizationSummariesListByBillingAccountIdSample.js index e90fe83d36fb..20fdeba484c3 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/benefitUtilizationSummariesListByBillingAccountIdSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/benefitUtilizationSummariesListByBillingAccountIdSample.js @@ -1,43 +1,30 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. + * This sample demonstrates how to lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. * - * @summary Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitUtilizationSummaries/SavingsPlan-BillingAccount.json + * @summary lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/SavingsPlan-BillingAccount.json */ async function savingsPlanUtilizationSummariesBillingAccount() { - const billingAccountId = "12345"; - const filter = "properties/usageDate ge 2022-10-15 and properties/usageDate le 2022-10-18"; - const options = { - filter, - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.benefitUtilizationSummaries.listByBillingAccountId( - billingAccountId, - options - )) { + for await (const item of client.benefitUtilizationSummaries.listByBillingAccountId("12345", { + filter: "properties/usageDate ge 2022-10-15 and properties/usageDate le 2022-10-18", + })) { resArray.push(item); } + console.log(resArray); } async function main() { - savingsPlanUtilizationSummariesBillingAccount(); + await savingsPlanUtilizationSummariesBillingAccount(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/benefitUtilizationSummariesListByBillingProfileIdSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/benefitUtilizationSummariesListByBillingProfileIdSample.js index f6f087f5c5f8..5082b773edb6 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/benefitUtilizationSummariesListByBillingProfileIdSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/benefitUtilizationSummariesListByBillingProfileIdSample.js @@ -1,46 +1,32 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. + * This sample demonstrates how to lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. * - * @summary Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitUtilizationSummaries/SavingsPlan-BillingProfile.json + * @summary lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/SavingsPlan-BillingProfile.json */ async function savingsPlanUtilizationSummariesBillingProfile() { - const billingAccountId = - "c0a00000-0e04-5ee3-000e-f0c6e00000ec:c0a00000-0e04-5ee3-000e-f0c6e00000ec"; - const billingProfileId = "200e5e90-000e-4960-8dcd-8d00a02db000"; - const filter = "properties/usageDate ge 2022-10-15 and properties/usageDate le 2022-10-18"; - const options = { - filter, - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.benefitUtilizationSummaries.listByBillingProfileId( - billingAccountId, - billingProfileId, - options + for await (const item of client.benefitUtilizationSummaries.listByBillingProfileId( + "c0a00000-0e04-5ee3-000e-f0c6e00000ec:c0a00000-0e04-5ee3-000e-f0c6e00000ec", + "200e5e90-000e-4960-8dcd-8d00a02db000", + { filter: "properties/usageDate ge 2022-10-15 and properties/usageDate le 2022-10-18" }, )) { resArray.push(item); } + console.log(resArray); } async function main() { - savingsPlanUtilizationSummariesBillingProfile(); + await savingsPlanUtilizationSummariesBillingProfile(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/benefitUtilizationSummariesListBySavingsPlanIdSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/benefitUtilizationSummariesListBySavingsPlanIdSample.js index 55511d074970..eb25989050d1 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/benefitUtilizationSummariesListBySavingsPlanIdSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/benefitUtilizationSummariesListBySavingsPlanIdSample.js @@ -1,40 +1,31 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Lists the savings plan utilization summaries for daily or monthly grain. + * This sample demonstrates how to lists the savings plan utilization summaries for daily or monthly grain. * - * @summary Lists the savings plan utilization summaries for daily or monthly grain. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanId-Monthly.json + * @summary lists the savings plan utilization summaries for daily or monthly grain. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanId-Monthly.json */ async function savingsPlanUtilizationSummariesMonthlyWithSavingsPlanId() { - const savingsPlanOrderId = "66cccc66-6ccc-6c66-666c-66cc6c6c66c6"; - const savingsPlanId = "222d22dd-d2d2-2dd2-222d-2dd2222ddddd"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.benefitUtilizationSummaries.listBySavingsPlanId( - savingsPlanOrderId, - savingsPlanId + for await (const item of client.benefitUtilizationSummaries.listBySavingsPlanId( + "66cccc66-6ccc-6c66-666c-66cc6c6c66c6", + "222d22dd-d2d2-2dd2-222d-2dd2222ddddd", )) { resArray.push(item); } + console.log(resArray); } async function main() { - savingsPlanUtilizationSummariesMonthlyWithSavingsPlanId(); + await savingsPlanUtilizationSummariesMonthlyWithSavingsPlanId(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/benefitUtilizationSummariesListBySavingsPlanOrderSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/benefitUtilizationSummariesListBySavingsPlanOrderSample.js index 91b3e94c3d51..04e2ec234abe 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/benefitUtilizationSummariesListBySavingsPlanOrderSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/benefitUtilizationSummariesListBySavingsPlanOrderSample.js @@ -1,38 +1,30 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Lists the savings plan utilization summaries for daily or monthly grain. + * This sample demonstrates how to lists the savings plan utilization summaries for daily or monthly grain. * - * @summary Lists the savings plan utilization summaries for daily or monthly grain. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanOrderId-Daily.json + * @summary lists the savings plan utilization summaries for daily or monthly grain. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanOrderId-Daily.json */ async function savingsPlanUtilizationSummariesDaily() { - const savingsPlanOrderId = "66cccc66-6ccc-6c66-666c-66cc6c6c66c6"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.benefitUtilizationSummaries.listBySavingsPlanOrder( - savingsPlanOrderId + for await (const item of client.benefitUtilizationSummaries.listBySavingsPlanOrder( + "66cccc66-6ccc-6c66-666c-66cc6c6c66c6", )) { resArray.push(item); } + console.log(resArray); } async function main() { - savingsPlanUtilizationSummariesDaily(); + await savingsPlanUtilizationSummariesDaily(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/budgetsCreateOrUpdateSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/budgetsCreateOrUpdateSample.js new file mode 100644 index 000000000000..df91e58569f1 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/budgetsCreateOrUpdateSample.js @@ -0,0 +1,448 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CostManagementClient } = require("@azure/arm-costmanagement"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/Cost/CreateOrUpdate-Cost-Subscription-Budget.json + */ +async function createOrUpdateCostSubscriptionBudget() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "subscriptions/00000000-0000-0000-0000-000000000000", + "TestBudget", + { + eTag: '"1d34d016a593709"', + amount: 100.65, + category: "Cost", + filter: { + and: [ + { + dimensions: { + name: "ResourceId", + operator: "In", + values: [ + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/MSVM2", + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/platformcloudplatformGeneric1", + ], + }, + }, + { tags: { name: "category", operator: "In", values: ["Dev", "Prod"] } }, + { tags: { name: "department", operator: "In", values: ["engineering", "sales"] } }, + ], + }, + notifications: { + Actual_GreaterThan_80_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + contactGroups: [ + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/microsoft.insights/actionGroups/SampleActionGroup", + ], + contactRoles: ["Contributor", "Reader"], + enabled: true, + locale: "en-us", + operator: "GreaterThan", + threshold: 80, + thresholdType: "Actual", + }, + }, + timeGrain: "Monthly", + timePeriod: { + endDate: new Date("2024-10-31T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/EA/BillingAccountEA-AlertRule-ReservationIdFilter.json + */ +async function createOrUpdateReservationUtilizationBillingAccountEAAlertRuleReservationIdFilter() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: { + dimensions: { + name: "ReservationId", + operator: "In", + values: [ + "00000000-0000-0000-0000-000000000000", + "00000000-0000-0000-0000-000000000001", + "00000000-0000-0000-0000-000000000002", + ], + }, + }, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Weekly", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last7Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/EA/BillingAccountEA-AlertRule-ReservedResourceTypeFilter.json + */ +async function createOrUpdateReservationUtilizationBillingAccountEAAlertRuleReservedResourceTypeFilter() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: { + dimensions: { + name: "ReservedResourceType", + operator: "In", + values: ["VirtualMachines", "SqlDatabases", "CosmosDb"], + }, + }, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Weekly", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last7Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/EA/BillingAccountEA-AlertRule.json + */ +async function createOrUpdateReservationUtilizationBillingAccountEAAlertRule() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: {}, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Weekly", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last7Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/MCA/BillingProfile-AlertRule-ReservationIdFilter.json + */ +async function createOrUpdateReservationUtilizationBillingProfileMCAAlertRuleReservationIdFilter() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/KKKK-LLLL-MMM-NNN", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: { + dimensions: { + name: "ReservationId", + operator: "In", + values: [ + "00000000-0000-0000-0000-000000000000", + "00000000-0000-0000-0000-000000000001", + "00000000-0000-0000-0000-000000000002", + ], + }, + }, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Daily", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last30Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/MCA/BillingProfile-AlertRule-ReservedResourceTypeFilter.json + */ +async function createOrUpdateReservationUtilizationBillingProfileMCAAlertRuleReservedResourceTypeFilter() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/KKKK-LLLL-MMM-NNN", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: { + dimensions: { + name: "ReservedResourceType", + operator: "In", + values: ["VirtualMachines", "SqlDatabases", "CosmosDb"], + }, + }, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Daily", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last30Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/MCA/BillingProfile-AlertRule.json + */ +async function createOrUpdateReservationUtilizationBillingProfileMCAAlertRuleJson() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/KKKK-LLLL-MMM-NNN", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: {}, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Daily", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last30Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/MCA/Customer-AlertRule-ReservationIdFilter.json + */ +async function createOrUpdateReservationUtilizationCustomerCSPAlertRuleReservationIdFilter() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/customers/000000-1111-2222-3333-444444444444", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: { + dimensions: { + name: "ReservationId", + operator: "In", + values: [ + "00000000-0000-0000-0000-000000000000", + "00000000-0000-0000-0000-000000000001", + "00000000-0000-0000-0000-000000000002", + ], + }, + }, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Daily", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last30Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/MCA/Customer-AlertRule-ReservedResourceTypeFilter.json + */ +async function createOrUpdateReservationUtilizationCustomerCSPAlertRuleReservedResourceTypeFilter() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/customers/000000-1111-2222-3333-444444444444", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: { + dimensions: { + name: "ReservedResourceType", + operator: "In", + values: ["VirtualMachines", "SqlDatabases", "CosmosDb"], + }, + }, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Daily", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last30Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/MCA/Customer-AlertRule.json + */ +async function createOrUpdateReservationUtilizationCustomerCSPAlertRuleJson() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/customers/000000-1111-2222-3333-444444444444", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: {}, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Daily", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last30Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +async function main() { + await createOrUpdateCostSubscriptionBudget(); + await createOrUpdateReservationUtilizationBillingAccountEAAlertRuleReservationIdFilter(); + await createOrUpdateReservationUtilizationBillingAccountEAAlertRuleReservedResourceTypeFilter(); + await createOrUpdateReservationUtilizationBillingAccountEAAlertRule(); + await createOrUpdateReservationUtilizationBillingProfileMCAAlertRuleReservationIdFilter(); + await createOrUpdateReservationUtilizationBillingProfileMCAAlertRuleReservedResourceTypeFilter(); + await createOrUpdateReservationUtilizationBillingProfileMCAAlertRuleJson(); + await createOrUpdateReservationUtilizationCustomerCSPAlertRuleReservationIdFilter(); + await createOrUpdateReservationUtilizationCustomerCSPAlertRuleReservedResourceTypeFilter(); + await createOrUpdateReservationUtilizationCustomerCSPAlertRuleJson(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/budgetsDeleteSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/budgetsDeleteSample.js new file mode 100644 index 000000000000..37e5f66a1e30 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/budgetsDeleteSample.js @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CostManagementClient } = require("@azure/arm-costmanagement"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to the operation to delete a budget. + * + * @summary the operation to delete a budget. + * x-ms-original-file: 2025-03-01/Budgets/Delete/DeleteBudget.json + */ +async function deleteBudget() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + await client.budgets.delete("subscriptions/00000000-0000-0000-0000-000000000000", "TestBudget"); +} + +async function main() { + await deleteBudget(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/budgetsGetSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/budgetsGetSample.js new file mode 100644 index 000000000000..1e84e894fecf --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/budgetsGetSample.js @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CostManagementClient } = require("@azure/arm-costmanagement"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to gets the budget for the scope by budget name. + * + * @summary gets the budget for the scope by budget name. + * x-ms-original-file: 2025-03-01/Budgets/Get/Cost/Get-Cost-Budget.json + */ +async function getCostBudget() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.get( + "subscriptions/00000000-0000-0000-0000-000000000000", + "TestBudget", + ); + console.log(result); +} + +/** + * This sample demonstrates how to gets the budget for the scope by budget name. + * + * @summary gets the budget for the scope by budget name. + * x-ms-original-file: 2025-03-01/Budgets/Get/ReservationUtilization/Get-ReservationUtilization-AlertRule.json + */ +async function getReservationUtilizationAlertRule() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.get( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/KKKK-LLLL-MMM-NNN", + "TestAlertRule", + ); + console.log(result); +} + +async function main() { + await getCostBudget(); + await getReservationUtilizationAlertRule(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/budgetsListSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/budgetsListSample.js new file mode 100644 index 000000000000..28a3ac59a974 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/budgetsListSample.js @@ -0,0 +1,294 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CostManagementClient } = require("@azure/arm-costmanagement"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/EA/BillingAccountBudgetsList-EA-CategoryTypeFilter.json + */ +async function billingAccountBudgetsListEACategoryTypeFilter() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/123456", + { filter: "properties/category eq 'ReservationUtilization'" }, + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/EA/BillingAccountBudgetsList-EA.json + */ +async function billingAccountBudgetsListEA() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/123456", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/EA/DepartmentBudgetsList.json + */ +async function departmentBudgetsListEA() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/123456/departments/789101", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/EA/EnrollmentAccountBudgetsList.json + */ +async function enrollmentAccountBudgetsListEA() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/123456/enrollmentAccounts/473845", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/MCA/BillingAccountBudgetsList-MCA-CategoryTypeFilter.json + */ +async function billingAccountBudgetsListMCACategoryTypeFilter() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01", + { filter: "properties/category eq 'ReservationUtilization'" }, + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/MCA/BillingAccountBudgetsList-MCA.json + */ +async function billingAccountBudgetsListMCA() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/MCA/BillingProfileBudgetsList-CategoryTypeFilter.json + */ +async function billingProfileBudgetsListMCACategoryTypeFilter() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/MYDEVTESTBP", + { filter: "properties/category eq 'ReservationUtilization'" }, + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/MCA/BillingProfileBudgetsList.json + */ +async function billingProfileBudgetsListMCA() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/MYDEVTESTBP", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/MCA/CustomerBudgetsList-CategoryTypeFilter.json + */ +async function customerBudgetsListMCACSPCategoryTypeFilter() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/customers/000000-1111-2222-3333-444444444444", + { filter: "properties/category eq 'ReservationUtilization'" }, + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/MCA/CustomerBudgetsList.json + */ +async function customerBudgetsListMCACSP() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/customers/000000-1111-2222-3333-444444444444", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/MCA/InvoiceSectionBudgetsList.json + */ +async function invoiceSectionBudgetsListMCA() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/MYDEVTESTBP/invoiceSections/AAAA-BBBB-CCC-DDD", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/RBAC/ManagementGroupBudgetsList.json + */ +async function managementGroupBudgetsList() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "Microsoft.Management/managementGroups/MYDEVTESTMG", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/RBAC/ResourceGroupBudgetsList.json + */ +async function resourceGroupBudgetsList() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/RBAC/SubscriptionBudgetsList.json + */ +async function subscriptionBudgetsList() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "subscriptions/00000000-0000-0000-0000-000000000000", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await billingAccountBudgetsListEACategoryTypeFilter(); + await billingAccountBudgetsListEA(); + await departmentBudgetsListEA(); + await enrollmentAccountBudgetsListEA(); + await billingAccountBudgetsListMCACategoryTypeFilter(); + await billingAccountBudgetsListMCA(); + await billingProfileBudgetsListMCACategoryTypeFilter(); + await billingProfileBudgetsListMCA(); + await customerBudgetsListMCACSPCategoryTypeFilter(); + await customerBudgetsListMCACSP(); + await invoiceSectionBudgetsListMCA(); + await managementGroupBudgetsList(); + await resourceGroupBudgetsList(); + await subscriptionBudgetsList(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/costAllocationRulesCheckNameAvailabilitySample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/costAllocationRulesCheckNameAvailabilitySample.js new file mode 100644 index 000000000000..daa0d42f07de --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/costAllocationRulesCheckNameAvailabilitySample.js @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CostManagementClient } = require("@azure/arm-costmanagement"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to checks availability and correctness of a name for a cost allocation rule + * + * @summary checks availability and correctness of a name for a cost allocation rule + * x-ms-original-file: 2025-03-01/CostAllocationRuleCheckNameAvailability.json + */ +async function costAllocationRuleCheckNameAvailability() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.costAllocationRules.checkNameAvailability("100", { + name: "testRule", + type: "Microsoft.CostManagement/costAllocationRules", + }); + console.log(result); +} + +async function main() { + await costAllocationRuleCheckNameAvailability(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/costAllocationRulesCreateOrUpdateSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/costAllocationRulesCreateOrUpdateSample.js new file mode 100644 index 000000000000..f6cb6e826b70 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/costAllocationRulesCreateOrUpdateSample.js @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CostManagementClient } = require("@azure/arm-costmanagement"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment. + * + * @summary create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment. + * x-ms-original-file: 2025-03-01/CostAllocationRuleCreate.json + */ +async function costAllocationRulesCreateResourceGroup() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.costAllocationRules.createOrUpdate("100", "testRule", { + properties: { + description: "This is a testRule", + status: "Active", + details: { + sourceResources: [ + { + name: "ResourceGroupName", + resourceType: "Dimension", + values: ["sampleRG", "secondRG"], + }, + ], + targetResources: [ + { + name: "ResourceGroupName", + policyType: "FixedProportion", + resourceType: "Dimension", + values: [ + { name: "destinationRG", percentage: 45 }, + { name: "destinationRG2", percentage: 54 }, + ], + }, + ], + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment. + * + * @summary create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment. + * x-ms-original-file: 2025-03-01/CostAllocationRuleCreateTag.json + */ +async function costAllocationRulesCreateTag() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.costAllocationRules.createOrUpdate("100", "testRule", { + properties: { + description: "This is a testRule", + status: "Active", + details: { + sourceResources: [{ name: "category", resourceType: "Tag", values: ["devops"] }], + targetResources: [ + { + name: "ResourceGroupName", + policyType: "FixedProportion", + resourceType: "Dimension", + values: [ + { name: "destinationRG", percentage: 33.33 }, + { name: "destinationRG2", percentage: 33.33 }, + { name: "destinationRG3", percentage: 33.34 }, + ], + }, + ], + }, + }, + }); + console.log(result); +} + +async function main() { + await costAllocationRulesCreateResourceGroup(); + await costAllocationRulesCreateTag(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/costAllocationRulesDeleteSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/costAllocationRulesDeleteSample.js new file mode 100644 index 000000000000..4092672783f5 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/costAllocationRulesDeleteSample.js @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CostManagementClient } = require("@azure/arm-costmanagement"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to delete cost allocation rule for billing account or enterprise enrollment. + * + * @summary delete cost allocation rule for billing account or enterprise enrollment. + * x-ms-original-file: 2025-03-01/CostAllocationRuleDelete.json + */ +async function deleteCostAllocationRule() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + await client.costAllocationRules.delete("100", "testRule"); +} + +async function main() { + await deleteCostAllocationRule(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/costAllocationRulesGetSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/costAllocationRulesGetSample.js new file mode 100644 index 000000000000..585f08edbd46 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/costAllocationRulesGetSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CostManagementClient } = require("@azure/arm-costmanagement"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get a cost allocation rule by rule name and billing account or enterprise enrollment. + * + * @summary get a cost allocation rule by rule name and billing account or enterprise enrollment. + * x-ms-original-file: 2025-03-01/CostAllocationRuleGet.json + */ +async function costAllocationRules() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.costAllocationRules.get("100", "testRule"); + console.log(result); +} + +async function main() { + await costAllocationRules(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/costAllocationRulesListSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/costAllocationRulesListSample.js new file mode 100644 index 000000000000..537328e5afc8 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/costAllocationRulesListSample.js @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CostManagementClient } = require("@azure/arm-costmanagement"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get the list of all cost allocation rules for a billing account or enterprise enrollment. + * + * @summary get the list of all cost allocation rules for a billing account or enterprise enrollment. + * x-ms-original-file: 2025-03-01/CostAllocationRulesList.json + */ +async function costAllocationRulesList() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.costAllocationRules.list("100")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await costAllocationRulesList(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/dimensionsByExternalCloudProviderTypeSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/dimensionsByExternalCloudProviderTypeSample.js deleted file mode 100644 index 84ce36f788ce..000000000000 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/dimensionsByExternalCloudProviderTypeSample.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { CostManagementClient } = require("@azure/arm-costmanagement"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Lists the dimensions by the external cloud provider type. - * - * @summary Lists the dimensions by the external cloud provider type. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalBillingAccountsDimensions.json - */ -async function externalBillingAccountDimensionList() { - const externalCloudProviderType = "externalBillingAccounts"; - const externalCloudProviderId = "100"; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const resArray = new Array(); - for await (let item of client.dimensions.listByExternalCloudProviderType( - externalCloudProviderType, - externalCloudProviderId - )) { - resArray.push(item); - } - console.log(resArray); -} - -/** - * This sample demonstrates how to Lists the dimensions by the external cloud provider type. - * - * @summary Lists the dimensions by the external cloud provider type. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalSubscriptionsDimensions.json - */ -async function externalSubscriptionDimensionList() { - const externalCloudProviderType = "externalSubscriptions"; - const externalCloudProviderId = "100"; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const resArray = new Array(); - for await (let item of client.dimensions.listByExternalCloudProviderType( - externalCloudProviderType, - externalCloudProviderId - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - externalBillingAccountDimensionList(); - externalSubscriptionDimensionList(); -} - -main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/dimensionsListByExternalCloudProviderTypeSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/dimensionsListByExternalCloudProviderTypeSample.js new file mode 100644 index 000000000000..40865ae532b6 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/dimensionsListByExternalCloudProviderTypeSample.js @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CostManagementClient } = require("@azure/arm-costmanagement"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to lists the dimensions by the external cloud provider type. + * + * @summary lists the dimensions by the external cloud provider type. + * x-ms-original-file: 2025-03-01/ExternalBillingAccountsDimensions.json + */ +async function externalBillingAccountDimensionList() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.dimensions.listByExternalCloudProviderType( + "externalBillingAccounts", + "100", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists the dimensions by the external cloud provider type. + * + * @summary lists the dimensions by the external cloud provider type. + * x-ms-original-file: 2025-03-01/ExternalSubscriptionsDimensions.json + */ +async function externalSubscriptionDimensionList() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.dimensions.listByExternalCloudProviderType( + "externalSubscriptions", + "100", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await externalBillingAccountDimensionList(); + await externalSubscriptionDimensionList(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/dimensionsListSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/dimensionsListSample.js index 0fe73f922785..8778b5ad9f4c 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/dimensionsListSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/dimensionsListSample.js @@ -1,551 +1,548 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/BillingAccountDimensionsList.json */ async function billingAccountDimensionsListLegacy() { - const scope = "providers/Microsoft.Billing/billingAccounts/100"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingAccountDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/BillingAccountDimensionsListExpandAndTop.json */ -async function billingAccountDimensionsListMca() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789"; +async function billingAccountDimensionsListExpandAndTopLegacy() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountDimensionsListExpandAndTop.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/BillingAccountDimensionsListWithFilter.json */ -async function billingAccountDimensionsListExpandAndTopLegacy() { - const scope = "providers/Microsoft.Billing/billingAccounts/100"; - const expand = "properties/data"; - const top = 5; - const options = { expand, top }; +async function billingAccountDimensionsListWithFilterLegacy() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100", + { filter: "properties/category eq 'resourceId'", expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingAccountDimensionsListExpandAndTop.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/DepartmentDimensionsList.json */ -async function billingAccountDimensionsListExpandAndTopMca() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789"; - const expand = "properties/data"; - const top = 5; - const options = { expand, top }; +async function departmentDimensionsListLegacy() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100/departments/123", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountDimensionsListWithFilter.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/DepartmentDimensionsListExpandAndTop.json */ -async function billingAccountDimensionsListWithFilterLegacy() { - const scope = "providers/Microsoft.Billing/billingAccounts/100"; - const filter = "properties/category eq 'resourceId'"; - const expand = "properties/data"; - const top = 5; - const options = { filter, expand, top }; +async function departmentDimensionsListExpandAndTopLegacy() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100/departments/123", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingAccountDimensionsListWithFilter.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/DepartmentDimensionsListWithFilter.json */ -async function billingAccountDimensionsListWithFilterMca() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789"; - const filter = "properties/category eq 'resourceId'"; - const expand = "properties/data"; - const top = 5; - const options = { filter, expand, top }; +async function departmentDimensionsListWithFilterLegacy() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100/departments/123", + { filter: "properties/category eq 'resourceId'", expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingProfileDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/EnrollmentAccountDimensionsList.json */ -async function billingProfileDimensionsListMca() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; +async function enrollmentAccountDimensionsListLegacy() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingProfileDimensionsListExpandAndTop.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/EnrollmentAccountDimensionsListExpandAndTop.json */ -async function billingProfileDimensionsListExpandAndTopMca() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; - const expand = "properties/data"; - const top = 5; - const options = { expand, top }; +async function enrollmentAccountDimensionsListExpandAndTopLegacy() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingProfileDimensionsListWithFilter.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/EnrollmentAccountDimensionsListWithFilter.json */ -async function billingProfileDimensionsListWithFilterMca() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; - const filter = "properties/category eq 'resourceId'"; - const expand = "properties/data"; - const top = 5; - const options = { filter, expand, top }; +async function enrollmentAccountDimensionsListWithFilterLegacy() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + { filter: "properties/category eq 'resourceId'", expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCACustomerDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCABillingAccountDimensionsList.json */ -async function customerDimensionsListMca() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"; +async function billingAccountDimensionsListMCA() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCACustomerDimensionsListExpandAndTop.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCABillingAccountDimensionsListExpandAndTop.json */ -async function customerDimensionsListExpandAndTopMca() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"; - const expand = "properties/data"; - const top = 5; - const options = { expand, top }; +async function billingAccountDimensionsListExpandAndTopMCA() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCACustomerDimensionsListWithFilter.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCABillingAccountDimensionsListWithFilter.json */ -async function customerDimensionsListWithFilterMca() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"; - const filter = "properties/category eq 'resourceId'"; - const expand = "properties/data"; - const top = 5; - const options = { filter, expand, top }; +async function billingAccountDimensionsListWithFilterMCA() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789", + { filter: "properties/category eq 'resourceId'", expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCABillingProfileDimensionsList.json */ -async function departmentDimensionsListLegacy() { - const scope = "providers/Microsoft.Billing/billingAccounts/100/departments/123"; +async function billingProfileDimensionsListMCA() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentDimensionsListExpandAndTop.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCABillingProfileDimensionsListExpandAndTop.json */ -async function departmentDimensionsListExpandAndTopLegacy() { - const scope = "providers/Microsoft.Billing/billingAccounts/100/departments/123"; - const expand = "properties/data"; - const top = 5; - const options = { expand, top }; +async function billingProfileDimensionsListExpandAndTopMCA() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentDimensionsListWithFilter.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCABillingProfileDimensionsListWithFilter.json */ -async function departmentDimensionsListWithFilterLegacy() { - const scope = "providers/Microsoft.Billing/billingAccounts/100/departments/123"; - const filter = "properties/category eq 'resourceId'"; - const expand = "properties/data"; - const top = 5; - const options = { filter, expand, top }; +async function billingProfileDimensionsListWithFilterMCA() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + { filter: "properties/category eq 'resourceId'", expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCACustomerDimensionsList.json */ -async function enrollmentAccountDimensionsListLegacy() { - const scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; +async function customerDimensionsListMCA() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountDimensionsListExpandAndTop.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCACustomerDimensionsListExpandAndTop.json */ -async function enrollmentAccountDimensionsListExpandAndTopLegacy() { - const scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const expand = "properties/data"; - const top = 5; - const options = { expand, top }; +async function customerDimensionsListExpandAndTopMCA() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountDimensionsListWithFilter.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCACustomerDimensionsListWithFilter.json */ -async function enrollmentAccountDimensionsListWithFilterLegacy() { - const scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const filter = "properties/category eq 'resourceId'"; - const expand = "properties/data"; - const top = 5; - const options = { filter, expand, top }; +async function customerDimensionsListWithFilterMCA() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", + { filter: "properties/category eq 'resourceId'", expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCAInvoiceSectionDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCAInvoiceSectionDimensionsList.json */ -async function invoiceSectionDimensionsListMca() { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876"; +async function invoiceSectionDimensionsListMCA() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCAInvoiceSectionDimensionsListExpandAndTop.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCAInvoiceSectionDimensionsListExpandAndTop.json */ -async function invoiceSectionDimensionsListExpandAndTopMca() { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876"; - const expand = "properties/data"; - const top = 5; - const options = { expand, top }; +async function invoiceSectionDimensionsListExpandAndTopMCA() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCAInvoiceSectionDimensionsListWithFilter.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCAInvoiceSectionDimensionsListWithFilter.json */ -async function invoiceSectionDimensionsListWithFilterMca() { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876"; - const filter = "properties/category eq 'resourceId'"; - const expand = "properties/data"; - const top = 5; - const options = { filter, expand, top }; +async function invoiceSectionDimensionsListWithFilterMCA() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", + { filter: "properties/category eq 'resourceId'", expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ManagementGroupDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/ManagementGroupDimensionsList.json */ async function managementGroupDimensionsListLegacy() { - const scope = "providers/Microsoft.Management/managementGroups/MyMgId"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Management/managementGroups/MyMgId", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ManagementGroupDimensionsListExpandAndTop.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/ManagementGroupDimensionsListExpandAndTop.json */ async function managementGroupDimensionsListExpandAndTopLegacy() { - const scope = "providers/Microsoft.Management/managementGroups/MyMgId"; - const expand = "properties/data"; - const top = 5; - const options = { expand, top }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Management/managementGroups/MyMgId", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ManagementGroupDimensionsListWithFilter.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/ManagementGroupDimensionsListWithFilter.json */ async function managementGroupDimensionsListWithFilterLegacy() { - const scope = "providers/Microsoft.Management/managementGroups/MyMgId"; - const filter = "properties/category eq 'resourceId'"; - const expand = "properties/data"; - const top = 5; - const options = { filter, expand, top }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Management/managementGroups/MyMgId", + { filter: "properties/category eq 'resourceId'", expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ResourceGroupDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/ResourceGroupDimensionsList.json */ async function resourceGroupDimensionsListLegacy() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/system.orlando"; - const expand = "properties/data"; - const top = 5; - const options = { expand, top }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/system.orlando", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SubscriptionDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/SubscriptionDimensionsList.json */ async function subscriptionDimensionsListLegacy() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const expand = "properties/data"; - const top = 5; - const options = { expand, top }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "subscriptions/00000000-0000-0000-0000-000000000000", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } async function main() { - billingAccountDimensionsListLegacy(); - billingAccountDimensionsListMca(); - billingAccountDimensionsListExpandAndTopLegacy(); - billingAccountDimensionsListExpandAndTopMca(); - billingAccountDimensionsListWithFilterLegacy(); - billingAccountDimensionsListWithFilterMca(); - billingProfileDimensionsListMca(); - billingProfileDimensionsListExpandAndTopMca(); - billingProfileDimensionsListWithFilterMca(); - customerDimensionsListMca(); - customerDimensionsListExpandAndTopMca(); - customerDimensionsListWithFilterMca(); - departmentDimensionsListLegacy(); - departmentDimensionsListExpandAndTopLegacy(); - departmentDimensionsListWithFilterLegacy(); - enrollmentAccountDimensionsListLegacy(); - enrollmentAccountDimensionsListExpandAndTopLegacy(); - enrollmentAccountDimensionsListWithFilterLegacy(); - invoiceSectionDimensionsListMca(); - invoiceSectionDimensionsListExpandAndTopMca(); - invoiceSectionDimensionsListWithFilterMca(); - managementGroupDimensionsListLegacy(); - managementGroupDimensionsListExpandAndTopLegacy(); - managementGroupDimensionsListWithFilterLegacy(); - resourceGroupDimensionsListLegacy(); - subscriptionDimensionsListLegacy(); + await billingAccountDimensionsListLegacy(); + await billingAccountDimensionsListExpandAndTopLegacy(); + await billingAccountDimensionsListWithFilterLegacy(); + await departmentDimensionsListLegacy(); + await departmentDimensionsListExpandAndTopLegacy(); + await departmentDimensionsListWithFilterLegacy(); + await enrollmentAccountDimensionsListLegacy(); + await enrollmentAccountDimensionsListExpandAndTopLegacy(); + await enrollmentAccountDimensionsListWithFilterLegacy(); + await billingAccountDimensionsListMCA(); + await billingAccountDimensionsListExpandAndTopMCA(); + await billingAccountDimensionsListWithFilterMCA(); + await billingProfileDimensionsListMCA(); + await billingProfileDimensionsListExpandAndTopMCA(); + await billingProfileDimensionsListWithFilterMCA(); + await customerDimensionsListMCA(); + await customerDimensionsListExpandAndTopMCA(); + await customerDimensionsListWithFilterMCA(); + await invoiceSectionDimensionsListMCA(); + await invoiceSectionDimensionsListExpandAndTopMCA(); + await invoiceSectionDimensionsListWithFilterMCA(); + await managementGroupDimensionsListLegacy(); + await managementGroupDimensionsListExpandAndTopLegacy(); + await managementGroupDimensionsListWithFilterLegacy(); + await resourceGroupDimensionsListLegacy(); + await subscriptionDimensionsListLegacy(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsCreateOrUpdateSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsCreateOrUpdateSample.js index 81a2a93b82ca..366594f0042f 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsCreateOrUpdateSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsCreateOrUpdateSample.js @@ -1,288 +1,592 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateByBillingAccount.json + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByBillingAccount.json */ async function exportCreateOrUpdateByBillingAccount() { - const scope = "providers/Microsoft.Billing/billingAccounts/123456"; - const exportName = "TestExport"; - const parameters = { - format: "Csv", - definition: { - type: "ActualCost", - dataSet: { - configuration: { - columns: ["Date", "MeterId", "ResourceId", "ResourceLocation", "Quantity"], - }, - granularity: "Daily", + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ActualCost", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }, - deliveryInfo: { - destination: { - container: "exports", - resourceId: - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", - rootFolderPath: "ad-hoc", + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, }, - }, - schedule: { - recurrence: "Weekly", - recurrencePeriod: { - from: new Date("2020-06-01T00:00:00Z"), - to: new Date("2020-10-31T00:00:00Z"), + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2020-06-01T00:00:00Z"), + to: new Date("2020-06-30T00:00:00Z"), + }, + status: "Active", }, - status: "Active", }, - }; + ); + console.log(result); +} + +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByBillingAccountCustom.json + */ +async function exportCreateOrUpdateByBillingAccountCustom() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.createOrUpdate(scope, exportName, parameters); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ActualCost", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timePeriod: { + from: new Date("2025-04-03T00:00:00.000Z"), + to: new Date("2025-04-03T00:00:00.000Z"), + }, + timeframe: "Custom", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, + }, + exportDescription: "This is a test export.", + partitionData: true, + schedule: { status: "Inactive" }, + }, + ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateByDepartment.json + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByBillingAccountMonthly.json */ -async function exportCreateOrUpdateByDepartment() { - const scope = "providers/Microsoft.Billing/billingAccounts/12/departments/1234"; - const exportName = "TestExport"; - const parameters = { - format: "Csv", - definition: { - type: "ActualCost", - dataSet: { - configuration: { - columns: ["Date", "MeterId", "ResourceId", "ResourceLocation", "Quantity"], +async function exportCreateOrUpdateByBillingAccountMonthly() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ActualCost", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timeframe: "TheLastMonth", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", }, - granularity: "Daily", }, - timeframe: "MonthToDate", - }, - deliveryInfo: { - destination: { - container: "exports", - resourceId: - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", - rootFolderPath: "ad-hoc", + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Monthly", + recurrencePeriod: { + from: new Date("2020-06-05T00:00:00Z"), + to: new Date("2030-06-30T00:00:00Z"), + }, + status: "Active", }, }, - schedule: { - recurrence: "Weekly", - recurrencePeriod: { - from: new Date("2020-06-01T00:00:00Z"), - to: new Date("2020-10-31T00:00:00Z"), + ); + console.log(result); +} + +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByBillingAccountPricesheet.json + */ +async function exportCreateOrUpdateByBillingAccountPricesheet() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "PriceSheet", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timeframe: "TheCurrentMonth", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, + }, + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2023-06-01T00:00:00Z"), + to: new Date("2023-06-30T00:00:00Z"), + }, + status: "Active", }, - status: "Active", }, - }; + ); + console.log(result); +} + +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByBillingAccountReservationDetails.json + */ +async function exportCreateOrUpdateByBillingAccountReservationDetails() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.createOrUpdate(scope, exportName, parameters); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ReservationDetails", + dataSet: { configuration: { dataVersion: "2023-03-01" }, granularity: "Daily" }, + timeframe: "MonthToDate", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, + }, + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2023-06-01T00:00:00Z"), + to: new Date("2023-06-30T00:00:00Z"), + }, + status: "Active", + }, + }, + ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateByEnrollmentAccount.json + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByBillingAccountReservationRecommendation.json */ -async function exportCreateOrUpdateByEnrollmentAccount() { - const scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const exportName = "TestExport"; - const parameters = { - format: "Csv", - definition: { - type: "ActualCost", - dataSet: { - configuration: { - columns: ["Date", "MeterId", "ResourceId", "ResourceLocation", "Quantity"], +async function exportCreateOrUpdateByBillingAccountReservationRecommendation() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ReservationRecommendations", + dataSet: { + configuration: { + dataVersion: "2023-05-01", + filters: [ + { name: "ReservationScope", value: "Single" }, + { name: "ResourceType", value: "VirtualMachines" }, + { name: "LookBackPeriod", value: "Last7Days" }, + ], + }, }, - granularity: "Daily", + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }, - deliveryInfo: { - destination: { - container: "exports", - resourceId: - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", - rootFolderPath: "ad-hoc", + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, }, - }, - schedule: { - recurrence: "Weekly", - recurrencePeriod: { - from: new Date("2020-06-01T00:00:00Z"), - to: new Date("2020-10-31T00:00:00Z"), + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2023-06-01T00:00:00Z"), + to: new Date("2023-06-30T00:00:00Z"), + }, + status: "Active", }, - status: "Active", }, - }; + ); + console.log(result); +} + +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByBillingAccountReservationTransactions.json + */ +async function exportCreateOrUpdateExportCreateOrUpdateByBillingAccountReservationTransactionsByBillingAccount() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.createOrUpdate(scope, exportName, parameters); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ReservationTransactions", + dataSet: { configuration: { dataVersion: "2023-05-01" } }, + timeframe: "MonthToDate", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, + }, + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2023-06-01T00:00:00Z"), + to: new Date("2023-06-30T00:00:00Z"), + }, + status: "Active", + }, + }, + ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateByManagementGroup.json + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByDepartment.json */ -async function exportCreateOrUpdateByManagementGroup() { - const scope = "providers/Microsoft.Management/managementGroups/TestMG"; - const exportName = "TestExport"; - const parameters = { - format: "Csv", - definition: { - type: "ActualCost", - dataSet: { - configuration: { - columns: ["Date", "MeterId", "ResourceId", "ResourceLocation", "Quantity"], +async function exportCreateOrUpdateByDepartment() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/12/departments/1234", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Parquet", + compressionMode: "snappy", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ActualCost", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timeframe: "MonthToDate", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", }, - granularity: "Daily", }, - timeframe: "MonthToDate", - }, - deliveryInfo: { - destination: { - container: "exports", - resourceId: - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", - rootFolderPath: "ad-hoc", + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2020-06-01T00:00:00Z"), + to: new Date("2020-06-30T00:00:00Z"), + }, + status: "Active", }, }, - schedule: { - recurrence: "Weekly", - recurrencePeriod: { - from: new Date("2020-06-01T00:00:00Z"), - to: new Date("2020-10-31T00:00:00Z"), + ); + console.log(result); +} + +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByEnrollmentAccount.json + */ +async function exportCreateOrUpdateByEnrollmentAccount() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ActualCost", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timeframe: "MonthToDate", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, + }, + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2020-06-01T00:00:00Z"), + to: new Date("2020-06-30T00:00:00Z"), + }, + status: "Active", }, - status: "Active", }, - }; + ); + console.log(result); +} + +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByManagementGroup.json + */ +async function exportCreateOrUpdateByManagementGroup() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.createOrUpdate(scope, exportName, parameters); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Management/managementGroups/TestMG", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ActualCost", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timeframe: "MonthToDate", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, + }, + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2020-06-01T00:00:00Z"), + to: new Date("2020-06-30T00:00:00Z"), + }, + status: "Active", + }, + }, + ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateByResourceGroup.json + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByResourceGroup.json */ async function exportCreateOrUpdateByResourceGroup() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; - const exportName = "TestExport"; - const parameters = { - format: "Csv", - definition: { - type: "ActualCost", - dataSet: { - configuration: { - columns: ["Date", "MeterId", "ResourceId", "ResourceLocation", "Quantity"], - }, - granularity: "Daily", + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.exports.createOrUpdate( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ActualCost", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }, - deliveryInfo: { - destination: { - container: "exports", - resourceId: - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", - rootFolderPath: "ad-hoc", + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, }, - }, - schedule: { - recurrence: "Weekly", - recurrencePeriod: { - from: new Date("2020-06-01T00:00:00Z"), - to: new Date("2020-10-31T00:00:00Z"), + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2020-06-01T00:00:00Z"), + to: new Date("2020-06-30T00:00:00Z"), + }, + status: "Active", }, - status: "Active", }, - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.exports.createOrUpdate(scope, exportName, parameters); + ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateBySubscription.json + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateBySubscription.json */ async function exportCreateOrUpdateBySubscription() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const exportName = "TestExport"; - const parameters = { - format: "Csv", - definition: { - type: "ActualCost", - dataSet: { - configuration: { - columns: ["Date", "MeterId", "ResourceId", "ResourceLocation", "Quantity"], - }, - granularity: "Daily", + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.exports.createOrUpdate( + "subscriptions/00000000-0000-0000-0000-000000000000", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ActualCost", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }, - deliveryInfo: { - destination: { - container: "exports", - resourceId: - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", - rootFolderPath: "ad-hoc", + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, }, - }, - schedule: { - recurrence: "Weekly", - recurrencePeriod: { - from: new Date("2020-06-01T00:00:00Z"), - to: new Date("2020-10-31T00:00:00Z"), + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2020-06-01T00:00:00Z"), + to: new Date("2020-06-30T00:00:00Z"), + }, + status: "Active", }, - status: "Active", }, - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.exports.createOrUpdate(scope, exportName, parameters); + ); console.log(result); } async function main() { - exportCreateOrUpdateByBillingAccount(); - exportCreateOrUpdateByDepartment(); - exportCreateOrUpdateByEnrollmentAccount(); - exportCreateOrUpdateByManagementGroup(); - exportCreateOrUpdateByResourceGroup(); - exportCreateOrUpdateBySubscription(); + await exportCreateOrUpdateByBillingAccount(); + await exportCreateOrUpdateByBillingAccountCustom(); + await exportCreateOrUpdateByBillingAccountMonthly(); + await exportCreateOrUpdateByBillingAccountPricesheet(); + await exportCreateOrUpdateByBillingAccountReservationDetails(); + await exportCreateOrUpdateByBillingAccountReservationRecommendation(); + await exportCreateOrUpdateExportCreateOrUpdateByBillingAccountReservationTransactionsByBillingAccount(); + await exportCreateOrUpdateByDepartment(); + await exportCreateOrUpdateByEnrollmentAccount(); + await exportCreateOrUpdateByManagementGroup(); + await exportCreateOrUpdateByResourceGroup(); + await exportCreateOrUpdateBySubscription(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsDeleteSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsDeleteSample.js index 20bc115dc566..66655fafcc6b 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsDeleteSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsDeleteSample.js @@ -1,114 +1,100 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to The operation to delete a export. + * This sample demonstrates how to the operation to delete a export. * - * @summary The operation to delete a export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteByBillingAccount.json + * @summary the operation to delete a export. + * x-ms-original-file: 2025-03-01/ExportDeleteByBillingAccount.json */ async function exportDeleteByBillingAccount() { - const scope = "providers/Microsoft.Billing/billingAccounts/123456"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.delete(scope, exportName); - console.log(result); + await client.exports.delete("providers/Microsoft.Billing/billingAccounts/123456", "TestExport"); } /** - * This sample demonstrates how to The operation to delete a export. + * This sample demonstrates how to the operation to delete a export. * - * @summary The operation to delete a export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteByDepartment.json + * @summary the operation to delete a export. + * x-ms-original-file: 2025-03-01/ExportDeleteByDepartment.json */ async function exportDeleteByDepartment() { - const scope = "providers/Microsoft.Billing/billingAccounts/12/departments/1234"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.delete(scope, exportName); - console.log(result); + await client.exports.delete( + "providers/Microsoft.Billing/billingAccounts/12/departments/1234", + "TestExport", + ); } /** - * This sample demonstrates how to The operation to delete a export. + * This sample demonstrates how to the operation to delete a export. * - * @summary The operation to delete a export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteByEnrollmentAccount.json + * @summary the operation to delete a export. + * x-ms-original-file: 2025-03-01/ExportDeleteByEnrollmentAccount.json */ async function exportDeleteByEnrollmentAccount() { - const scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.delete(scope, exportName); - console.log(result); + await client.exports.delete( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + "TestExport", + ); } /** - * This sample demonstrates how to The operation to delete a export. + * This sample demonstrates how to the operation to delete a export. * - * @summary The operation to delete a export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteByManagementGroup.json + * @summary the operation to delete a export. + * x-ms-original-file: 2025-03-01/ExportDeleteByManagementGroup.json */ async function exportDeleteByManagementGroup() { - const scope = "providers/Microsoft.Management/managementGroups/TestMG"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.delete(scope, exportName); - console.log(result); + await client.exports.delete( + "providers/Microsoft.Management/managementGroups/TestMG", + "TestExport", + ); } /** - * This sample demonstrates how to The operation to delete a export. + * This sample demonstrates how to the operation to delete a export. * - * @summary The operation to delete a export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteByResourceGroup.json + * @summary the operation to delete a export. + * x-ms-original-file: 2025-03-01/ExportDeleteByResourceGroup.json */ async function exportDeleteByResourceGroup() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.delete(scope, exportName); - console.log(result); + await client.exports.delete( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + "TestExport", + ); } /** - * This sample demonstrates how to The operation to delete a export. + * This sample demonstrates how to the operation to delete a export. * - * @summary The operation to delete a export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteBySubscription.json + * @summary the operation to delete a export. + * x-ms-original-file: 2025-03-01/ExportDeleteBySubscription.json */ async function exportDeleteBySubscription() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.delete(scope, exportName); - console.log(result); + await client.exports.delete("subscriptions/00000000-0000-0000-0000-000000000000", "TestExport"); } async function main() { - exportDeleteByBillingAccount(); - exportDeleteByDepartment(); - exportDeleteByEnrollmentAccount(); - exportDeleteByManagementGroup(); - exportDeleteByResourceGroup(); - exportDeleteBySubscription(); + await exportDeleteByBillingAccount(); + await exportDeleteByDepartment(); + await exportDeleteByEnrollmentAccount(); + await exportDeleteByManagementGroup(); + await exportDeleteByResourceGroup(); + await exportDeleteBySubscription(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsExecuteSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsExecuteSample.js index f4a64c74ce68..9dab61bf0d53 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsExecuteSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsExecuteSample.js @@ -1,114 +1,113 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to The operation to run an export. + * This sample demonstrates how to the operation to run an export. * - * @summary The operation to run an export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunByBillingAccount.json + * @summary the operation to run an export. + * x-ms-original-file: 2025-03-01/ExportRunByBillingAccount.json */ async function exportRunByBillingAccount() { - const scope = "providers/Microsoft.Billing/billingAccounts/123456"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.execute(scope, exportName); - console.log(result); + await client.exports.execute("providers/Microsoft.Billing/billingAccounts/123456", "TestExport"); +} + +/** + * This sample demonstrates how to the operation to run an export. + * + * @summary the operation to run an export. + * x-ms-original-file: 2025-03-01/ExportRunByBillingAccountWithOptionalRequestBody.json + */ +async function exportRunByBillingAccountWithOptionalRequestBody() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + await client.exports.execute("providers/Microsoft.Billing/billingAccounts/123456", "TestExport"); } /** - * This sample demonstrates how to The operation to run an export. + * This sample demonstrates how to the operation to run an export. * - * @summary The operation to run an export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunByDepartment.json + * @summary the operation to run an export. + * x-ms-original-file: 2025-03-01/ExportRunByDepartment.json */ async function exportRunByDepartment() { - const scope = "providers/Microsoft.Billing/billingAccounts/12/departments/1234"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.execute(scope, exportName); - console.log(result); + await client.exports.execute( + "providers/Microsoft.Billing/billingAccounts/12/departments/1234", + "TestExport", + ); } /** - * This sample demonstrates how to The operation to run an export. + * This sample demonstrates how to the operation to run an export. * - * @summary The operation to run an export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunByEnrollmentAccount.json + * @summary the operation to run an export. + * x-ms-original-file: 2025-03-01/ExportRunByEnrollmentAccount.json */ async function exportRunByEnrollmentAccount() { - const scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.execute(scope, exportName); - console.log(result); + await client.exports.execute( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + "TestExport", + ); } /** - * This sample demonstrates how to The operation to run an export. + * This sample demonstrates how to the operation to run an export. * - * @summary The operation to run an export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunByManagementGroup.json + * @summary the operation to run an export. + * x-ms-original-file: 2025-03-01/ExportRunByManagementGroup.json */ async function exportRunByManagementGroup() { - const scope = "providers/Microsoft.Management/managementGroups/TestMG"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.execute(scope, exportName); - console.log(result); + await client.exports.execute( + "providers/Microsoft.Management/managementGroups/TestMG", + "TestExport", + ); } /** - * This sample demonstrates how to The operation to run an export. + * This sample demonstrates how to the operation to run an export. * - * @summary The operation to run an export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunByResourceGroup.json + * @summary the operation to run an export. + * x-ms-original-file: 2025-03-01/ExportRunByResourceGroup.json */ async function exportRunByResourceGroup() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.execute(scope, exportName); - console.log(result); + await client.exports.execute( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + "TestExport", + ); } /** - * This sample demonstrates how to The operation to run an export. + * This sample demonstrates how to the operation to run an export. * - * @summary The operation to run an export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunBySubscription.json + * @summary the operation to run an export. + * x-ms-original-file: 2025-03-01/ExportRunBySubscription.json */ async function exportRunBySubscription() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.execute(scope, exportName); - console.log(result); + await client.exports.execute("subscriptions/00000000-0000-0000-0000-000000000000", "TestExport"); } async function main() { - exportRunByBillingAccount(); - exportRunByDepartment(); - exportRunByEnrollmentAccount(); - exportRunByManagementGroup(); - exportRunByResourceGroup(); - exportRunBySubscription(); + await exportRunByBillingAccount(); + await exportRunByBillingAccountWithOptionalRequestBody(); + await exportRunByDepartment(); + await exportRunByEnrollmentAccount(); + await exportRunByManagementGroup(); + await exportRunByResourceGroup(); + await exportRunBySubscription(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsGetExecutionHistorySample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsGetExecutionHistorySample.js index 2c94df4afa65..a281238238af 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsGetExecutionHistorySample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsGetExecutionHistorySample.js @@ -1,114 +1,112 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to The operation to get the run history of an export for the defined scope and export name. + * This sample demonstrates how to the operation to get the run history of an export for the defined scope and export name. * - * @summary The operation to get the run history of an export for the defined scope and export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetByBillingAccount.json + * @summary the operation to get the run history of an export for the defined scope and export name. + * x-ms-original-file: 2025-03-01/ExportRunHistoryGetByBillingAccount.json */ async function exportRunHistoryGetByBillingAccount() { - const scope = "providers/Microsoft.Billing/billingAccounts/123456"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.getExecutionHistory(scope, exportName); + const result = await client.exports.getExecutionHistory( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the run history of an export for the defined scope and export name. + * This sample demonstrates how to the operation to get the run history of an export for the defined scope and export name. * - * @summary The operation to get the run history of an export for the defined scope and export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetByDepartment.json + * @summary the operation to get the run history of an export for the defined scope and export name. + * x-ms-original-file: 2025-03-01/ExportRunHistoryGetByDepartment.json */ async function exportRunHistoryGetByDepartment() { - const scope = "providers/Microsoft.Billing/billingAccounts/12/departments/1234"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.getExecutionHistory(scope, exportName); + const result = await client.exports.getExecutionHistory( + "providers/Microsoft.Billing/billingAccounts/12/departments/1234", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the run history of an export for the defined scope and export name. + * This sample demonstrates how to the operation to get the run history of an export for the defined scope and export name. * - * @summary The operation to get the run history of an export for the defined scope and export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetByEnrollmentAccount.json + * @summary the operation to get the run history of an export for the defined scope and export name. + * x-ms-original-file: 2025-03-01/ExportRunHistoryGetByEnrollmentAccount.json */ async function exportRunHistoryGetByEnrollmentAccount() { - const scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.getExecutionHistory(scope, exportName); + const result = await client.exports.getExecutionHistory( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the run history of an export for the defined scope and export name. + * This sample demonstrates how to the operation to get the run history of an export for the defined scope and export name. * - * @summary The operation to get the run history of an export for the defined scope and export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetByManagementGroup.json + * @summary the operation to get the run history of an export for the defined scope and export name. + * x-ms-original-file: 2025-03-01/ExportRunHistoryGetByManagementGroup.json */ async function exportRunHistoryGetByManagementGroup() { - const scope = "providers/Microsoft.Management/managementGroups/TestMG"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.getExecutionHistory(scope, exportName); + const result = await client.exports.getExecutionHistory( + "providers/Microsoft.Management/managementGroups/TestMG", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the run history of an export for the defined scope and export name. + * This sample demonstrates how to the operation to get the run history of an export for the defined scope and export name. * - * @summary The operation to get the run history of an export for the defined scope and export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetByResourceGroup.json + * @summary the operation to get the run history of an export for the defined scope and export name. + * x-ms-original-file: 2025-03-01/ExportRunHistoryGetByResourceGroup.json */ async function exportRunHistoryGetByResourceGroup() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.getExecutionHistory(scope, exportName); + const result = await client.exports.getExecutionHistory( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the run history of an export for the defined scope and export name. + * This sample demonstrates how to the operation to get the run history of an export for the defined scope and export name. * - * @summary The operation to get the run history of an export for the defined scope and export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetBySubscription.json + * @summary the operation to get the run history of an export for the defined scope and export name. + * x-ms-original-file: 2025-03-01/ExportRunHistoryGetBySubscription.json */ async function exportRunHistoryGetBySubscription() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.getExecutionHistory(scope, exportName); + const result = await client.exports.getExecutionHistory( + "subscriptions/00000000-0000-0000-0000-000000000000", + "TestExport", + ); console.log(result); } async function main() { - exportRunHistoryGetByBillingAccount(); - exportRunHistoryGetByDepartment(); - exportRunHistoryGetByEnrollmentAccount(); - exportRunHistoryGetByManagementGroup(); - exportRunHistoryGetByResourceGroup(); - exportRunHistoryGetBySubscription(); + await exportRunHistoryGetByBillingAccount(); + await exportRunHistoryGetByDepartment(); + await exportRunHistoryGetByEnrollmentAccount(); + await exportRunHistoryGetByManagementGroup(); + await exportRunHistoryGetByResourceGroup(); + await exportRunHistoryGetBySubscription(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsGetSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsGetSample.js index 5c887c03bc39..a408b97825c1 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsGetSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsGetSample.js @@ -1,114 +1,112 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to The operation to get the export for the defined scope by export name. + * This sample demonstrates how to the operation to get the export for the defined scope by export name. * - * @summary The operation to get the export for the defined scope by export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetByBillingAccount.json + * @summary the operation to get the export for the defined scope by export name. + * x-ms-original-file: 2025-03-01/ExportGetByBillingAccount.json */ async function exportGetByBillingAccount() { - const scope = "providers/Microsoft.Billing/billingAccounts/123456"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.get(scope, exportName); + const result = await client.exports.get( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the export for the defined scope by export name. + * This sample demonstrates how to the operation to get the export for the defined scope by export name. * - * @summary The operation to get the export for the defined scope by export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetByDepartment.json + * @summary the operation to get the export for the defined scope by export name. + * x-ms-original-file: 2025-03-01/ExportGetByDepartment.json */ async function exportGetByDepartment() { - const scope = "providers/Microsoft.Billing/billingAccounts/12/departments/1234"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.get(scope, exportName); + const result = await client.exports.get( + "providers/Microsoft.Billing/billingAccounts/12/departments/1234", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the export for the defined scope by export name. + * This sample demonstrates how to the operation to get the export for the defined scope by export name. * - * @summary The operation to get the export for the defined scope by export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetByEnrollmentAccount.json + * @summary the operation to get the export for the defined scope by export name. + * x-ms-original-file: 2025-03-01/ExportGetByEnrollmentAccount.json */ async function exportGetByEnrollmentAccount() { - const scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.get(scope, exportName); + const result = await client.exports.get( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the export for the defined scope by export name. + * This sample demonstrates how to the operation to get the export for the defined scope by export name. * - * @summary The operation to get the export for the defined scope by export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetByManagementGroup.json + * @summary the operation to get the export for the defined scope by export name. + * x-ms-original-file: 2025-03-01/ExportGetByManagementGroup.json */ async function exportGetByManagementGroup() { - const scope = "providers/Microsoft.Management/managementGroups/TestMG"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.get(scope, exportName); + const result = await client.exports.get( + "providers/Microsoft.Management/managementGroups/TestMG", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the export for the defined scope by export name. + * This sample demonstrates how to the operation to get the export for the defined scope by export name. * - * @summary The operation to get the export for the defined scope by export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetByResourceGroup.json + * @summary the operation to get the export for the defined scope by export name. + * x-ms-original-file: 2025-03-01/ExportGetByResourceGroup.json */ async function exportGetByResourceGroup() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.get(scope, exportName); + const result = await client.exports.get( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the export for the defined scope by export name. + * This sample demonstrates how to the operation to get the export for the defined scope by export name. * - * @summary The operation to get the export for the defined scope by export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetBySubscription.json + * @summary the operation to get the export for the defined scope by export name. + * x-ms-original-file: 2025-03-01/ExportGetBySubscription.json */ async function exportGetBySubscription() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.get(scope, exportName); + const result = await client.exports.get( + "subscriptions/00000000-0000-0000-0000-000000000000", + "TestExport", + ); console.log(result); } async function main() { - exportGetByBillingAccount(); - exportGetByDepartment(); - exportGetByEnrollmentAccount(); - exportGetByManagementGroup(); - exportGetByResourceGroup(); - exportGetBySubscription(); + await exportGetByBillingAccount(); + await exportGetByDepartment(); + await exportGetByEnrollmentAccount(); + await exportGetByManagementGroup(); + await exportGetByResourceGroup(); + await exportGetBySubscription(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsListSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsListSample.js index 2f27d34e82a1..a7235ffe570b 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsListSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/exportsListSample.js @@ -1,108 +1,102 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to The operation to list all exports at the given scope. + * This sample demonstrates how to the operation to list all exports at the given scope. * - * @summary The operation to list all exports at the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetByBillingAccount.json + * @summary the operation to list all exports at the given scope. + * x-ms-original-file: 2025-03-01/ExportsGetByBillingAccount.json */ async function exportsGetByBillingAccount() { - const scope = "providers/Microsoft.Billing/billingAccounts/123456"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.list(scope); + const result = await client.exports.list("providers/Microsoft.Billing/billingAccounts/123456"); console.log(result); } /** - * This sample demonstrates how to The operation to list all exports at the given scope. + * This sample demonstrates how to the operation to list all exports at the given scope. * - * @summary The operation to list all exports at the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetByDepartment.json + * @summary the operation to list all exports at the given scope. + * x-ms-original-file: 2025-03-01/ExportsGetByDepartment.json */ async function exportsGetByDepartment() { - const scope = "providers/Microsoft.Billing/billingAccounts/12/departments/123"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.list(scope); + const result = await client.exports.list( + "providers/Microsoft.Billing/billingAccounts/12/departments/123", + ); console.log(result); } /** - * This sample demonstrates how to The operation to list all exports at the given scope. + * This sample demonstrates how to the operation to list all exports at the given scope. * - * @summary The operation to list all exports at the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetByEnrollmentAccount.json + * @summary the operation to list all exports at the given scope. + * x-ms-original-file: 2025-03-01/ExportsGetByEnrollmentAccount.json */ async function exportsGetByEnrollmentAccount() { - const scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.list(scope); + const result = await client.exports.list( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + ); console.log(result); } /** - * This sample demonstrates how to The operation to list all exports at the given scope. + * This sample demonstrates how to the operation to list all exports at the given scope. * - * @summary The operation to list all exports at the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetByManagementGroup.json + * @summary the operation to list all exports at the given scope. + * x-ms-original-file: 2025-03-01/ExportsGetByManagementGroup.json */ async function exportsGetByManagementGroup() { - const scope = "providers/Microsoft.Management/managementGroups/TestMG"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.list(scope); + const result = await client.exports.list( + "providers/Microsoft.Management/managementGroups/TestMG", + ); console.log(result); } /** - * This sample demonstrates how to The operation to list all exports at the given scope. + * This sample demonstrates how to the operation to list all exports at the given scope. * - * @summary The operation to list all exports at the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetByResourceGroup.json + * @summary the operation to list all exports at the given scope. + * x-ms-original-file: 2025-03-01/ExportsGetByResourceGroup.json */ async function exportsGetByResourceGroup() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.list(scope); + const result = await client.exports.list( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + ); console.log(result); } /** - * This sample demonstrates how to The operation to list all exports at the given scope. + * This sample demonstrates how to the operation to list all exports at the given scope. * - * @summary The operation to list all exports at the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetBySubscription.json + * @summary the operation to list all exports at the given scope. + * x-ms-original-file: 2025-03-01/ExportsGetBySubscription.json */ async function exportsGetBySubscription() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.list(scope); + const result = await client.exports.list("subscriptions/00000000-0000-0000-0000-000000000000"); console.log(result); } async function main() { - exportsGetByBillingAccount(); - exportsGetByDepartment(); - exportsGetByEnrollmentAccount(); - exportsGetByManagementGroup(); - exportsGetByResourceGroup(); - exportsGetBySubscription(); + await exportsGetByBillingAccount(); + await exportsGetByDepartment(); + await exportsGetByEnrollmentAccount(); + await exportsGetByManagementGroup(); + await exportsGetByResourceGroup(); + await exportsGetBySubscription(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/forecastExternalCloudProviderUsageSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/forecastExternalCloudProviderUsageSample.js index c9e58afb3e8f..e6153f429733 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/forecastExternalCloudProviderUsageSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/forecastExternalCloudProviderUsageSample.js @@ -1,87 +1,64 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Lists the forecast charges for external cloud provider type defined. + * This sample demonstrates how to lists the forecast charges for external cloud provider type defined. * - * @summary Lists the forecast charges for external cloud provider type defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalBillingAccountForecast.json + * @summary lists the forecast charges for external cloud provider type defined. + * x-ms-original-file: 2025-03-01/ExternalBillingAccountForecast.json */ async function externalBillingAccountForecast() { - const externalCloudProviderType = "externalBillingAccounts"; - const externalCloudProviderId = "100"; - const parameters = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "Cost", function: "Sum" } }, - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.forecast.externalCloudProviderUsage( + "externalBillingAccounts", + "100", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "Cost", function: "Sum" } }, + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", - }, - timePeriod: { - from: new Date("2022-08-01T00:00:00+00:00"), - to: new Date("2022-08-31T23:59:59+00:00"), + timePeriod: { + from: new Date("2022-08-01T00:00:00+00:00"), + to: new Date("2022-08-31T23:59:59+00:00"), + }, + timeframe: "Custom", }, - timeframe: "Custom", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.forecast.externalCloudProviderUsage( - externalCloudProviderType, - externalCloudProviderId, - parameters ); console.log(result); } /** - * This sample demonstrates how to Lists the forecast charges for external cloud provider type defined. + * This sample demonstrates how to lists the forecast charges for external cloud provider type defined. * - * @summary Lists the forecast charges for external cloud provider type defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalSubscriptionForecast.json + * @summary lists the forecast charges for external cloud provider type defined. + * x-ms-original-file: 2025-03-01/ExternalSubscriptionForecast.json */ async function externalSubscriptionForecast() { - const externalCloudProviderType = "externalSubscriptions"; - const externalCloudProviderId = "100"; - const parameters = { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.forecast.externalCloudProviderUsage("externalSubscriptions", "100", { type: "Usage", dataset: { aggregation: { totalCost: { name: "Cost", function: "Sum" } }, @@ -96,22 +73,10 @@ async function externalSubscriptionForecast() { values: ["East US", "West Europe"], }, }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], - }, - }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, ], }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], - }, - }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, ], }, granularity: "Daily", @@ -121,20 +86,13 @@ async function externalSubscriptionForecast() { to: new Date("2022-08-31T23:59:59+00:00"), }, timeframe: "Custom", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.forecast.externalCloudProviderUsage( - externalCloudProviderType, - externalCloudProviderId, - parameters - ); + }); console.log(result); } async function main() { - externalBillingAccountForecast(); - externalSubscriptionForecast(); + await externalBillingAccountForecast(); + await externalSubscriptionForecast(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/forecastUsageSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/forecastUsageSample.js index 76e43cf76ae4..6547a404909b 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/forecastUsageSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/forecastUsageSample.js @@ -1,370 +1,295 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Lists the forecast charges for scope defined. + * This sample demonstrates how to lists the forecast charges for scope defined. * - * @summary Lists the forecast charges for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountForecast.json + * @summary lists the forecast charges for scope defined. + * x-ms-original-file: 2025-03-01/BillingAccountForecast.json */ async function billingAccountForecast() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789"; - const parameters = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "Cost", function: "Sum" } }, - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.forecast.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "Cost", function: "Sum" } }, + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", - }, - includeActualCost: false, - includeFreshPartialCost: false, - timePeriod: { - from: new Date("2022-08-01T00:00:00+00:00"), - to: new Date("2022-08-31T23:59:59+00:00"), + includeActualCost: false, + includeFreshPartialCost: false, + timePeriod: { + from: new Date("2022-08-01T00:00:00+00:00"), + to: new Date("2022-08-31T23:59:59+00:00"), + }, + timeframe: "Custom", }, - timeframe: "Custom", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.forecast.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Lists the forecast charges for scope defined. + * This sample demonstrates how to lists the forecast charges for scope defined. * - * @summary Lists the forecast charges for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingProfileForecast.json + * @summary lists the forecast charges for scope defined. + * x-ms-original-file: 2025-03-01/BillingProfileForecast.json */ async function billingProfileForecast() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; - const parameters = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "Cost", function: "Sum" } }, - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.forecast.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "Cost", function: "Sum" } }, + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", - }, - includeActualCost: false, - includeFreshPartialCost: false, - timePeriod: { - from: new Date("2022-08-01T00:00:00+00:00"), - to: new Date("2022-08-31T23:59:59+00:00"), + includeActualCost: false, + includeFreshPartialCost: false, + timePeriod: { + from: new Date("2022-08-01T00:00:00+00:00"), + to: new Date("2022-08-31T23:59:59+00:00"), + }, + timeframe: "Custom", }, - timeframe: "Custom", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.forecast.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Lists the forecast charges for scope defined. + * This sample demonstrates how to lists the forecast charges for scope defined. * - * @summary Lists the forecast charges for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentForecast.json + * @summary lists the forecast charges for scope defined. + * x-ms-original-file: 2025-03-01/DepartmentForecast.json */ async function departmentForecast() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123"; - const parameters = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "Cost", function: "Sum" } }, - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.forecast.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "Cost", function: "Sum" } }, + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", - }, - includeActualCost: false, - includeFreshPartialCost: false, - timePeriod: { - from: new Date("2022-08-01T00:00:00+00:00"), - to: new Date("2022-08-31T23:59:59+00:00"), + includeActualCost: false, + includeFreshPartialCost: false, + timePeriod: { + from: new Date("2022-08-01T00:00:00+00:00"), + to: new Date("2022-08-31T23:59:59+00:00"), + }, + timeframe: "Custom", }, - timeframe: "Custom", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.forecast.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Lists the forecast charges for scope defined. + * This sample demonstrates how to lists the forecast charges for scope defined. * - * @summary Lists the forecast charges for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountForecast.json + * @summary lists the forecast charges for scope defined. + * x-ms-original-file: 2025-03-01/EnrollmentAccountForecast.json */ async function enrollmentAccountForecast() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456"; - const parameters = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "Cost", function: "Sum" } }, - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.forecast.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "Cost", function: "Sum" } }, + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", - }, - includeActualCost: false, - includeFreshPartialCost: false, - timePeriod: { - from: new Date("2022-08-01T00:00:00+00:00"), - to: new Date("2022-08-31T23:59:59+00:00"), + includeActualCost: false, + includeFreshPartialCost: false, + timePeriod: { + from: new Date("2022-08-01T00:00:00+00:00"), + to: new Date("2022-08-31T23:59:59+00:00"), + }, + timeframe: "Custom", }, - timeframe: "Custom", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.forecast.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Lists the forecast charges for scope defined. + * This sample demonstrates how to lists the forecast charges for scope defined. * - * @summary Lists the forecast charges for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/InvoiceSectionForecast.json + * @summary lists the forecast charges for scope defined. + * x-ms-original-file: 2025-03-01/InvoiceSectionForecast.json */ async function invoiceSectionForecast() { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876"; - const parameters = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "Cost", function: "Sum" } }, - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.forecast.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "Cost", function: "Sum" } }, + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", - }, - includeActualCost: false, - includeFreshPartialCost: false, - timePeriod: { - from: new Date("2022-08-01T00:00:00+00:00"), - to: new Date("2022-08-31T23:59:59+00:00"), + includeActualCost: false, + includeFreshPartialCost: false, + timePeriod: { + from: new Date("2022-08-01T00:00:00+00:00"), + to: new Date("2022-08-31T23:59:59+00:00"), + }, + timeframe: "Custom", }, - timeframe: "Custom", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.forecast.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Lists the forecast charges for scope defined. + * This sample demonstrates how to lists the forecast charges for scope defined. * - * @summary Lists the forecast charges for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ResourceGroupForecast.json + * @summary lists the forecast charges for scope defined. + * x-ms-original-file: 2025-03-01/ResourceGroupForecast.json */ async function resourceGroupForecast() { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"; - const parameters = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "Cost", function: "Sum" } }, - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.forecast.usage( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "Cost", function: "Sum" } }, + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", - }, - includeActualCost: false, - includeFreshPartialCost: false, - timePeriod: { - from: new Date("2022-08-01T00:00:00+00:00"), - to: new Date("2022-08-31T23:59:59+00:00"), + includeActualCost: false, + includeFreshPartialCost: false, + timePeriod: { + from: new Date("2022-08-01T00:00:00+00:00"), + to: new Date("2022-08-31T23:59:59+00:00"), + }, + timeframe: "Custom", }, - timeframe: "Custom", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.forecast.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Lists the forecast charges for scope defined. + * This sample demonstrates how to lists the forecast charges for scope defined. * - * @summary Lists the forecast charges for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SubscriptionForecast.json + * @summary lists the forecast charges for scope defined. + * x-ms-original-file: 2025-03-01/SubscriptionForecast.json */ async function subscriptionForecast() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const parameters = { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.forecast.usage("subscriptions/00000000-0000-0000-0000-000000000000", { type: "Usage", dataset: { aggregation: { totalCost: { name: "Cost", function: "Sum" } }, @@ -379,22 +304,10 @@ async function subscriptionForecast() { values: ["East US", "West Europe"], }, }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], - }, - }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, ], }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], - }, - }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, ], }, granularity: "Daily", @@ -406,21 +319,18 @@ async function subscriptionForecast() { to: new Date("2022-08-31T23:59:59+00:00"), }, timeframe: "Custom", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.forecast.usage(scope, parameters); + }); console.log(result); } async function main() { - billingAccountForecast(); - billingProfileForecast(); - departmentForecast(); - enrollmentAccountForecast(); - invoiceSectionForecast(); - resourceGroupForecast(); - subscriptionForecast(); + await billingAccountForecast(); + await billingProfileForecast(); + await departmentForecast(); + await enrollmentAccountForecast(); + await invoiceSectionForecast(); + await resourceGroupForecast(); + await subscriptionForecast(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateBenefitUtilizationSummariesReportGenerateByBillingAccountSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateBenefitUtilizationSummariesReportGenerateByBillingAccountSample.js new file mode 100644 index 000000000000..e0b2261f5dc1 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateBenefitUtilizationSummariesReportGenerateByBillingAccountSample.js @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CostManagementClient } = require("@azure/arm-costmanagement"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. + * + * @summary triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByBillingAccount.json + */ +async function generateUtilizationSummariesReportByBillingAccount() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.generateBenefitUtilizationSummariesReport.generateByBillingAccount( + "8099099", + { + endDate: new Date("2022-08-31T00:00:00Z"), + grain: "Daily", + kind: "Reservation", + startDate: new Date("2022-06-01T00:00:00Z"), + }, + ); + console.log(result); +} + +async function main() { + await generateUtilizationSummariesReportByBillingAccount(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateBenefitUtilizationSummariesReportGenerateByBillingProfileSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateBenefitUtilizationSummariesReportGenerateByBillingProfileSample.js new file mode 100644 index 000000000000..0107f2bbba28 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateBenefitUtilizationSummariesReportGenerateByBillingProfileSample.js @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CostManagementClient } = require("@azure/arm-costmanagement"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. + * + * @summary triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByBillingProfile.json + */ +async function generateUtilizationSummariesReportByBillingProfile() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.generateBenefitUtilizationSummariesReport.generateByBillingProfile( + "00000000-0000-0000-0000-000000000000", + "CZSFR-SDFXC-DSDF", + { + endDate: new Date("2022-08-31T00:00:00Z"), + grain: "Daily", + kind: "Reservation", + startDate: new Date("2022-06-01T00:00:00Z"), + }, + ); + console.log(result); +} + +async function main() { + await generateUtilizationSummariesReportByBillingProfile(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateBenefitUtilizationSummariesReportGenerateByReservationIdSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateBenefitUtilizationSummariesReportGenerateByReservationIdSample.js new file mode 100644 index 000000000000..77f9c8656757 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateBenefitUtilizationSummariesReportGenerateByReservationIdSample.js @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CostManagementClient } = require("@azure/arm-costmanagement"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to triggers generation of a benefit utilization summaries report for the provided reservation. + * + * @summary triggers generation of a benefit utilization summaries report for the provided reservation. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByReservation.json + */ +async function generateUtilizationSummariesReportByReservation() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.generateBenefitUtilizationSummariesReport.generateByReservationId( + "00000000-0000-0000-0000-000000000000", + "00000000-0000-0000-0000-000000000000", + { + endDate: new Date("2022-08-31T00:00:00Z"), + grain: "Daily", + startDate: new Date("2022-06-01T00:00:00Z"), + }, + ); + console.log(result); +} + +async function main() { + await generateUtilizationSummariesReportByReservation(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateBenefitUtilizationSummariesReportGenerateByReservationOrderIdSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateBenefitUtilizationSummariesReportGenerateByReservationOrderIdSample.js new file mode 100644 index 000000000000..a0bc424158cd --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateBenefitUtilizationSummariesReportGenerateByReservationOrderIdSample.js @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CostManagementClient } = require("@azure/arm-costmanagement"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to triggers generation of a benefit utilization summaries report for the provided reservation order. + * + * @summary triggers generation of a benefit utilization summaries report for the provided reservation order. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByReservationOrder.json + */ +async function generateUtilizationSummariesReportByReservationOrder() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = + await client.generateBenefitUtilizationSummariesReport.generateByReservationOrderId( + "00000000-0000-0000-0000-000000000000", + { + endDate: new Date("2022-08-31T00:00:00Z"), + grain: "Daily", + startDate: new Date("2022-06-01T00:00:00Z"), + }, + ); + console.log(result); +} + +async function main() { + await generateUtilizationSummariesReportByReservationOrder(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdSample.js new file mode 100644 index 000000000000..3cc053e2ebee --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdSample.js @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CostManagementClient } = require("@azure/arm-costmanagement"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to triggers generation of a benefit utilization summaries report for the provided savings plan. + * + * @summary triggers generation of a benefit utilization summaries report for the provided savings plan. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportBySavingsPlan.json + */ +async function generateUtilizationSummariesReportBySavingsPlan() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.generateBenefitUtilizationSummariesReport.generateBySavingsPlanId( + "00000000-0000-0000-0000-000000000000", + "00000000-0000-0000-0000-000000000000", + { + endDate: new Date("2022-08-31T00:00:00Z"), + grain: "Daily", + startDate: new Date("2022-06-01T00:00:00Z"), + }, + ); + console.log(result); +} + +async function main() { + await generateUtilizationSummariesReportBySavingsPlan(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdSample.js new file mode 100644 index 000000000000..53563a1517df --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdSample.js @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CostManagementClient } = require("@azure/arm-costmanagement"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to triggers generation of a benefit utilization summaries report for the provided savings plan order. + * + * @summary triggers generation of a benefit utilization summaries report for the provided savings plan order. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportBySavingsPlanOrder.json + */ +async function generateUtilizationSummariesReportBySavingsPlanOrder() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = + await client.generateBenefitUtilizationSummariesReport.generateBySavingsPlanOrderId( + "00000000-0000-0000-0000-000000000000", + { + endDate: new Date("2022-08-31T00:00:00Z"), + grain: "Daily", + startDate: new Date("2022-06-01T00:00:00Z"), + }, + ); + console.log(result); +} + +async function main() { + await generateUtilizationSummariesReportBySavingsPlanOrder(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateCostDetailsReportCreateOperationSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateCostDetailsReportCreateOperationSample.js index 1a7d3925602e..6e28932ec41f 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateCostDetailsReportCreateOperationSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateCostDetailsReportCreateOperationSample.js @@ -1,172 +1,129 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields + * This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields * - * @summary This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod.json + * @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields + * x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod.json */ async function generateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345"; - const parameters = { - billingPeriod: "202205", - metric: "ActualCost", - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateCostDetailsReport.beginCreateOperationAndWait( - scope, - parameters + const result = await client.generateCostDetailsReport.createOperation( + "providers/Microsoft.Billing/billingAccounts/12345", + { billingPeriod: "202205", metric: "ActualCost" }, ); console.log(result); } /** - * This sample demonstrates how to This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields + * This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields * - * @summary This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByBillingProfileAndInvoiceId.json + * @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields + * x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByBillingProfileAndInvoiceId.json */ async function generateCostDetailsReportByBillingProfileAndInvoiceId() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; - const parameters = { - invoiceId: "M1234567", - metric: "ActualCost", - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateCostDetailsReport.beginCreateOperationAndWait( - scope, - parameters + const result = await client.generateCostDetailsReport.createOperation( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + { invoiceId: "M1234567", metric: "ActualCost" }, ); console.log(result); } /** - * This sample demonstrates how to This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields + * This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields * - * @summary This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByBillingProfileAndInvoiceIdAndCustomerId.json + * @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields + * x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByBillingProfileAndInvoiceIdAndCustomerId.json */ async function generateCostDetailsReportByBillingProfileAndInvoiceIdAndCustomerId() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579"; - const parameters = { - invoiceId: "M1234567", - metric: "ActualCost", - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateCostDetailsReport.beginCreateOperationAndWait( - scope, - parameters + const result = await client.generateCostDetailsReport.createOperation( + "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579", + { invoiceId: "M1234567", metric: "ActualCost" }, ); console.log(result); } /** - * This sample demonstrates how to This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields + * This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields * - * @summary This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByCustomerAndTimePeriod.json + * @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields + * x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByCustomerAndTimePeriod.json */ async function generateCostDetailsReportByCustomerAndTimePeriod() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579"; - const parameters = { - metric: "ActualCost", - timePeriod: { end: "2020-03-15", start: "2020-03-01" }, - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateCostDetailsReport.beginCreateOperationAndWait( - scope, - parameters + const result = await client.generateCostDetailsReport.createOperation( + "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579", + { metric: "ActualCost", timePeriod: { end: "2020-03-15", start: "2020-03-01" } }, ); console.log(result); } /** - * This sample demonstrates how to This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields + * This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields * - * @summary This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByDepartmentsAndTimePeriod.json + * @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields + * x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByDepartmentsAndTimePeriod.json */ async function generateCostDetailsReportByDepartmentsAndTimePeriod() { - const scope = "providers/Microsoft.Billing/departments/12345"; - const parameters = { - metric: "ActualCost", - timePeriod: { end: "2020-03-15", start: "2020-03-01" }, - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateCostDetailsReport.beginCreateOperationAndWait( - scope, - parameters + const result = await client.generateCostDetailsReport.createOperation( + "providers/Microsoft.Billing/departments/12345", + { metric: "ActualCost", timePeriod: { end: "2020-03-15", start: "2020-03-01" } }, ); console.log(result); } /** - * This sample demonstrates how to This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields + * This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields * - * @summary This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByEnrollmentAccountsAndTimePeriod.json + * @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields + * x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByEnrollmentAccountsAndTimePeriod.json */ async function generateCostDetailsReportByEnrollmentAccountsAndTimePeriod() { - const scope = "providers/Microsoft.Billing/enrollmentAccounts/1234"; - const parameters = { - metric: "ActualCost", - timePeriod: { end: "2020-03-15", start: "2020-03-01" }, - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateCostDetailsReport.beginCreateOperationAndWait( - scope, - parameters + const result = await client.generateCostDetailsReport.createOperation( + "providers/Microsoft.Billing/enrollmentAccounts/1234", + { metric: "ActualCost", timePeriod: { end: "2020-03-15", start: "2020-03-01" } }, ); console.log(result); } /** - * This sample demonstrates how to This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields + * This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields * - * @summary This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportBySubscriptionAndTimePeriod.json + * @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields + * x-ms-original-file: 2025-03-01/GenerateCostDetailsReportBySubscriptionAndTimePeriod.json */ async function generateCostDetailsReportBySubscriptionAndTimePeriod() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const parameters = { - metric: "ActualCost", - timePeriod: { end: "2020-03-15", start: "2020-03-01" }, - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateCostDetailsReport.beginCreateOperationAndWait( - scope, - parameters + const result = await client.generateCostDetailsReport.createOperation( + "subscriptions/00000000-0000-0000-0000-000000000000", + { metric: "ActualCost", timePeriod: { end: "2020-03-15", start: "2020-03-01" } }, ); console.log(result); } async function main() { - generateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod(); - generateCostDetailsReportByBillingProfileAndInvoiceId(); - generateCostDetailsReportByBillingProfileAndInvoiceIdAndCustomerId(); - generateCostDetailsReportByCustomerAndTimePeriod(); - generateCostDetailsReportByDepartmentsAndTimePeriod(); - generateCostDetailsReportByEnrollmentAccountsAndTimePeriod(); - generateCostDetailsReportBySubscriptionAndTimePeriod(); + await generateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod(); + await generateCostDetailsReportByBillingProfileAndInvoiceId(); + await generateCostDetailsReportByBillingProfileAndInvoiceIdAndCustomerId(); + await generateCostDetailsReportByCustomerAndTimePeriod(); + await generateCostDetailsReportByDepartmentsAndTimePeriod(); + await generateCostDetailsReportByEnrollmentAccountsAndTimePeriod(); + await generateCostDetailsReportBySubscriptionAndTimePeriod(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateCostDetailsReportGetOperationResultsSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateCostDetailsReportGetOperationResultsSample.js index 4043e0e360f9..3e4d792641b8 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateCostDetailsReportGetOperationResultsSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateCostDetailsReportGetOperationResultsSample.js @@ -1,37 +1,27 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Get the result of the specified operation. This link is provided in the CostDetails creation request response Location header. + * This sample demonstrates how to get the result of the specified operation. This link is provided in the CostDetails creation request response Location header. * - * @summary Get the result of the specified operation. This link is provided in the CostDetails creation request response Location header. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/CostDetailsOperationResultsBySubscriptionScope.json + * @summary get the result of the specified operation. This link is provided in the CostDetails creation request response Location header. + * x-ms-original-file: 2025-03-01/CostDetailsOperationResultsBySubscriptionScope.json */ async function getDetailsOfTheOperationResult() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const operationId = "00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateCostDetailsReport.beginGetOperationResultsAndWait( - scope, - operationId + const result = await client.generateCostDetailsReport.getOperationResults( + "subscriptions/00000000-0000-0000-0000-000000000000", + "00000000-0000-0000-0000-000000000000", ); console.log(result); } async function main() { - getDetailsOfTheOperationResult(); + await getDetailsOfTheOperationResult(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateDetailedCostReportCreateOperationSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateDetailedCostReportCreateOperationSample.js index d8134bf81d5a..e61c606ded0b 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateDetailedCostReportCreateOperationSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateDetailedCostReportCreateOperationSample.js @@ -1,129 +1,95 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportByBillingAccountLegacyAndBillingPeriod.json + * @summary 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. + * x-ms-original-file: 2025-03-01/GenerateDetailedCostReportByBillingAccountLegacyAndBillingPeriod.json */ async function generateDetailedCostReportByBillingAccountLegacyAndBillingPeriod() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345"; - const parameters = { - billingPeriod: "202008", - metric: "ActualCost", - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateDetailedCostReport.beginCreateOperationAndWait( - scope, - parameters + const result = await client.generateDetailedCostReport.createOperation( + "providers/Microsoft.Billing/billingAccounts/12345", + { billingPeriod: "202008", metric: "ActualCost" }, ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportByBillingProfileAndInvoiceId.json + * @summary 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. + * x-ms-original-file: 2025-03-01/GenerateDetailedCostReportByBillingProfileAndInvoiceId.json */ async function generateDetailedCostReportByBillingProfileAndInvoiceId() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; - const parameters = { - invoiceId: "M1234567", - metric: "ActualCost", - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateDetailedCostReport.beginCreateOperationAndWait( - scope, - parameters + const result = await client.generateDetailedCostReport.createOperation( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + { invoiceId: "M1234567", metric: "ActualCost" }, ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportByBillingProfileAndInvoiceIdAndCustomerId.json + * @summary 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. + * x-ms-original-file: 2025-03-01/GenerateDetailedCostReportByBillingProfileAndInvoiceIdAndCustomerId.json */ async function generateDetailedCostReportByBillingProfileAndInvoiceIdAndCustomerId() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; - const parameters = { - customerId: "456789", - invoiceId: "M1234567", - metric: "ActualCost", - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateDetailedCostReport.beginCreateOperationAndWait( - scope, - parameters + const result = await client.generateDetailedCostReport.createOperation( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + { customerId: "456789", invoiceId: "M1234567", metric: "ActualCost" }, ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportByCustomerAndTimePeriod.json + * @summary 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. + * x-ms-original-file: 2025-03-01/GenerateDetailedCostReportByCustomerAndTimePeriod.json */ async function generateDetailedCostReportByCustomerAndTimePeriod() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579"; - const parameters = { - metric: "ActualCost", - timePeriod: { end: "2020-03-15", start: "2020-03-01" }, - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateDetailedCostReport.beginCreateOperationAndWait( - scope, - parameters + const result = await client.generateDetailedCostReport.createOperation( + "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579", + { metric: "ActualCost", timePeriod: { end: "2020-03-15", start: "2020-03-01" } }, ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportBySubscriptionAndTimePeriod.json + * @summary 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. + * x-ms-original-file: 2025-03-01/GenerateDetailedCostReportBySubscriptionAndTimePeriod.json */ async function generateDetailedCostReportBySubscriptionAndTimePeriod() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const parameters = { - metric: "ActualCost", - timePeriod: { end: "2020-03-15", start: "2020-03-01" }, - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateDetailedCostReport.beginCreateOperationAndWait( - scope, - parameters + const result = await client.generateDetailedCostReport.createOperation( + "subscriptions/00000000-0000-0000-0000-000000000000", + { metric: "ActualCost", timePeriod: { end: "2020-03-15", start: "2020-03-01" } }, ); console.log(result); } async function main() { - generateDetailedCostReportByBillingAccountLegacyAndBillingPeriod(); - generateDetailedCostReportByBillingProfileAndInvoiceId(); - generateDetailedCostReportByBillingProfileAndInvoiceIdAndCustomerId(); - generateDetailedCostReportByCustomerAndTimePeriod(); - generateDetailedCostReportBySubscriptionAndTimePeriod(); + await generateDetailedCostReportByBillingAccountLegacyAndBillingPeriod(); + await generateDetailedCostReportByBillingProfileAndInvoiceId(); + await generateDetailedCostReportByBillingProfileAndInvoiceIdAndCustomerId(); + await generateDetailedCostReportByCustomerAndTimePeriod(); + await generateDetailedCostReportBySubscriptionAndTimePeriod(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateDetailedCostReportOperationResultsGetSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateDetailedCostReportOperationResultsGetSample.js index 963d846fc8f1..d69244428a78 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateDetailedCostReportOperationResultsGetSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateDetailedCostReportOperationResultsGetSample.js @@ -1,37 +1,27 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Gets the result of the specified operation. The link with this operationId is provided as a response header of the initial request. + * This sample demonstrates how to gets the result of the specified operation. The link with this operationId is provided as a response header of the initial request. * - * @summary Gets the result of the specified operation. The link with this operationId is provided as a response header of the initial request. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportOperationResultsBySubscriptionScope.json + * @summary gets the result of the specified operation. The link with this operationId is provided as a response header of the initial request. + * x-ms-original-file: 2025-03-01/GenerateDetailedCostReportOperationResultsBySubscriptionScope.json */ async function getDetailsOfTheOperationResult() { - const operationId = "00000000-0000-0000-0000-000000000000"; - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateDetailedCostReportOperationResults.beginGetAndWait( - operationId, - scope + const result = await client.generateDetailedCostReportOperationResults.get( + "00000000-0000-0000-0000-000000000000", + "subscriptions/00000000-0000-0000-0000-000000000000", ); console.log(result); } async function main() { - getDetailsOfTheOperationResult(); + await getDetailsOfTheOperationResult(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateDetailedCostReportOperationStatusGetSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateDetailedCostReportOperationStatusGetSample.js index 0626dba0b75a..1ce4aa7bdc93 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateDetailedCostReportOperationStatusGetSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateDetailedCostReportOperationStatusGetSample.js @@ -1,34 +1,27 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Get the status of the specified operation. This link is provided in the GenerateDetailedCostReport creation request response header. + * This sample demonstrates how to get the status of the specified operation. This link is provided in the GenerateDetailedCostReport creation request response header. * - * @summary Get the status of the specified operation. This link is provided in the GenerateDetailedCostReport creation request response header. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportOperationStatusBySubscriptionScope.json + * @summary get the status of the specified operation. This link is provided in the GenerateDetailedCostReport creation request response header. + * x-ms-original-file: 2025-03-01/GenerateDetailedCostReportOperationStatusBySubscriptionScope.json */ async function getDetailsOfTheOperationStatus() { - const operationId = "00000000-0000-0000-0000-000000000000"; - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateDetailedCostReportOperationStatus.get(operationId, scope); + const result = await client.generateDetailedCostReportOperationStatus.get( + "00000000-0000-0000-0000-000000000000", + "subscriptions/00000000-0000-0000-0000-000000000000", + ); console.log(result); } async function main() { - getDetailsOfTheOperationStatus(); + await getDetailsOfTheOperationStatus(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateReservationDetailsReportByBillingAccountIdSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateReservationDetailsReportByBillingAccountIdSample.js index 6f80b34042b4..04f67503ca64 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateReservationDetailsReportByBillingAccountIdSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateReservationDetailsReportByBillingAccountIdSample.js @@ -1,39 +1,28 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to 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://learn.microsoft.com/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role + * This sample demonstrates how to 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 * - * @summary 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://learn.microsoft.com/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateReservationDetailsReportByBillingAccount.json + * @summary 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 + * x-ms-original-file: 2025-03-01/GenerateReservationDetailsReportByBillingAccount.json */ async function reservationDetails() { - const billingAccountId = "9845612"; - const startDate = "2020-01-01"; - const endDate = "2020-01-30"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateReservationDetailsReport.beginByBillingAccountIdAndWait( - billingAccountId, - startDate, - endDate + const result = await client.generateReservationDetailsReport.byBillingAccountId( + "9845612", + "2020-01-01", + "2020-01-30", ); console.log(result); } async function main() { - reservationDetails(); + await reservationDetails(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateReservationDetailsReportByBillingProfileIdSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateReservationDetailsReportByBillingProfileIdSample.js index 480f42575253..dba0ee9303fb 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateReservationDetailsReportByBillingProfileIdSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/generateReservationDetailsReportByBillingProfileIdSample.js @@ -1,41 +1,29 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to 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://learn.microsoft.com/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access + * This sample demonstrates how to 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 * - * @summary 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://learn.microsoft.com/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateReservationDetailsReportByBillingProfile.json + * @summary 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 + * x-ms-original-file: 2025-03-01/GenerateReservationDetailsReportByBillingProfile.json */ async function reservationDetails() { - const billingAccountId = "00000000-0000-0000-0000-000000000000"; - const billingProfileId = "CZSFR-SDFXC-DSDF"; - const startDate = "2020-01-01"; - const endDate = "2020-01-30"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateReservationDetailsReport.beginByBillingProfileIdAndWait( - billingAccountId, - billingProfileId, - startDate, - endDate + const result = await client.generateReservationDetailsReport.byBillingProfileId( + "00000000-0000-0000-0000-000000000000", + "CZSFR-SDFXC-DSDF", + "2020-01-01", + "2020-01-30", ); console.log(result); } async function main() { - reservationDetails(); + await reservationDetails(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/operationsListSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/operationsListSample.js index 63f01057c39d..dfb2d2074ea3 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/operationsListSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/operationsListSample.js @@ -1,35 +1,28 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Lists all of the available cost management REST API operations. + * This sample demonstrates how to list the operations for the provider * - * @summary Lists all of the available cost management REST API operations. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/OperationList.json + * @summary list the operations for the provider + * x-ms-original-file: 2025-03-01/OperationList.json */ async function operationList() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.operations.list()) { + for await (const item of client.operations.list()) { resArray.push(item); } + console.log(resArray); } async function main() { - operationList(); + await operationList(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/package.json b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/package.json index 55f2eaf8a837..a2af3d540fe6 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/package.json +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/package.json @@ -2,7 +2,7 @@ "name": "@azure-samples/arm-costmanagement-js-beta", "private": true, "version": "1.0.0", - "description": " client library samples for JavaScript (Beta)", + "description": "@azure/arm-costmanagement client library samples for JavaScript (Beta)", "engines": { "node": ">=20.0.0" }, @@ -14,6 +14,7 @@ "keywords": [ "node", "azure", + "cloud", "typescript", "browser", "isomorphic" @@ -25,8 +26,11 @@ }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cost-management/arm-costmanagement", "dependencies": { - "@azure/arm-costmanagement": "next", + "@azure/arm-costmanagement": "beta", "dotenv": "latest", - "@azure/identity": "^4.2.1" + "@azure/identity": "^4.13.0" + }, + "devDependencies": { + "cross-env": "latest" } } diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/priceSheetDownloadByBillingAccountSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/priceSheetDownloadByBillingAccountSample.js new file mode 100644 index 000000000000..ce72f9627337 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/priceSheetDownloadByBillingAccountSample.js @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CostManagementClient } = require("@azure/arm-costmanagement"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to generates the pricesheet for the provided billing period asynchronously based on the Enrollment ID. This is for Enterprise Agreement customers. + * + * **Migrate to version 2025-03-01** + * + * You can use the 2025-03-01 API version with the new URI: + * + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.CostManagement/pricesheets/default/download' + * + * With a new schema detailed below, the new version of the price sheet provides additional information and includes prices for Azure Reserved Instances (RI) for the current billing period. We recommend downloading an Azure Price Sheet for when entering a new billing period if you would maintain an ongoing record of past Azure Reserved Instance (RI) pricing. + * + * The EA Azure price sheet is available for billing periods in the past 13 months. To request a price sheet for a billing period older than 13 months, please contact support. + * + * The Azure price sheet download experience has been updated from a single .csv file to a zip file containing multiple .csv files, each with max size of 75MB. The 2023-11-01 version has been upgraded to use http POST method; details can be found below. + * + * All versions of the Microsoft.Consumption Azure Price Sheet - Download by Billing Account (including 2022-06-01, 2021-10-01, 2020-01-01-preview, 2019-10-01, 2019-05-01) are scheduled to be retired on 01 June 2026 and will no longer be supported after this date. + * + * @summary generates the pricesheet for the provided billing period asynchronously based on the Enrollment ID. This is for Enterprise Agreement customers. + * + * **Migrate to version 2025-03-01** + * + * You can use the 2025-03-01 API version with the new URI: + * + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.CostManagement/pricesheets/default/download' + * + * With a new schema detailed below, the new version of the price sheet provides additional information and includes prices for Azure Reserved Instances (RI) for the current billing period. We recommend downloading an Azure Price Sheet for when entering a new billing period if you would maintain an ongoing record of past Azure Reserved Instance (RI) pricing. + * + * The EA Azure price sheet is available for billing periods in the past 13 months. To request a price sheet for a billing period older than 13 months, please contact support. + * + * The Azure price sheet download experience has been updated from a single .csv file to a zip file containing multiple .csv files, each with max size of 75MB. The 2023-11-01 version has been upgraded to use http POST method; details can be found below. + * + * All versions of the Microsoft.Consumption Azure Price Sheet - Download by Billing Account (including 2022-06-01, 2021-10-01, 2020-01-01-preview, 2019-10-01, 2019-05-01) are scheduled to be retired on 01 June 2026 and will no longer be supported after this date. + * x-ms-original-file: 2025-03-01/EAPriceSheetForBillingPeriod.json + */ +async function eaPriceSheetForBillingPeriod() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.priceSheet.downloadByBillingAccount("0000000", "202311"); + console.log(result); +} + +async function main() { + await eaPriceSheetForBillingPeriod(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/priceSheetDownloadByBillingProfileSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/priceSheetDownloadByBillingProfileSample.js index 75ce808067c3..3bb02a7a6885 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/priceSheetDownloadByBillingProfileSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/priceSheetDownloadByBillingProfileSample.js @@ -1,38 +1,35 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. + * + * You can use the new 2023-09-01 API version for billing periods January 2023 onwards. Azure Reserved Instance (RI) pricing is only available through the new version of the API. + * + * Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv/json file to a Zip file containing multiple csv/json files, each with max size of 75MB. + * + * @summary 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. + * + * You can use the new 2023-09-01 API version for billing periods January 2023 onwards. Azure Reserved Instance (RI) pricing is only available through the new version of the API. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PricesheetDownloadByBillingProfile.json + * Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv/json file to a Zip file containing multiple csv/json files, each with max size of 75MB. + * x-ms-original-file: 2025-03-01/PricesheetDownloadByBillingProfile.json */ async function pricesheetDownloadByBillingProfile() { - const billingAccountName = - "7c05a543-80ff-571e-9f98-1063b3b53cf2:99ad03ad-2d1b-4889-a452-090ad407d25f_2019-05-31"; - const billingProfileName = "2USN-TPCD-BG7-TGB"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.priceSheet.beginDownloadByBillingProfileAndWait( - billingAccountName, - billingProfileName + const result = await client.priceSheet.downloadByBillingProfile( + "7c05a543-80ff-571e-9f98-1063b3b53cf2:99ad03ad-2d1b-4889-a452-090ad407d25f_2019-05-31", + "2USN-TPCD-BG7-TGB", ); console.log(result); } async function main() { - pricesheetDownloadByBillingProfile(); + await pricesheetDownloadByBillingProfile(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/priceSheetDownloadByInvoiceSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/priceSheetDownloadByInvoiceSample.js new file mode 100644 index 000000000000..2770ab92d3b0 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/priceSheetDownloadByInvoiceSample.js @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CostManagementClient } = require("@azure/arm-costmanagement"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/PricesheetDownload.json + */ +async function pricesheetDownload() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.priceSheet.downloadByInvoice( + "7c05a543-80ff-571e-9f98-1063b3b53cf2:99ad03ad-2d1b-4889-a452-090ad407d25f_2019-05-31", + "2USN-TPCD-BG7-TGB", + "T000940677", + ); + console.log(result); +} + +async function main() { + await pricesheetDownload(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/priceSheetDownloadSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/priceSheetDownloadSample.js deleted file mode 100644 index e1abfb9097a3..000000000000 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/priceSheetDownloadSample.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { CostManagementClient } = require("@azure/arm-costmanagement"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to 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. - * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PricesheetDownload.json - */ -async function pricesheetDownload() { - const billingAccountName = - "7c05a543-80ff-571e-9f98-1063b3b53cf2:99ad03ad-2d1b-4889-a452-090ad407d25f_2019-05-31"; - const billingProfileName = "2USN-TPCD-BG7-TGB"; - const invoiceName = "T000940677"; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.priceSheet.beginDownloadAndWait( - billingAccountName, - billingProfileName, - invoiceName - ); - console.log(result); -} - -async function main() { - pricesheetDownload(); -} - -main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/queryUsageByExternalCloudProviderTypeSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/queryUsageByExternalCloudProviderTypeSample.js index b706b861110f..5263820a1c64 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/queryUsageByExternalCloudProviderTypeSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/queryUsageByExternalCloudProviderTypeSample.js @@ -1,130 +1,92 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Query the usage data for external cloud provider type defined. + * This sample demonstrates how to query the usage data for external cloud provider type defined. * - * @summary Query the usage data for external cloud provider type defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalBillingAccountsQuery.json + * @summary query the usage data for external cloud provider type defined. + * x-ms-original-file: 2025-03-01/ExternalBillingAccountsQuery.json */ async function externalBillingAccountQueryList() { - const externalCloudProviderType = "externalBillingAccounts"; - const externalCloudProviderId = "100"; - const parameters = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usageByExternalCloudProviderType( + "externalBillingAccounts", + "100", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usageByExternalCloudProviderType( - externalCloudProviderType, - externalCloudProviderId, - parameters ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for external cloud provider type defined. + * This sample demonstrates how to query the usage data for external cloud provider type defined. * - * @summary Query the usage data for external cloud provider type defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalSubscriptionsQuery.json + * @summary query the usage data for external cloud provider type defined. + * x-ms-original-file: 2025-03-01/ExternalSubscriptionsQuery.json */ async function externalSubscriptionsQuery() { - const externalCloudProviderType = "externalSubscriptions"; - const externalCloudProviderId = "100"; - const parameters = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usageByExternalCloudProviderType( + "externalSubscriptions", + "100", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usageByExternalCloudProviderType( - externalCloudProviderType, - externalCloudProviderId, - parameters ); console.log(result); } async function main() { - externalBillingAccountQueryList(); - externalSubscriptionsQuery(); + await externalBillingAccountQueryList(); + await externalSubscriptionsQuery(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/queryUsageSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/queryUsageSample.js index 6c6675a5c18a..b57dbd874317 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/queryUsageSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/queryUsageSample.js @@ -1,76 +1,19 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/BillingAccountQuery.json */ async function billingAccountQueryLegacy() { - const scope = "providers/Microsoft.Billing/billingAccounts/70664866"; - const parameters = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], - }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], - }, - }, - ], - }, - granularity: "Daily", - }, - timeframe: "MonthToDate", - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); - console.log(result); -} - -/** - * This sample demonstrates how to Query the usage data for scope defined. - * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingAccountQuery.json - */ -async function billingAccountQueryMca() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789"; - const parameters = { + const result = await client.query.usage("providers/Microsoft.Billing/billingAccounts/70664866", { type: "Usage", dataset: { filter: { @@ -84,43 +27,29 @@ async function billingAccountQueryMca() { values: ["East US", "West Europe"], }, }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], - }, - }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, ], }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], - }, - }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, ], }, granularity: "Daily", }, timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + }); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/BillingAccountQueryGrouping.json */ async function billingAccountQueryGroupingLegacy() { - const scope = "providers/Microsoft.Billing/billingAccounts/70664866"; - const parameters = { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage("providers/Microsoft.Billing/billingAccounts/70664866", { type: "Usage", dataset: { aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, @@ -128,560 +57,524 @@ async function billingAccountQueryGroupingLegacy() { grouping: [{ name: "ResourceGroup", type: "Dimension" }], }, timeframe: "TheLastMonth", - }; + }); + console.log(result); +} + +/** + * This sample demonstrates how to query the usage data for scope defined. + * + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/DepartmentQuery.json + */ +async function departmentQueryLegacy() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/100/departments/123", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, + }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], + }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", + }, + timeframe: "MonthToDate", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingAccountQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/DepartmentQueryGrouping.json */ -async function billingAccountQueryGroupingMca() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789"; - const parameters = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "None", - grouping: [{ name: "ResourceGroup", type: "Dimension" }], - }, - timeframe: "TheLastMonth", - }; +async function departmentQueryGroupingLegacy() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/100/departments/123", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "None", + grouping: [{ name: "ResourceGroup", type: "Dimension" }], + }, + timeframe: "TheLastMonth", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingProfileQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/EnrollmentAccountQuery.json */ -async function billingProfileQueryMca() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; - const parameters = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], +async function enrollmentAccountQueryLegacy() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingProfileQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/EnrollmentAccountQueryGrouping.json */ -async function billingProfileQueryGroupingMca() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; - const parameters = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "None", - grouping: [{ name: "ResourceGroup", type: "Dimension" }], - }, - timeframe: "TheLastMonth", - }; +async function enrollmentAccountQueryGroupingLegacy() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "Daily", + grouping: [{ name: "ResourceGroup", type: "Dimension" }], + }, + timeframe: "TheLastMonth", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCACustomerQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/MCABillingAccountQuery.json */ -async function customerQueryMca() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"; - const parameters = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], +async function billingAccountQueryMCA() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCACustomerQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/MCABillingAccountQueryGrouping.json */ -async function customerQueryGroupingMca() { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"; - const parameters = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "None", - grouping: [{ name: "ResourceGroup", type: "Dimension" }], - }, - timeframe: "TheLastMonth", - }; +async function billingAccountQueryGroupingMCA() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "None", + grouping: [{ name: "ResourceGroup", type: "Dimension" }], + }, + timeframe: "TheLastMonth", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/MCABillingProfileQuery.json */ -async function departmentQueryLegacy() { - const scope = "providers/Microsoft.Billing/billingAccounts/100/departments/123"; - const parameters = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], +async function billingProfileQueryMCA() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/MCABillingProfileQueryGrouping.json */ -async function departmentQueryGroupingLegacy() { - const scope = "providers/Microsoft.Billing/billingAccounts/100/departments/123"; - const parameters = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "None", - grouping: [{ name: "ResourceGroup", type: "Dimension" }], - }, - timeframe: "TheLastMonth", - }; +async function billingProfileQueryGroupingMCA() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "None", + grouping: [{ name: "ResourceGroup", type: "Dimension" }], + }, + timeframe: "TheLastMonth", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/MCACustomerQuery.json */ -async function enrollmentAccountQueryLegacy() { - const scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const parameters = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], +async function customerQueryMCA() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/MCACustomerQueryGrouping.json */ -async function enrollmentAccountQueryGroupingLegacy() { - const scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const parameters = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "Daily", - grouping: [{ name: "ResourceGroup", type: "Dimension" }], - }, - timeframe: "TheLastMonth", - }; +async function customerQueryGroupingMCA() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "None", + grouping: [{ name: "ResourceGroup", type: "Dimension" }], + }, + timeframe: "TheLastMonth", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCAInvoiceSectionQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/MCAInvoiceSectionQuery.json */ -async function invoiceSectionQueryMca() { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876"; - const parameters = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], +async function invoiceSectionQueryMCA() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCAInvoiceSectionQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/MCAInvoiceSectionQueryGrouping.json */ -async function invoiceSectionQueryGroupingMca() { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876"; - const parameters = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "None", - grouping: [{ name: "ResourceGroup", type: "Dimension" }], - }, - timeframe: "TheLastMonth", - }; +async function invoiceSectionQueryGroupingMCA() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "None", + grouping: [{ name: "ResourceGroup", type: "Dimension" }], + }, + timeframe: "TheLastMonth", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ManagementGroupQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/ManagementGroupQuery.json */ async function managementGroupQueryLegacy() { - const scope = "providers/Microsoft.Management/managementGroups/MyMgId"; - const parameters = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage( + "providers/Microsoft.Management/managementGroups/MyMgId", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ManagementGroupQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/ManagementGroupQueryGrouping.json */ async function managementGroupQueryGroupingLegacy() { - const scope = "providers/Microsoft.Management/managementGroups/MyMgId"; - const parameters = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "None", - grouping: [{ name: "ResourceGroup", type: "Dimension" }], - }, - timeframe: "TheLastMonth", - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Management/managementGroups/MyMgId", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "None", + grouping: [{ name: "ResourceGroup", type: "Dimension" }], + }, + timeframe: "TheLastMonth", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ResourceGroupQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/ResourceGroupQuery.json */ async function resourceGroupQueryLegacy() { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"; - const parameters = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"], - }, - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, }, - }, - ], - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - }, - ], + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", }, - granularity: "Daily", + timeframe: "MonthToDate", }, - timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ResourceGroupQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/ResourceGroupQueryGrouping.json */ async function resourceGroupQueryGroupingLegacy() { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"; - const parameters = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "Daily", - grouping: [{ name: "ResourceType", type: "Dimension" }], - }, - timeframe: "TheLastMonth", - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "Daily", + grouping: [{ name: "ResourceType", type: "Dimension" }], + }, + timeframe: "TheLastMonth", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SubscriptionQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/SubscriptionQuery.json */ async function subscriptionQueryLegacy() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const parameters = { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage("subscriptions/00000000-0000-0000-0000-000000000000", { type: "Usage", dataset: { filter: { @@ -695,43 +588,29 @@ async function subscriptionQueryLegacy() { values: ["East US", "West Europe"], }, }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"], - }, - }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, ], }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"], - }, - }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, ], }, granularity: "Daily", }, timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + }); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SubscriptionQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/SubscriptionQueryGrouping.json */ async function subscriptionQueryGroupingLegacy() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const parameters = { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage("subscriptions/00000000-0000-0000-0000-000000000000", { type: "Usage", dataset: { aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, @@ -739,34 +618,31 @@ async function subscriptionQueryGroupingLegacy() { grouping: [{ name: "ResourceGroup", type: "Dimension" }], }, timeframe: "TheLastMonth", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + }); console.log(result); } async function main() { - billingAccountQueryLegacy(); - billingAccountQueryMca(); - billingAccountQueryGroupingLegacy(); - billingAccountQueryGroupingMca(); - billingProfileQueryMca(); - billingProfileQueryGroupingMca(); - customerQueryMca(); - customerQueryGroupingMca(); - departmentQueryLegacy(); - departmentQueryGroupingLegacy(); - enrollmentAccountQueryLegacy(); - enrollmentAccountQueryGroupingLegacy(); - invoiceSectionQueryMca(); - invoiceSectionQueryGroupingMca(); - managementGroupQueryLegacy(); - managementGroupQueryGroupingLegacy(); - resourceGroupQueryLegacy(); - resourceGroupQueryGroupingLegacy(); - subscriptionQueryLegacy(); - subscriptionQueryGroupingLegacy(); + await billingAccountQueryLegacy(); + await billingAccountQueryGroupingLegacy(); + await departmentQueryLegacy(); + await departmentQueryGroupingLegacy(); + await enrollmentAccountQueryLegacy(); + await enrollmentAccountQueryGroupingLegacy(); + await billingAccountQueryMCA(); + await billingAccountQueryGroupingMCA(); + await billingProfileQueryMCA(); + await billingProfileQueryGroupingMCA(); + await customerQueryMCA(); + await customerQueryGroupingMCA(); + await invoiceSectionQueryMCA(); + await invoiceSectionQueryGroupingMCA(); + await managementGroupQueryLegacy(); + await managementGroupQueryGroupingLegacy(); + await resourceGroupQueryLegacy(); + await resourceGroupQueryGroupingLegacy(); + await subscriptionQueryLegacy(); + await subscriptionQueryGroupingLegacy(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/sample.env b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/sample.env index 672847a3fea0..508439fc7d62 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/sample.env +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/sample.env @@ -1,4 +1 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsCheckNameAvailabilityByScopeSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsCheckNameAvailabilityByScopeSample.js index 7b09dae8aefd..af8cbb50c9e9 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsCheckNameAvailabilityByScopeSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsCheckNameAvailabilityByScopeSample.js @@ -1,40 +1,27 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Checks availability and correctness of the name for a scheduled action within the given scope. + * This sample demonstrates how to checks availability and correctness of the name for a scheduled action within the given scope. * - * @summary Checks availability and correctness of the name for a scheduled action within the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/checkNameAvailability-shared-scheduledAction.json + * @summary checks availability and correctness of the name for a scheduled action within the given scope. + * x-ms-original-file: 2025-03-01/scheduledActions/checkNameAvailability-shared-scheduledAction.json */ async function scheduledActionCheckNameAvailabilityByScope() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const checkNameAvailabilityRequest = { - name: "testName", - type: "Microsoft.CostManagement/ScheduledActions", - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const result = await client.scheduledActions.checkNameAvailabilityByScope( - scope, - checkNameAvailabilityRequest + "subscriptions/00000000-0000-0000-0000-000000000000", + { name: "testName", type: "Microsoft.CostManagement/ScheduledActions" }, ); console.log(result); } async function main() { - scheduledActionCheckNameAvailabilityByScope(); + await scheduledActionCheckNameAvailabilityByScope(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsCheckNameAvailabilitySample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsCheckNameAvailabilitySample.js index de6b980197df..dcdc0905b11c 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsCheckNameAvailabilitySample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsCheckNameAvailabilitySample.js @@ -1,36 +1,27 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Checks availability and correctness of the name for a scheduled action. + * This sample demonstrates how to checks availability and correctness of the name for a scheduled action. * - * @summary Checks availability and correctness of the name for a scheduled action. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/checkNameAvailability-private-scheduledAction.json + * @summary checks availability and correctness of the name for a scheduled action. + * x-ms-original-file: 2025-03-01/scheduledActions/checkNameAvailability-private-scheduledAction.json */ async function scheduledActionCheckNameAvailability() { - const checkNameAvailabilityRequest = { - name: "testName", - type: "Microsoft.CostManagement/ScheduledActions", - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.scheduledActions.checkNameAvailability(checkNameAvailabilityRequest); + const result = await client.scheduledActions.checkNameAvailability({ + name: "testName", + type: "Microsoft.CostManagement/ScheduledActions", + }); console.log(result); } async function main() { - scheduledActionCheckNameAvailability(); + await scheduledActionCheckNameAvailability(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsCreateOrUpdateByScopeSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsCreateOrUpdateByScopeSample.js index cab494d53d54..5a41cea1bb6b 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsCreateOrUpdateByScopeSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsCreateOrUpdateByScopeSample.js @@ -1,102 +1,80 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Create or update a shared scheduled action within the given scope. + * This sample demonstrates how to create or update a shared scheduled action within the given scope. * - * @summary Create or update a shared scheduled action within the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-insightAlert-createOrUpdate-shared.json + * @summary create or update a shared scheduled action within the given scope. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-createOrUpdate-shared.json */ -async function createOrUpdateInsightAlertScheduledActionByScope() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const name = "dailyAnomalyByResource"; - const ifMatch = ""; - const scheduledAction = { - displayName: "Daily anomaly by resource", - kind: "InsightAlert", - notification: { - subject: "Cost anomaly detected in the resource", - to: ["user@gmail.com", "team@gmail.com"], - }, - schedule: { - endDate: new Date("2021-06-19T22:21:51.1287144Z"), - frequency: "Daily", - startDate: new Date("2020-06-19T22:21:51.1287144Z"), - }, - status: "Enabled", - viewId: "/providers/Microsoft.CostManagement/views/swaggerExample", - }; - const options = { - ifMatch, - }; +async function createOrUpdateScheduledActionByScope() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const result = await client.scheduledActions.createOrUpdateByScope( - scope, - name, - scheduledAction, - options + "subscriptions/00000000-0000-0000-0000-000000000000", + "monthlyCostByResource", + { + kind: "Email", + displayName: "Monthly Cost By Resource", + fileDestination: { fileFormats: ["Csv"] }, + notification: { + subject: "Cost by resource this month", + to: ["user@gmail.com", "team@gmail.com"], + }, + schedule: { + daysOfWeek: ["Monday"], + endDate: new Date("2021-06-19T22:21:51.1287144Z"), + frequency: "Monthly", + hourOfDay: 10, + startDate: new Date("2020-06-19T22:21:51.1287144Z"), + weeksOfMonth: ["First", "Third"], + }, + status: "Enabled", + viewId: "/providers/Microsoft.CostManagement/views/swaggerExample", + }, + { ifMatch: "" }, ); console.log(result); } /** - * This sample demonstrates how to Create or update a shared scheduled action within the given scope. + * This sample demonstrates how to create or update a shared scheduled action within the given scope. * - * @summary Create or update a shared scheduled action within the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-createOrUpdate-shared.json + * @summary create or update a shared scheduled action within the given scope. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-insightAlert-createOrUpdate-shared.json */ -async function createOrUpdateScheduledActionByScope() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const name = "monthlyCostByResource"; - const ifMatch = ""; - const scheduledAction = { - displayName: "Monthly Cost By Resource", - fileDestination: { fileFormats: ["Csv"] }, - kind: "Email", - notification: { - subject: "Cost by resource this month", - to: ["user@gmail.com", "team@gmail.com"], - }, - schedule: { - daysOfWeek: ["Monday"], - endDate: new Date("2021-06-19T22:21:51.1287144Z"), - frequency: "Monthly", - hourOfDay: 10, - startDate: new Date("2020-06-19T22:21:51.1287144Z"), - weeksOfMonth: ["First", "Third"], - }, - status: "Enabled", - viewId: "/providers/Microsoft.CostManagement/views/swaggerExample", - }; - const options = { - ifMatch, - }; +async function createOrUpdateInsightAlertScheduledActionByScope() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const result = await client.scheduledActions.createOrUpdateByScope( - scope, - name, - scheduledAction, - options + "subscriptions/00000000-0000-0000-0000-000000000000", + "dailyAnomalyByResource", + { + kind: "InsightAlert", + displayName: "Daily anomaly by resource", + notification: { + subject: "Cost anomaly detected in the resource", + to: ["user@gmail.com", "team@gmail.com"], + }, + schedule: { + endDate: new Date("2021-06-19T22:21:51.1287144Z"), + frequency: "Daily", + startDate: new Date("2020-06-19T22:21:51.1287144Z"), + }, + status: "Enabled", + viewId: "/providers/Microsoft.CostManagement/views/swaggerExample", + }, + { ifMatch: "" }, ); console.log(result); } async function main() { - createOrUpdateInsightAlertScheduledActionByScope(); - createOrUpdateScheduledActionByScope(); + await createOrUpdateScheduledActionByScope(); + await createOrUpdateInsightAlertScheduledActionByScope(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsCreateOrUpdateSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsCreateOrUpdateSample.js index 8668e502e43f..d240cbb8b92d 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsCreateOrUpdateSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsCreateOrUpdateSample.js @@ -1,53 +1,45 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Create or update a private scheduled action. + * This sample demonstrates how to create or update a private scheduled action. * - * @summary Create or update a private scheduled action. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-createOrUpdate-private.json + * @summary create or update a private scheduled action. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-createOrUpdate-private.json */ async function createOrUpdatePrivateScheduledAction() { - const name = "monthlyCostByResource"; - const ifMatch = ""; - const scheduledAction = { - displayName: "Monthly Cost By Resource", - kind: "Email", - notification: { - subject: "Cost by resource this month", - to: ["user@gmail.com", "team@gmail.com"], - }, - schedule: { - daysOfWeek: ["Monday"], - endDate: new Date("2021-06-19T22:21:51.1287144Z"), - frequency: "Monthly", - hourOfDay: 10, - startDate: new Date("2020-06-19T22:21:51.1287144Z"), - weeksOfMonth: ["First", "Third"], - }, - status: "Enabled", - viewId: "/providers/Microsoft.CostManagement/views/swaggerExample", - }; - const options = { ifMatch }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.scheduledActions.createOrUpdate(name, scheduledAction, options); + const result = await client.scheduledActions.createOrUpdate( + "monthlyCostByResource", + { + kind: "Email", + displayName: "Monthly Cost By Resource", + notification: { + subject: "Cost by resource this month", + to: ["user@gmail.com", "team@gmail.com"], + }, + schedule: { + daysOfWeek: ["Monday"], + endDate: new Date("2021-06-19T22:21:51.1287144Z"), + frequency: "Monthly", + hourOfDay: 10, + startDate: new Date("2020-06-19T22:21:51.1287144Z"), + weeksOfMonth: ["First", "Third"], + }, + status: "Enabled", + viewId: "/providers/Microsoft.CostManagement/views/swaggerExample", + }, + { ifMatch: "" }, + ); console.log(result); } async function main() { - createOrUpdatePrivateScheduledAction(); + await createOrUpdatePrivateScheduledAction(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsDeleteByScopeSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsDeleteByScopeSample.js index 68d2942ec057..3eb4779840ef 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsDeleteByScopeSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsDeleteByScopeSample.js @@ -1,34 +1,26 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Delete a scheduled action within the given scope. + * This sample demonstrates how to delete a scheduled action within the given scope. * - * @summary Delete a scheduled action within the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-delete-shared.json + * @summary delete a scheduled action within the given scope. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-delete-shared.json */ async function scheduledActionDeleteByScope() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const name = "monthlyCostByResource"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.scheduledActions.deleteByScope(scope, name); - console.log(result); + await client.scheduledActions.deleteByScope( + "subscriptions/00000000-0000-0000-0000-000000000000", + "monthlyCostByResource", + ); } async function main() { - scheduledActionDeleteByScope(); + await scheduledActionDeleteByScope(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsDeleteSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsDeleteSample.js index f29e6c81ddae..3c70d530c380 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsDeleteSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsDeleteSample.js @@ -1,33 +1,23 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Delete a private scheduled action. + * This sample demonstrates how to delete a private scheduled action. * - * @summary Delete a private scheduled action. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-delete-private.json + * @summary delete a private scheduled action. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-delete-private.json */ async function privateScheduledActionDelete() { - const name = "monthlyCostByResource"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.scheduledActions.delete(name); - console.log(result); + await client.scheduledActions.delete("monthlyCostByResource"); } async function main() { - privateScheduledActionDelete(); + await privateScheduledActionDelete(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsGetByScopeSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsGetByScopeSample.js index 6d475a2317c1..f8a0a75662b7 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsGetByScopeSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsGetByScopeSample.js @@ -1,34 +1,27 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Get the shared scheduled action from the given scope by name. + * This sample demonstrates how to get the shared scheduled action from the given scope by name. * - * @summary Get the shared scheduled action from the given scope by name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-get-shared.json + * @summary get the shared scheduled action from the given scope by name. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-get-shared.json */ async function scheduledActionByScope() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const name = "monthlyCostByResource"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.scheduledActions.getByScope(scope, name); + const result = await client.scheduledActions.getByScope( + "subscriptions/00000000-0000-0000-0000-000000000000", + "monthlyCostByResource", + ); console.log(result); } async function main() { - scheduledActionByScope(); + await scheduledActionByScope(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsGetSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsGetSample.js index 43ae6b6bb1c8..38dda23dd5d4 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsGetSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsGetSample.js @@ -1,33 +1,24 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Get the private scheduled action by name. + * This sample demonstrates how to get the private scheduled action by name. * - * @summary Get the private scheduled action by name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-get-private.json + * @summary get the private scheduled action by name. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-get-private.json */ async function privateScheduledAction() { - const name = "monthlyCostByResource"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.scheduledActions.get(name); + const result = await client.scheduledActions.get("monthlyCostByResource"); console.log(result); } async function main() { - privateScheduledAction(); + await privateScheduledAction(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsListByScopeSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsListByScopeSample.js index 0ef84b748641..a6ed529b84f5 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsListByScopeSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsListByScopeSample.js @@ -1,56 +1,51 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to List all shared scheduled actions within the given scope. + * This sample demonstrates how to list all shared scheduled actions within the given scope. * - * @summary List all shared scheduled actions within the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledActions-list-shared.json + * @summary list all shared scheduled actions within the given scope. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledActions-list-shared.json */ async function scheduledActionsListByScope() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.scheduledActions.listByScope(scope)) { + for await (const item of client.scheduledActions.listByScope( + "subscriptions/00000000-0000-0000-0000-000000000000", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to List all shared scheduled actions within the given scope. + * This sample demonstrates how to list all shared scheduled actions within the given scope. * - * @summary List all shared scheduled actions within the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledActions-listWithFilter-shared.json + * @summary list all shared scheduled actions within the given scope. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledActions-listWithFilter-shared.json */ async function scheduledActionsListByScopeFilterByViewId() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const filter = "properties/viewId eq '/providers/Microsoft.CostManagement/views/swaggerExample'"; - const options = { filter }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.scheduledActions.listByScope(scope, options)) { + for await (const item of client.scheduledActions.listByScope( + "subscriptions/00000000-0000-0000-0000-000000000000", + { filter: "properties/viewId eq '/providers/Microsoft.CostManagement/views/swaggerExample'" }, + )) { resArray.push(item); } + console.log(resArray); } async function main() { - scheduledActionsListByScope(); - scheduledActionsListByScopeFilterByViewId(); + await scheduledActionsListByScope(); + await scheduledActionsListByScopeFilterByViewId(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsListSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsListSample.js index c03a902f87bd..1086d6fc105a 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsListSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsListSample.js @@ -1,54 +1,48 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to List all private scheduled actions. + * This sample demonstrates how to list all private scheduled actions. * - * @summary List all private scheduled actions. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledActions-list-private.json + * @summary list all private scheduled actions. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledActions-list-private.json */ async function privateScheduledActionsList() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.scheduledActions.list()) { + for await (const item of client.scheduledActions.list()) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to List all private scheduled actions. + * This sample demonstrates how to list all private scheduled actions. * - * @summary List all private scheduled actions. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledActions-listWithFilter-private.json + * @summary list all private scheduled actions. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledActions-listWithFilter-private.json */ async function privateScheduledActionsListFilterByViewId() { - const filter = "properties/viewId eq '/providers/Microsoft.CostManagement/views/swaggerExample'"; - const options = { filter }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.scheduledActions.list(options)) { + for await (const item of client.scheduledActions.list({ + filter: "properties/viewId eq '/providers/Microsoft.CostManagement/views/swaggerExample'", + })) { resArray.push(item); } + console.log(resArray); } async function main() { - privateScheduledActionsList(); - privateScheduledActionsListFilterByViewId(); + await privateScheduledActionsList(); + await privateScheduledActionsListFilterByViewId(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsRunByScopeSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsRunByScopeSample.js index a30e9bad0e44..9db471929cec 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsRunByScopeSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsRunByScopeSample.js @@ -1,34 +1,26 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Runs a shared scheduled action within the given scope. + * This sample demonstrates how to runs a shared scheduled action within the given scope. * - * @summary Runs a shared scheduled action within the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-sendNow-shared.json + * @summary runs a shared scheduled action within the given scope. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-sendNow-shared.json */ async function scheduledActionRunByScope() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const name = "monthlyCostByResource"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.scheduledActions.runByScope(scope, name); - console.log(result); + await client.scheduledActions.runByScope( + "subscriptions/00000000-0000-0000-0000-000000000000", + "monthlyCostByResource", + ); } async function main() { - scheduledActionRunByScope(); + await scheduledActionRunByScope(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsRunSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsRunSample.js index bbbce7cf7418..66e0383d2ca1 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsRunSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/scheduledActionsRunSample.js @@ -1,33 +1,23 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Processes a private scheduled action. + * This sample demonstrates how to processes a private scheduled action. * - * @summary Processes a private scheduled action. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-sendNow-private.json + * @summary processes a private scheduled action. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-sendNow-private.json */ async function scheduledActionSendNow() { - const name = "monthlyCostByResource"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.scheduledActions.run(name); - console.log(result); + await client.scheduledActions.run("monthlyCostByResource"); } async function main() { - scheduledActionSendNow(); + await scheduledActionSendNow(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/settingsCreateOrUpdateByScopeSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/settingsCreateOrUpdateByScopeSample.js new file mode 100644 index 000000000000..2feaaebaf62c --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/settingsCreateOrUpdateByScopeSample.js @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CostManagementClient } = require("@azure/arm-costmanagement"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to create or update a setting within the given scope. + * + * @summary create or update a setting within the given scope. + * x-ms-original-file: 2025-03-01/settings-createOrUpdate.json + */ +async function createOrUpdateSettingByScope() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.settings.createOrUpdateByScope( + "subscriptions/00000000-0000-0000-0000-000000000000", + "taginheritance", + { kind: "taginheritance", properties: { preferContainerTags: false } }, + ); + console.log(result); +} + +async function main() { + await createOrUpdateSettingByScope(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/settingsDeleteByScopeSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/settingsDeleteByScopeSample.js new file mode 100644 index 000000000000..21580faabcf7 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/settingsDeleteByScopeSample.js @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CostManagementClient } = require("@azure/arm-costmanagement"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to delete a setting within the given scope. + * + * @summary delete a setting within the given scope. + * x-ms-original-file: 2025-03-01/setting-delete.json + */ +async function settingDeleteByScope() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + await client.settings.deleteByScope( + "subscriptions/00000000-0000-0000-0000-000000000000", + "taginheritance", + ); +} + +async function main() { + await settingDeleteByScope(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/settingsGetByScopeSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/settingsGetByScopeSample.js new file mode 100644 index 000000000000..bc5c8e051ecb --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/settingsGetByScopeSample.js @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CostManagementClient } = require("@azure/arm-costmanagement"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get the setting from the given scope by name. + * + * @summary get the setting from the given scope by name. + * x-ms-original-file: 2025-03-01/setting-get.json + */ +async function settingByScope() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.settings.getByScope( + "subscriptions/00000000-0000-0000-0000-000000000000", + "taginheritance", + ); + console.log(result); +} + +async function main() { + await settingByScope(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/settingsListSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/settingsListSample.js new file mode 100644 index 000000000000..61db0d7d056f --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/settingsListSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CostManagementClient } = require("@azure/arm-costmanagement"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to list all cost management settings in the requested scope. + * + * @summary list all cost management settings in the requested scope. + * x-ms-original-file: 2025-03-01/settingsList.json + */ +async function settingsList() { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.settings.list("subscriptions/00000000-0000-0000-0000-000000000000"); + console.log(result); +} + +async function main() { + await settingsList(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsCreateOrUpdateByScopeSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsCreateOrUpdateByScopeSample.js index cc8db5527727..92028904c2ca 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsCreateOrUpdateByScopeSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsCreateOrUpdateByScopeSample.js @@ -1,62 +1,57 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ViewCreateOrUpdateByResourceGroup.json + * @summary 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. + * x-ms-original-file: 2025-03-01/ViewCreateOrUpdateByResourceGroup.json */ async function resourceGroupCreateOrUpdateView() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; - const viewName = "swaggerExample"; - const parameters = { - typePropertiesQueryType: "Usage", - accumulated: "true", - chart: "Table", - dataSet: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "Daily", - grouping: [], - sorting: [{ name: "UsageDate", direction: "Ascending" }], - }, - displayName: "swagger Example", - eTag: '"1d4ff9fe66f1d10"', - kpis: [ - { type: "Forecast", enabled: true, id: undefined }, - { - type: "Budget", - enabled: true, - id: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo", - }, - ], - metric: "ActualCost", - pivots: [ - { name: "ServiceName", type: "Dimension" }, - { name: "MeterCategory", type: "Dimension" }, - { name: "swaggerTagKey", type: "TagKey" }, - ], - timeframe: "MonthToDate", - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.views.createOrUpdateByScope(scope, viewName, parameters); + const result = await client.views.createOrUpdateByScope( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + "swaggerExample", + { + eTag: '"1d4ff9fe66f1d10"', + accumulated: "true", + chart: "Table", + displayName: "swagger Example", + kpis: [ + { type: "Forecast", enabled: true }, + { + type: "Budget", + enabled: true, + id: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo", + }, + ], + metric: "ActualCost", + pivots: [ + { name: "ServiceName", type: "Dimension" }, + { name: "MeterCategory", type: "Dimension" }, + { name: "swaggerTagKey", type: "TagKey" }, + ], + query: { + type: "Usage", + dataSet: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "Daily", + grouping: [], + sorting: [{ name: "UsageDate", direction: "Ascending" }], + }, + timeframe: "MonthToDate", + }, + }, + ); console.log(result); } async function main() { - resourceGroupCreateOrUpdateView(); + await resourceGroupCreateOrUpdateView(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsCreateOrUpdateSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsCreateOrUpdateSample.js index 3e6ffe212fcc..fba3347eb623 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsCreateOrUpdateSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsCreateOrUpdateSample.js @@ -1,39 +1,25 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PrivateViewCreateOrUpdate.json + * @summary 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. + * x-ms-original-file: 2025-03-01/PrivateViewCreateOrUpdate.json */ async function createOrUpdatePrivateView() { - const viewName = "swaggerExample"; - const parameters = { - typePropertiesQueryType: "Usage", + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.views.createOrUpdate("swaggerExample", { + eTag: '"1d4ff9fe66f1d10"', accumulated: "true", chart: "Table", - dataSet: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "Daily", - grouping: [], - sorting: [{ name: "UsageDate", direction: "Ascending" }], - }, displayName: "swagger Example", - eTag: '"1d4ff9fe66f1d10"', kpis: [ - { type: "Forecast", enabled: true, id: undefined }, + { type: "Forecast", enabled: true }, { type: "Budget", enabled: true, @@ -46,16 +32,22 @@ async function createOrUpdatePrivateView() { { name: "MeterCategory", type: "Dimension" }, { name: "swaggerTagKey", type: "TagKey" }, ], - timeframe: "MonthToDate", - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.views.createOrUpdate(viewName, parameters); + query: { + type: "Usage", + dataSet: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "Daily", + grouping: [], + sorting: [{ name: "UsageDate", direction: "Ascending" }], + }, + timeframe: "MonthToDate", + }, + }); console.log(result); } async function main() { - createOrUpdatePrivateView(); + await createOrUpdatePrivateView(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsDeleteByScopeSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsDeleteByScopeSample.js index 9f9326ec07d7..8e0c1f24e25c 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsDeleteByScopeSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsDeleteByScopeSample.js @@ -1,34 +1,26 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to The operation to delete a view. + * This sample demonstrates how to the operation to delete a view. * - * @summary The operation to delete a view. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ViewDeleteByResourceGroup.json + * @summary the operation to delete a view. + * x-ms-original-file: 2025-03-01/ViewDeleteByResourceGroup.json */ async function resourceGroupDeleteView() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; - const viewName = "TestView"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.views.deleteByScope(scope, viewName); - console.log(result); + await client.views.deleteByScope( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + "TestView", + ); } async function main() { - resourceGroupDeleteView(); + await resourceGroupDeleteView(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsDeleteSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsDeleteSample.js index 18dfb671682a..98b175918b50 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsDeleteSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsDeleteSample.js @@ -1,33 +1,23 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to The operation to delete a view. + * This sample demonstrates how to the operation to delete a view. * - * @summary The operation to delete a view. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PrivateViewDelete.json + * @summary the operation to delete a view. + * x-ms-original-file: 2025-03-01/PrivateViewDelete.json */ async function deletePrivateView() { - const viewName = "TestView"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.views.delete(viewName); - console.log(result); + await client.views.delete("TestView"); } async function main() { - deletePrivateView(); + await deletePrivateView(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsGetByScopeSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsGetByScopeSample.js index 4b71b5ea1702..9e548331fb96 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsGetByScopeSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsGetByScopeSample.js @@ -1,34 +1,27 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Gets the view for the defined scope by view name. + * This sample demonstrates how to gets the view for the defined scope by view name. * - * @summary Gets the view for the defined scope by view name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ViewByResourceGroup.json + * @summary gets the view for the defined scope by view name. + * x-ms-original-file: 2025-03-01/ViewByResourceGroup.json */ async function resourceGroupView() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; - const viewName = "swaggerExample"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.views.getByScope(scope, viewName); + const result = await client.views.getByScope( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + "swaggerExample", + ); console.log(result); } async function main() { - resourceGroupView(); + await resourceGroupView(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsGetSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsGetSample.js index df2ede8bc445..c5c60623fa29 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsGetSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsGetSample.js @@ -1,33 +1,24 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Gets the view by view name. + * This sample demonstrates how to gets the view by view name. * - * @summary Gets the view by view name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PrivateView.json + * @summary gets the view by view name. + * x-ms-original-file: 2025-03-01/PrivateView.json */ async function privateView() { - const viewName = "swaggerExample"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.views.get(viewName); + const result = await client.views.get("swaggerExample"); console.log(result); } async function main() { - privateView(); + await privateView(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsListByScopeSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsListByScopeSample.js index 9e959921466a..614dfd05e8a8 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsListByScopeSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsListByScopeSample.js @@ -1,36 +1,30 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Lists all views at the given scope. + * This sample demonstrates how to lists all views at the given scope. * - * @summary Lists all views at the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ViewListByResourceGroup.json + * @summary lists all views at the given scope. + * x-ms-original-file: 2025-03-01/ViewListByResourceGroup.json */ async function resourceGroupViewList() { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.views.listByScope(scope)) { + for await (const item of client.views.listByScope( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + )) { resArray.push(item); } + console.log(resArray); } async function main() { - resourceGroupViewList(); + await resourceGroupViewList(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsListSample.js b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsListSample.js index d9a8d3f16954..d4a344c0a341 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsListSample.js +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/javascript/viewsListSample.js @@ -1,35 +1,28 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { CostManagementClient } = require("@azure/arm-costmanagement"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Lists all views by tenant and object. + * This sample demonstrates how to lists all views by tenant and object. * - * @summary Lists all views by tenant and object. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PrivateViewList.json + * @summary lists all views by tenant and object. + * x-ms-original-file: 2025-03-01/PrivateViewList.json */ async function privateViewList() { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.views.list()) { + for await (const item of client.views.list()) { resArray.push(item); } + console.log(resArray); } async function main() { - privateViewList(); + await privateViewList(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/README.md b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/README.md index 27c70735a36e..e86820527148 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/README.md +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/README.md @@ -1,60 +1,80 @@ -# client library samples for TypeScript (Beta) - -These sample programs show how to use the TypeScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [alertsDismissSample.ts][alertsdismisssample] | Dismisses the specified alert x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DismissResourceGroupAlerts.json | -| [alertsGetSample.ts][alertsgetsample] | Gets the alert for the scope by alert ID. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SingleResourceGroupAlert.json | -| [alertsListExternalSample.ts][alertslistexternalsample] | Lists the Alerts for external cloud provider type defined. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalBillingAccountAlerts.json | -| [alertsListSample.ts][alertslistsample] | Lists the alerts for scope defined. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountAlerts.json | -| [benefitRecommendationsListSample.ts][benefitrecommendationslistsample] | List of recommendations for purchasing savings plan. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitRecommendationsByBillingAccount.json | -| [benefitUtilizationSummariesListByBillingAccountIdSample.ts][benefitutilizationsummarieslistbybillingaccountidsample] | Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitUtilizationSummaries/SavingsPlan-BillingAccount.json | -| [benefitUtilizationSummariesListByBillingProfileIdSample.ts][benefitutilizationsummarieslistbybillingprofileidsample] | Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitUtilizationSummaries/SavingsPlan-BillingProfile.json | -| [benefitUtilizationSummariesListBySavingsPlanIdSample.ts][benefitutilizationsummarieslistbysavingsplanidsample] | Lists the savings plan utilization summaries for daily or monthly grain. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanId-Monthly.json | -| [benefitUtilizationSummariesListBySavingsPlanOrderSample.ts][benefitutilizationsummarieslistbysavingsplanordersample] | Lists the savings plan utilization summaries for daily or monthly grain. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanOrderId-Daily.json | -| [dimensionsByExternalCloudProviderTypeSample.ts][dimensionsbyexternalcloudprovidertypesample] | Lists the dimensions by the external cloud provider type. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalBillingAccountsDimensions.json | -| [dimensionsListSample.ts][dimensionslistsample] | Lists the dimensions by the defined scope. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountDimensionsList.json | -| [exportsCreateOrUpdateSample.ts][exportscreateorupdatesample] | 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. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateByBillingAccount.json | -| [exportsDeleteSample.ts][exportsdeletesample] | The operation to delete a export. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteByBillingAccount.json | -| [exportsExecuteSample.ts][exportsexecutesample] | The operation to run an export. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunByBillingAccount.json | -| [exportsGetExecutionHistorySample.ts][exportsgetexecutionhistorysample] | The operation to get the run history of an export for the defined scope and export name. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetByBillingAccount.json | -| [exportsGetSample.ts][exportsgetsample] | The operation to get the export for the defined scope by export name. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetByBillingAccount.json | -| [exportsListSample.ts][exportslistsample] | The operation to list all exports at the given scope. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetByBillingAccount.json | -| [forecastExternalCloudProviderUsageSample.ts][forecastexternalcloudproviderusagesample] | Lists the forecast charges for external cloud provider type defined. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalBillingAccountForecast.json | -| [forecastUsageSample.ts][forecastusagesample] | Lists the forecast charges for scope defined. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountForecast.json | -| [generateCostDetailsReportCreateOperationSample.ts][generatecostdetailsreportcreateoperationsample] | This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod.json | -| [generateCostDetailsReportGetOperationResultsSample.ts][generatecostdetailsreportgetoperationresultssample] | Get the result of the specified operation. This link is provided in the CostDetails creation request response Location header. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/CostDetailsOperationResultsBySubscriptionScope.json | -| [generateDetailedCostReportCreateOperationSample.ts][generatedetailedcostreportcreateoperationsample] | 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. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportByBillingAccountLegacyAndBillingPeriod.json | -| [generateDetailedCostReportOperationResultsGetSample.ts][generatedetailedcostreportoperationresultsgetsample] | Gets the result of the specified operation. The link with this operationId is provided as a response header of the initial request. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportOperationResultsBySubscriptionScope.json | -| [generateDetailedCostReportOperationStatusGetSample.ts][generatedetailedcostreportoperationstatusgetsample] | Get the status of the specified operation. This link is provided in the GenerateDetailedCostReport creation request response header. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportOperationStatusBySubscriptionScope.json | -| [generateReservationDetailsReportByBillingAccountIdSample.ts][generatereservationdetailsreportbybillingaccountidsample] | 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://learn.microsoft.com/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateReservationDetailsReportByBillingAccount.json | -| [generateReservationDetailsReportByBillingProfileIdSample.ts][generatereservationdetailsreportbybillingprofileidsample] | 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://learn.microsoft.com/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateReservationDetailsReportByBillingProfile.json | -| [operationsListSample.ts][operationslistsample] | Lists all of the available cost management REST API operations. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/OperationList.json | -| [priceSheetDownloadByBillingProfileSample.ts][pricesheetdownloadbybillingprofilesample] | 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. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PricesheetDownloadByBillingProfile.json | -| [priceSheetDownloadSample.ts][pricesheetdownloadsample] | 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. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PricesheetDownload.json | -| [queryUsageByExternalCloudProviderTypeSample.ts][queryusagebyexternalcloudprovidertypesample] | Query the usage data for external cloud provider type defined. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalBillingAccountsQuery.json | -| [queryUsageSample.ts][queryusagesample] | Query the usage data for scope defined. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountQuery.json | -| [scheduledActionsCheckNameAvailabilityByScopeSample.ts][scheduledactionschecknameavailabilitybyscopesample] | Checks availability and correctness of the name for a scheduled action within the given scope. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/checkNameAvailability-shared-scheduledAction.json | -| [scheduledActionsCheckNameAvailabilitySample.ts][scheduledactionschecknameavailabilitysample] | Checks availability and correctness of the name for a scheduled action. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/checkNameAvailability-private-scheduledAction.json | -| [scheduledActionsCreateOrUpdateByScopeSample.ts][scheduledactionscreateorupdatebyscopesample] | Create or update a shared scheduled action within the given scope. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-insightAlert-createOrUpdate-shared.json | -| [scheduledActionsCreateOrUpdateSample.ts][scheduledactionscreateorupdatesample] | Create or update a private scheduled action. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-createOrUpdate-private.json | -| [scheduledActionsDeleteByScopeSample.ts][scheduledactionsdeletebyscopesample] | Delete a scheduled action within the given scope. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-delete-shared.json | -| [scheduledActionsDeleteSample.ts][scheduledactionsdeletesample] | Delete a private scheduled action. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-delete-private.json | -| [scheduledActionsGetByScopeSample.ts][scheduledactionsgetbyscopesample] | Get the shared scheduled action from the given scope by name. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-get-shared.json | -| [scheduledActionsGetSample.ts][scheduledactionsgetsample] | Get the private scheduled action by name. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-get-private.json | -| [scheduledActionsListByScopeSample.ts][scheduledactionslistbyscopesample] | List all shared scheduled actions within the given scope. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledActions-list-shared.json | -| [scheduledActionsListSample.ts][scheduledactionslistsample] | List all private scheduled actions. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledActions-list-private.json | -| [scheduledActionsRunByScopeSample.ts][scheduledactionsrunbyscopesample] | Runs a shared scheduled action within the given scope. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-sendNow-shared.json | -| [scheduledActionsRunSample.ts][scheduledactionsrunsample] | Processes a private scheduled action. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-sendNow-private.json | -| [viewsCreateOrUpdateByScopeSample.ts][viewscreateorupdatebyscopesample] | 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. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ViewCreateOrUpdateByResourceGroup.json | -| [viewsCreateOrUpdateSample.ts][viewscreateorupdatesample] | 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. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PrivateViewCreateOrUpdate.json | -| [viewsDeleteByScopeSample.ts][viewsdeletebyscopesample] | The operation to delete a view. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ViewDeleteByResourceGroup.json | -| [viewsDeleteSample.ts][viewsdeletesample] | The operation to delete a view. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PrivateViewDelete.json | -| [viewsGetByScopeSample.ts][viewsgetbyscopesample] | Gets the view for the defined scope by view name. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ViewByResourceGroup.json | -| [viewsGetSample.ts][viewsgetsample] | Gets the view by view name. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PrivateView.json | -| [viewsListByScopeSample.ts][viewslistbyscopesample] | Lists all views at the given scope. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ViewListByResourceGroup.json | -| [viewsListSample.ts][viewslistsample] | Lists all views by tenant and object. x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PrivateViewList.json | +# @azure/arm-costmanagement client library samples for TypeScript (Beta) + +These sample programs show how to use the TypeScript client libraries for @azure/arm-costmanagement in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [alertsDismissSample.ts][alertsdismisssample] | dismisses the specified alert x-ms-original-file: 2025-03-01/DismissResourceGroupAlerts.json | +| [alertsGetSample.ts][alertsgetsample] | gets the alert for the scope by alert ID. x-ms-original-file: 2025-03-01/SingleResourceGroupAlert.json | +| [alertsListExternalSample.ts][alertslistexternalsample] | lists the Alerts for external cloud provider type defined. x-ms-original-file: 2025-03-01/ExternalBillingAccountAlerts.json | +| [alertsListSample.ts][alertslistsample] | lists the alerts for scope defined. x-ms-original-file: 2025-03-01/BillingAccountAlerts.json | +| [benefitRecommendationsListSample.ts][benefitrecommendationslistsample] | list of recommendations for purchasing savings plan. x-ms-original-file: 2025-03-01/BenefitRecommendationsByBillingAccount.json | +| [benefitUtilizationSummariesListByBillingAccountIdSample.ts][benefitutilizationsummarieslistbybillingaccountidsample] | lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/SavingsPlan-BillingAccount.json | +| [benefitUtilizationSummariesListByBillingProfileIdSample.ts][benefitutilizationsummarieslistbybillingprofileidsample] | lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/SavingsPlan-BillingProfile.json | +| [benefitUtilizationSummariesListBySavingsPlanIdSample.ts][benefitutilizationsummarieslistbysavingsplanidsample] | lists the savings plan utilization summaries for daily or monthly grain. x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanId-Monthly.json | +| [benefitUtilizationSummariesListBySavingsPlanOrderSample.ts][benefitutilizationsummarieslistbysavingsplanordersample] | lists the savings plan utilization summaries for daily or monthly grain. x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanOrderId-Daily.json | +| [budgetsCreateOrUpdateSample.ts][budgetscreateorupdatesample] | the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/Cost/CreateOrUpdate-Cost-Subscription-Budget.json | +| [budgetsDeleteSample.ts][budgetsdeletesample] | the operation to delete a budget. x-ms-original-file: 2025-03-01/Budgets/Delete/DeleteBudget.json | +| [budgetsGetSample.ts][budgetsgetsample] | gets the budget for the scope by budget name. x-ms-original-file: 2025-03-01/Budgets/Get/Cost/Get-Cost-Budget.json | +| [budgetsListSample.ts][budgetslistsample] | lists all budgets for the defined scope. x-ms-original-file: 2025-03-01/Budgets/List/EA/BillingAccountBudgetsList-EA-CategoryTypeFilter.json | +| [costAllocationRulesCheckNameAvailabilitySample.ts][costallocationruleschecknameavailabilitysample] | checks availability and correctness of a name for a cost allocation rule x-ms-original-file: 2025-03-01/CostAllocationRuleCheckNameAvailability.json | +| [costAllocationRulesCreateOrUpdateSample.ts][costallocationrulescreateorupdatesample] | create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment. x-ms-original-file: 2025-03-01/CostAllocationRuleCreate.json | +| [costAllocationRulesDeleteSample.ts][costallocationrulesdeletesample] | delete cost allocation rule for billing account or enterprise enrollment. x-ms-original-file: 2025-03-01/CostAllocationRuleDelete.json | +| [costAllocationRulesGetSample.ts][costallocationrulesgetsample] | get a cost allocation rule by rule name and billing account or enterprise enrollment. x-ms-original-file: 2025-03-01/CostAllocationRuleGet.json | +| [costAllocationRulesListSample.ts][costallocationruleslistsample] | get the list of all cost allocation rules for a billing account or enterprise enrollment. x-ms-original-file: 2025-03-01/CostAllocationRulesList.json | +| [dimensionsListByExternalCloudProviderTypeSample.ts][dimensionslistbyexternalcloudprovidertypesample] | lists the dimensions by the external cloud provider type. x-ms-original-file: 2025-03-01/ExternalBillingAccountsDimensions.json | +| [dimensionsListSample.ts][dimensionslistsample] | lists the dimensions by the defined scope. x-ms-original-file: 2025-03-01/BillingAccountDimensionsList.json | +| [exportsCreateOrUpdateSample.ts][exportscreateorupdatesample] | 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. x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByBillingAccount.json | +| [exportsDeleteSample.ts][exportsdeletesample] | the operation to delete a export. x-ms-original-file: 2025-03-01/ExportDeleteByBillingAccount.json | +| [exportsExecuteSample.ts][exportsexecutesample] | the operation to run an export. x-ms-original-file: 2025-03-01/ExportRunByBillingAccount.json | +| [exportsGetExecutionHistorySample.ts][exportsgetexecutionhistorysample] | the operation to get the run history of an export for the defined scope and export name. x-ms-original-file: 2025-03-01/ExportRunHistoryGetByBillingAccount.json | +| [exportsGetSample.ts][exportsgetsample] | the operation to get the export for the defined scope by export name. x-ms-original-file: 2025-03-01/ExportGetByBillingAccount.json | +| [exportsListSample.ts][exportslistsample] | the operation to list all exports at the given scope. x-ms-original-file: 2025-03-01/ExportsGetByBillingAccount.json | +| [forecastExternalCloudProviderUsageSample.ts][forecastexternalcloudproviderusagesample] | lists the forecast charges for external cloud provider type defined. x-ms-original-file: 2025-03-01/ExternalBillingAccountForecast.json | +| [forecastUsageSample.ts][forecastusagesample] | lists the forecast charges for scope defined. x-ms-original-file: 2025-03-01/BillingAccountForecast.json | +| [generateBenefitUtilizationSummariesReportGenerateByBillingAccountSample.ts][generatebenefitutilizationsummariesreportgeneratebybillingaccountsample] | triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByBillingAccount.json | +| [generateBenefitUtilizationSummariesReportGenerateByBillingProfileSample.ts][generatebenefitutilizationsummariesreportgeneratebybillingprofilesample] | triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByBillingProfile.json | +| [generateBenefitUtilizationSummariesReportGenerateByReservationIdSample.ts][generatebenefitutilizationsummariesreportgeneratebyreservationidsample] | triggers generation of a benefit utilization summaries report for the provided reservation. x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByReservation.json | +| [generateBenefitUtilizationSummariesReportGenerateByReservationOrderIdSample.ts][generatebenefitutilizationsummariesreportgeneratebyreservationorderidsample] | triggers generation of a benefit utilization summaries report for the provided reservation order. x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByReservationOrder.json | +| [generateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdSample.ts][generatebenefitutilizationsummariesreportgeneratebysavingsplanidsample] | triggers generation of a benefit utilization summaries report for the provided savings plan. x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportBySavingsPlan.json | +| [generateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdSample.ts][generatebenefitutilizationsummariesreportgeneratebysavingsplanorderidsample] | triggers generation of a benefit utilization summaries report for the provided savings plan order. x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportBySavingsPlanOrder.json | +| [generateCostDetailsReportCreateOperationSample.ts][generatecostdetailsreportcreateoperationsample] | this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod.json | +| [generateCostDetailsReportGetOperationResultsSample.ts][generatecostdetailsreportgetoperationresultssample] | get the result of the specified operation. This link is provided in the CostDetails creation request response Location header. x-ms-original-file: 2025-03-01/CostDetailsOperationResultsBySubscriptionScope.json | +| [generateDetailedCostReportCreateOperationSample.ts][generatedetailedcostreportcreateoperationsample] | 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. x-ms-original-file: 2025-03-01/GenerateDetailedCostReportByBillingAccountLegacyAndBillingPeriod.json | +| [generateDetailedCostReportOperationResultsGetSample.ts][generatedetailedcostreportoperationresultsgetsample] | gets the result of the specified operation. The link with this operationId is provided as a response header of the initial request. x-ms-original-file: 2025-03-01/GenerateDetailedCostReportOperationResultsBySubscriptionScope.json | +| [generateDetailedCostReportOperationStatusGetSample.ts][generatedetailedcostreportoperationstatusgetsample] | get the status of the specified operation. This link is provided in the GenerateDetailedCostReport creation request response header. x-ms-original-file: 2025-03-01/GenerateDetailedCostReportOperationStatusBySubscriptionScope.json | +| [generateReservationDetailsReportByBillingAccountIdSample.ts][generatereservationdetailsreportbybillingaccountidsample] | 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 x-ms-original-file: 2025-03-01/GenerateReservationDetailsReportByBillingAccount.json | +| [generateReservationDetailsReportByBillingProfileIdSample.ts][generatereservationdetailsreportbybillingprofileidsample] | 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 x-ms-original-file: 2025-03-01/GenerateReservationDetailsReportByBillingProfile.json | +| [operationsListSample.ts][operationslistsample] | list the operations for the provider x-ms-original-file: 2025-03-01/OperationList.json | +| [priceSheetDownloadByBillingAccountSample.ts][pricesheetdownloadbybillingaccountsample] | generates the pricesheet for the provided billing period asynchronously based on the Enrollment ID. This is for Enterprise Agreement customers. **Migrate to version 2025-03-01** You can use the 2025-03-01 API version with the new URI: '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.CostManagement/pricesheets/default/download' With a new schema detailed below, the new version of the price sheet provides additional information and includes prices for Azure Reserved Instances (RI) for the current billing period. We recommend downloading an Azure Price Sheet for when entering a new billing period if you would maintain an ongoing record of past Azure Reserved Instance (RI) pricing. The EA Azure price sheet is available for billing periods in the past 13 months. To request a price sheet for a billing period older than 13 months, please contact support. The Azure price sheet download experience has been updated from a single .csv file to a zip file containing multiple .csv files, each with max size of 75MB. The 2023-11-01 version has been upgraded to use http POST method; details can be found below. All versions of the Microsoft.Consumption Azure Price Sheet - Download by Billing Account (including 2022-06-01, 2021-10-01, 2020-01-01-preview, 2019-10-01, 2019-05-01) are scheduled to be retired on 01 June 2026 and will no longer be supported after this date. x-ms-original-file: 2025-03-01/EAPriceSheetForBillingPeriod.json | +| [priceSheetDownloadByBillingProfileSample.ts][pricesheetdownloadbybillingprofilesample] | 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. You can use the new 2023-09-01 API version for billing periods January 2023 onwards. Azure Reserved Instance (RI) pricing is only available through the new version of the API. Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv/json file to a Zip file containing multiple csv/json files, each with max size of 75MB. x-ms-original-file: 2025-03-01/PricesheetDownloadByBillingProfile.json | +| [priceSheetDownloadByInvoiceSample.ts][pricesheetdownloadbyinvoicesample] | 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. x-ms-original-file: 2025-03-01/PricesheetDownload.json | +| [queryUsageByExternalCloudProviderTypeSample.ts][queryusagebyexternalcloudprovidertypesample] | query the usage data for external cloud provider type defined. x-ms-original-file: 2025-03-01/ExternalBillingAccountsQuery.json | +| [queryUsageSample.ts][queryusagesample] | query the usage data for scope defined. x-ms-original-file: 2025-03-01/BillingAccountQuery.json | +| [scheduledActionsCheckNameAvailabilityByScopeSample.ts][scheduledactionschecknameavailabilitybyscopesample] | checks availability and correctness of the name for a scheduled action within the given scope. x-ms-original-file: 2025-03-01/scheduledActions/checkNameAvailability-shared-scheduledAction.json | +| [scheduledActionsCheckNameAvailabilitySample.ts][scheduledactionschecknameavailabilitysample] | checks availability and correctness of the name for a scheduled action. x-ms-original-file: 2025-03-01/scheduledActions/checkNameAvailability-private-scheduledAction.json | +| [scheduledActionsCreateOrUpdateByScopeSample.ts][scheduledactionscreateorupdatebyscopesample] | create or update a shared scheduled action within the given scope. x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-createOrUpdate-shared.json | +| [scheduledActionsCreateOrUpdateSample.ts][scheduledactionscreateorupdatesample] | create or update a private scheduled action. x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-createOrUpdate-private.json | +| [scheduledActionsDeleteByScopeSample.ts][scheduledactionsdeletebyscopesample] | delete a scheduled action within the given scope. x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-delete-shared.json | +| [scheduledActionsDeleteSample.ts][scheduledactionsdeletesample] | delete a private scheduled action. x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-delete-private.json | +| [scheduledActionsGetByScopeSample.ts][scheduledactionsgetbyscopesample] | get the shared scheduled action from the given scope by name. x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-get-shared.json | +| [scheduledActionsGetSample.ts][scheduledactionsgetsample] | get the private scheduled action by name. x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-get-private.json | +| [scheduledActionsListByScopeSample.ts][scheduledactionslistbyscopesample] | list all shared scheduled actions within the given scope. x-ms-original-file: 2025-03-01/scheduledActions/scheduledActions-list-shared.json | +| [scheduledActionsListSample.ts][scheduledactionslistsample] | list all private scheduled actions. x-ms-original-file: 2025-03-01/scheduledActions/scheduledActions-list-private.json | +| [scheduledActionsRunByScopeSample.ts][scheduledactionsrunbyscopesample] | runs a shared scheduled action within the given scope. x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-sendNow-shared.json | +| [scheduledActionsRunSample.ts][scheduledactionsrunsample] | processes a private scheduled action. x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-sendNow-private.json | +| [settingsCreateOrUpdateByScopeSample.ts][settingscreateorupdatebyscopesample] | create or update a setting within the given scope. x-ms-original-file: 2025-03-01/settings-createOrUpdate.json | +| [settingsDeleteByScopeSample.ts][settingsdeletebyscopesample] | delete a setting within the given scope. x-ms-original-file: 2025-03-01/setting-delete.json | +| [settingsGetByScopeSample.ts][settingsgetbyscopesample] | get the setting from the given scope by name. x-ms-original-file: 2025-03-01/setting-get.json | +| [settingsListSample.ts][settingslistsample] | list all cost management settings in the requested scope. x-ms-original-file: 2025-03-01/settingsList.json | +| [viewsCreateOrUpdateByScopeSample.ts][viewscreateorupdatebyscopesample] | 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. x-ms-original-file: 2025-03-01/ViewCreateOrUpdateByResourceGroup.json | +| [viewsCreateOrUpdateSample.ts][viewscreateorupdatesample] | 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. x-ms-original-file: 2025-03-01/PrivateViewCreateOrUpdate.json | +| [viewsDeleteByScopeSample.ts][viewsdeletebyscopesample] | the operation to delete a view. x-ms-original-file: 2025-03-01/ViewDeleteByResourceGroup.json | +| [viewsDeleteSample.ts][viewsdeletesample] | the operation to delete a view. x-ms-original-file: 2025-03-01/PrivateViewDelete.json | +| [viewsGetByScopeSample.ts][viewsgetbyscopesample] | gets the view for the defined scope by view name. x-ms-original-file: 2025-03-01/ViewByResourceGroup.json | +| [viewsGetSample.ts][viewsgetsample] | gets the view by view name. x-ms-original-file: 2025-03-01/PrivateView.json | +| [viewsListByScopeSample.ts][viewslistbyscopesample] | lists all views at the given scope. x-ms-original-file: 2025-03-01/ViewListByResourceGroup.json | +| [viewsListSample.ts][viewslistsample] | lists all views by tenant and object. x-ms-original-file: 2025-03-01/PrivateViewList.json | ## Prerequisites @@ -96,10 +116,10 @@ npm run build node dist/alertsDismissSample.js ``` -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): +Alternatively, run a single sample with the required environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): ```bash -cross-env node dist/alertsDismissSample.js +node dist/alertsDismissSample.js ``` ## Next Steps @@ -115,7 +135,16 @@ Take a look at our [API Documentation][apiref] for more information about the AP [benefitutilizationsummarieslistbybillingprofileidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/benefitUtilizationSummariesListByBillingProfileIdSample.ts [benefitutilizationsummarieslistbysavingsplanidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/benefitUtilizationSummariesListBySavingsPlanIdSample.ts [benefitutilizationsummarieslistbysavingsplanordersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/benefitUtilizationSummariesListBySavingsPlanOrderSample.ts -[dimensionsbyexternalcloudprovidertypesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/dimensionsByExternalCloudProviderTypeSample.ts +[budgetscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/budgetsCreateOrUpdateSample.ts +[budgetsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/budgetsDeleteSample.ts +[budgetsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/budgetsGetSample.ts +[budgetslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/budgetsListSample.ts +[costallocationruleschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/costAllocationRulesCheckNameAvailabilitySample.ts +[costallocationrulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/costAllocationRulesCreateOrUpdateSample.ts +[costallocationrulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/costAllocationRulesDeleteSample.ts +[costallocationrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/costAllocationRulesGetSample.ts +[costallocationruleslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/costAllocationRulesListSample.ts +[dimensionslistbyexternalcloudprovidertypesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/dimensionsListByExternalCloudProviderTypeSample.ts [dimensionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/dimensionsListSample.ts [exportscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsCreateOrUpdateSample.ts [exportsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsDeleteSample.ts @@ -125,6 +154,12 @@ Take a look at our [API Documentation][apiref] for more information about the AP [exportslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsListSample.ts [forecastexternalcloudproviderusagesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/forecastExternalCloudProviderUsageSample.ts [forecastusagesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/forecastUsageSample.ts +[generatebenefitutilizationsummariesreportgeneratebybillingaccountsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateBenefitUtilizationSummariesReportGenerateByBillingAccountSample.ts +[generatebenefitutilizationsummariesreportgeneratebybillingprofilesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateBenefitUtilizationSummariesReportGenerateByBillingProfileSample.ts +[generatebenefitutilizationsummariesreportgeneratebyreservationidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateBenefitUtilizationSummariesReportGenerateByReservationIdSample.ts +[generatebenefitutilizationsummariesreportgeneratebyreservationorderidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateBenefitUtilizationSummariesReportGenerateByReservationOrderIdSample.ts +[generatebenefitutilizationsummariesreportgeneratebysavingsplanidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdSample.ts +[generatebenefitutilizationsummariesreportgeneratebysavingsplanorderidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdSample.ts [generatecostdetailsreportcreateoperationsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateCostDetailsReportCreateOperationSample.ts [generatecostdetailsreportgetoperationresultssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateCostDetailsReportGetOperationResultsSample.ts [generatedetailedcostreportcreateoperationsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateDetailedCostReportCreateOperationSample.ts @@ -133,8 +168,9 @@ Take a look at our [API Documentation][apiref] for more information about the AP [generatereservationdetailsreportbybillingaccountidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateReservationDetailsReportByBillingAccountIdSample.ts [generatereservationdetailsreportbybillingprofileidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateReservationDetailsReportByBillingProfileIdSample.ts [operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/operationsListSample.ts +[pricesheetdownloadbybillingaccountsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/priceSheetDownloadByBillingAccountSample.ts [pricesheetdownloadbybillingprofilesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/priceSheetDownloadByBillingProfileSample.ts -[pricesheetdownloadsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/priceSheetDownloadSample.ts +[pricesheetdownloadbyinvoicesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/priceSheetDownloadByInvoiceSample.ts [queryusagebyexternalcloudprovidertypesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/queryUsageByExternalCloudProviderTypeSample.ts [queryusagesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/queryUsageSample.ts [scheduledactionschecknameavailabilitybyscopesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsCheckNameAvailabilityByScopeSample.ts @@ -149,6 +185,10 @@ Take a look at our [API Documentation][apiref] for more information about the AP [scheduledactionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsListSample.ts [scheduledactionsrunbyscopesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsRunByScopeSample.ts [scheduledactionsrunsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsRunSample.ts +[settingscreateorupdatebyscopesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/settingsCreateOrUpdateByScopeSample.ts +[settingsdeletebyscopesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/settingsDeleteByScopeSample.ts +[settingsgetbyscopesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/settingsGetByScopeSample.ts +[settingslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/settingsListSample.ts [viewscreateorupdatebyscopesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsCreateOrUpdateByScopeSample.ts [viewscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsCreateOrUpdateSample.ts [viewsdeletebyscopesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsDeleteByScopeSample.ts diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/package.json b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/package.json index 5643fc8c5cab..db3307d715e3 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/package.json +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/package.json @@ -2,7 +2,7 @@ "name": "@azure-samples/arm-costmanagement-ts-beta", "private": true, "version": "1.0.0", - "description": " client library samples for TypeScript (Beta)", + "description": "@azure/arm-costmanagement client library samples for TypeScript (Beta)", "engines": { "node": ">=20.0.0" }, @@ -18,6 +18,7 @@ "keywords": [ "node", "azure", + "cloud", "typescript", "browser", "isomorphic" @@ -29,13 +30,14 @@ }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cost-management/arm-costmanagement", "dependencies": { - "@azure/arm-costmanagement": "next", + "@azure/arm-costmanagement": "beta", "dotenv": "latest", - "@azure/identity": "^4.2.1" + "@azure/identity": "^4.13.0" }, "devDependencies": { "@types/node": "^20.0.0", - "typescript": "~5.8.2", - "rimraf": "latest" + "cross-env": "latest", + "rimraf": "latest", + "typescript": "~6.0.2" } } diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/sample.env b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/sample.env index 672847a3fea0..508439fc7d62 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/sample.env +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/sample.env @@ -1,4 +1 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/alertsDismissSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/alertsDismissSample.ts index 1e1bde396fab..729daf69a91b 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/alertsDismissSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/alertsDismissSample.ts @@ -1,53 +1,46 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { - DismissAlertPayload, - CostManagementClient -} from "@azure/arm-costmanagement"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Dismisses the specified alert + * This sample demonstrates how to dismisses the specified alert * - * @summary Dismisses the specified alert - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DismissResourceGroupAlerts.json + * @summary dismisses the specified alert + * x-ms-original-file: 2025-03-01/DismissResourceGroupAlerts.json */ async function patchResourceGroupAlerts(): Promise { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"; - const alertId = "22222222-2222-2222-2222-222222222222"; - const parameters: DismissAlertPayload = { status: "Dismissed" }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.dismiss(scope, alertId, parameters); + const result = await client.alerts.dismiss( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", + "22222222-2222-2222-2222-222222222222", + { status: "Dismissed" }, + ); console.log(result); } /** - * This sample demonstrates how to Dismisses the specified alert + * This sample demonstrates how to dismisses the specified alert * - * @summary Dismisses the specified alert - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DismissSubscriptionAlerts.json + * @summary dismisses the specified alert + * x-ms-original-file: 2025-03-01/DismissSubscriptionAlerts.json */ async function patchSubscriptionAlerts(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const alertId = "22222222-2222-2222-2222-222222222222"; - const parameters: DismissAlertPayload = { status: "Dismissed" }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.dismiss(scope, alertId, parameters); + const result = await client.alerts.dismiss( + "subscriptions/00000000-0000-0000-0000-000000000000", + "22222222-2222-2222-2222-222222222222", + { status: "Dismissed" }, + ); console.log(result); } async function main(): Promise { - patchResourceGroupAlerts(); - patchSubscriptionAlerts(); + await patchResourceGroupAlerts(); + await patchSubscriptionAlerts(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/alertsGetSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/alertsGetSample.ts index c88c2a34cf1a..3549f35f0a5a 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/alertsGetSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/alertsGetSample.ts @@ -1,48 +1,44 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Gets the alert for the scope by alert ID. + * This sample demonstrates how to gets the alert for the scope by alert ID. * - * @summary Gets the alert for the scope by alert ID. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SingleResourceGroupAlert.json + * @summary gets the alert for the scope by alert ID. + * x-ms-original-file: 2025-03-01/SingleResourceGroupAlert.json */ async function singleResourceGroupAlerts(): Promise { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"; - const alertId = "22222222-2222-2222-2222-222222222222"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.get(scope, alertId); + const result = await client.alerts.get( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", + "22222222-2222-2222-2222-222222222222", + ); console.log(result); } /** - * This sample demonstrates how to Gets the alert for the scope by alert ID. + * This sample demonstrates how to gets the alert for the scope by alert ID. * - * @summary Gets the alert for the scope by alert ID. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SingleSubscriptionAlert.json + * @summary gets the alert for the scope by alert ID. + * x-ms-original-file: 2025-03-01/SingleSubscriptionAlert.json */ async function singleSubscriptionAlerts(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const alertId = "22222222-2222-2222-2222-222222222222"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.get(scope, alertId); + const result = await client.alerts.get( + "subscriptions/00000000-0000-0000-0000-000000000000", + "22222222-2222-2222-2222-222222222222", + ); console.log(result); } async function main(): Promise { - singleResourceGroupAlerts(); - singleSubscriptionAlerts(); + await singleResourceGroupAlerts(); + await singleSubscriptionAlerts(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/alertsListExternalSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/alertsListExternalSample.ts index 251f3ba7004a..8f4d35082df1 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/alertsListExternalSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/alertsListExternalSample.ts @@ -1,53 +1,38 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists the Alerts for external cloud provider type defined. + * This sample demonstrates how to lists the Alerts for external cloud provider type defined. * - * @summary Lists the Alerts for external cloud provider type defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalBillingAccountAlerts.json + * @summary lists the Alerts for external cloud provider type defined. + * x-ms-original-file: 2025-03-01/ExternalBillingAccountAlerts.json */ async function externalBillingAccountAlerts(): Promise { - const externalCloudProviderType = "externalBillingAccounts"; - const externalCloudProviderId = "100"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.listExternal( - externalCloudProviderType, - externalCloudProviderId - ); + const result = await client.alerts.listExternal("externalBillingAccounts", "100"); console.log(result); } /** - * This sample demonstrates how to Lists the Alerts for external cloud provider type defined. + * This sample demonstrates how to lists the Alerts for external cloud provider type defined. * - * @summary Lists the Alerts for external cloud provider type defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalSubscriptionAlerts.json + * @summary lists the Alerts for external cloud provider type defined. + * x-ms-original-file: 2025-03-01/ExternalSubscriptionAlerts.json */ async function externalSubscriptionAlerts(): Promise { - const externalCloudProviderType = "externalSubscriptions"; - const externalCloudProviderId = "100"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.listExternal( - externalCloudProviderType, - externalCloudProviderId - ); + const result = await client.alerts.listExternal("externalSubscriptions", "100"); console.log(result); } async function main(): Promise { - externalBillingAccountAlerts(); - externalSubscriptionAlerts(); + await externalBillingAccountAlerts(); + await externalSubscriptionAlerts(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/alertsListSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/alertsListSample.ts index 77e0a0d8cd59..c7c3bd90935e 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/alertsListSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/alertsListSample.ts @@ -1,125 +1,118 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists the alerts for scope defined. + * This sample demonstrates how to lists the alerts for scope defined. * - * @summary Lists the alerts for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountAlerts.json + * @summary lists the alerts for scope defined. + * x-ms-original-file: 2025-03-01/BillingAccountAlerts.json */ async function billingAccountAlerts(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.list(scope); + const result = await client.alerts.list("providers/Microsoft.Billing/billingAccounts/12345-6789"); console.log(result); } /** - * This sample demonstrates how to Lists the alerts for scope defined. + * This sample demonstrates how to lists the alerts for scope defined. * - * @summary Lists the alerts for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingProfileAlerts.json + * @summary lists the alerts for scope defined. + * x-ms-original-file: 2025-03-01/BillingProfileAlerts.json */ async function billingProfileAlerts(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.list(scope); + const result = await client.alerts.list( + "providers/Microsoft.Billing/billingAccounts/12345-6789/billingProfiles/13579", + ); console.log(result); } /** - * This sample demonstrates how to Lists the alerts for scope defined. + * This sample demonstrates how to lists the alerts for scope defined. * - * @summary Lists the alerts for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentAlerts.json + * @summary lists the alerts for scope defined. + * x-ms-original-file: 2025-03-01/DepartmentAlerts.json */ async function departmentAlerts(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.list(scope); + const result = await client.alerts.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123", + ); console.log(result); } /** - * This sample demonstrates how to Lists the alerts for scope defined. + * This sample demonstrates how to lists the alerts for scope defined. * - * @summary Lists the alerts for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountAlerts.json + * @summary lists the alerts for scope defined. + * x-ms-original-file: 2025-03-01/EnrollmentAccountAlerts.json */ async function enrollmentAccountAlerts(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.list(scope); + const result = await client.alerts.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456", + ); console.log(result); } /** - * This sample demonstrates how to Lists the alerts for scope defined. + * This sample demonstrates how to lists the alerts for scope defined. * - * @summary Lists the alerts for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/InvoiceSectionAlerts.json + * @summary lists the alerts for scope defined. + * x-ms-original-file: 2025-03-01/InvoiceSectionAlerts.json */ async function invoiceSectionAlerts(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.list(scope); + const result = await client.alerts.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", + ); console.log(result); } /** - * This sample demonstrates how to Lists the alerts for scope defined. + * This sample demonstrates how to lists the alerts for scope defined. * - * @summary Lists the alerts for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ResourceGroupAlerts.json + * @summary lists the alerts for scope defined. + * x-ms-original-file: 2025-03-01/ResourceGroupAlerts.json */ async function resourceGroupAlerts(): Promise { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.list(scope); + const result = await client.alerts.list( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", + ); console.log(result); } /** - * This sample demonstrates how to Lists the alerts for scope defined. + * This sample demonstrates how to lists the alerts for scope defined. * - * @summary Lists the alerts for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SubscriptionAlerts.json + * @summary lists the alerts for scope defined. + * x-ms-original-file: 2025-03-01/SubscriptionAlerts.json */ async function subscriptionAlerts(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.alerts.list(scope); + const result = await client.alerts.list("subscriptions/00000000-0000-0000-0000-000000000000"); console.log(result); } async function main(): Promise { - billingAccountAlerts(); - billingProfileAlerts(); - departmentAlerts(); - enrollmentAccountAlerts(); - invoiceSectionAlerts(); - resourceGroupAlerts(); - subscriptionAlerts(); + await billingAccountAlerts(); + await billingProfileAlerts(); + await departmentAlerts(); + await enrollmentAccountAlerts(); + await invoiceSectionAlerts(); + await resourceGroupAlerts(); + await subscriptionAlerts(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/benefitRecommendationsListSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/benefitRecommendationsListSample.ts index 9e9d7ca0438b..d0ebfd4394e3 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/benefitRecommendationsListSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/benefitRecommendationsListSample.ts @@ -1,43 +1,34 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { - BenefitRecommendationsListOptionalParams, - CostManagementClient -} from "@azure/arm-costmanagement"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List of recommendations for purchasing savings plan. + * This sample demonstrates how to list of recommendations for purchasing savings plan. * - * @summary List of recommendations for purchasing savings plan. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitRecommendationsByBillingAccount.json + * @summary list of recommendations for purchasing savings plan. + * x-ms-original-file: 2025-03-01/BenefitRecommendationsByBillingAccount.json */ async function benefitRecommendationsBillingAccountList(): Promise { - const filter = - "properties/lookBackPeriod eq 'Last7Days' AND properties/term eq 'P1Y'"; - const expand = "properties/usage,properties/allRecommendationDetails"; - const billingScope = "providers/Microsoft.Billing/billingAccounts/123456"; - const options: BenefitRecommendationsListOptionalParams = { filter, expand }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.benefitRecommendations.list( - billingScope, - options + for await (const item of client.benefitRecommendations.list( + "providers/Microsoft.Billing/billingAccounts/123456", + { + filter: "properties/lookBackPeriod eq 'Last7Days' AND properties/term eq 'P1Y'", + expand: "properties/usage,properties/allRecommendationDetails", + }, )) { resArray.push(item); } + console.log(resArray); } async function main(): Promise { - benefitRecommendationsBillingAccountList(); + await benefitRecommendationsBillingAccountList(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/benefitUtilizationSummariesListByBillingAccountIdSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/benefitUtilizationSummariesListByBillingAccountIdSample.ts index 230d460a5a1b..3bed0018763d 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/benefitUtilizationSummariesListByBillingAccountIdSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/benefitUtilizationSummariesListByBillingAccountIdSample.ts @@ -1,44 +1,30 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { - BenefitUtilizationSummariesListByBillingAccountIdOptionalParams, - CostManagementClient -} from "@azure/arm-costmanagement"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. + * This sample demonstrates how to lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. * - * @summary Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitUtilizationSummaries/SavingsPlan-BillingAccount.json + * @summary lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/SavingsPlan-BillingAccount.json */ async function savingsPlanUtilizationSummariesBillingAccount(): Promise { - const billingAccountId = "12345"; - const filter = - "properties/usageDate ge 2022-10-15 and properties/usageDate le 2022-10-18"; - const options: BenefitUtilizationSummariesListByBillingAccountIdOptionalParams = { - filter - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.benefitUtilizationSummaries.listByBillingAccountId( - billingAccountId, - options - )) { + for await (const item of client.benefitUtilizationSummaries.listByBillingAccountId("12345", { + filter: "properties/usageDate ge 2022-10-15 and properties/usageDate le 2022-10-18", + })) { resArray.push(item); } + console.log(resArray); } async function main(): Promise { - savingsPlanUtilizationSummariesBillingAccount(); + await savingsPlanUtilizationSummariesBillingAccount(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/benefitUtilizationSummariesListByBillingProfileIdSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/benefitUtilizationSummariesListByBillingProfileIdSample.ts index 511ef938bb18..6556886148a9 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/benefitUtilizationSummariesListByBillingProfileIdSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/benefitUtilizationSummariesListByBillingProfileIdSample.ts @@ -1,47 +1,32 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { - BenefitUtilizationSummariesListByBillingProfileIdOptionalParams, - CostManagementClient -} from "@azure/arm-costmanagement"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. + * This sample demonstrates how to lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. * - * @summary Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitUtilizationSummaries/SavingsPlan-BillingProfile.json + * @summary lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/SavingsPlan-BillingProfile.json */ async function savingsPlanUtilizationSummariesBillingProfile(): Promise { - const billingAccountId = - "c0a00000-0e04-5ee3-000e-f0c6e00000ec:c0a00000-0e04-5ee3-000e-f0c6e00000ec"; - const billingProfileId = "200e5e90-000e-4960-8dcd-8d00a02db000"; - const filter = - "properties/usageDate ge 2022-10-15 and properties/usageDate le 2022-10-18"; - const options: BenefitUtilizationSummariesListByBillingProfileIdOptionalParams = { - filter - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.benefitUtilizationSummaries.listByBillingProfileId( - billingAccountId, - billingProfileId, - options + for await (const item of client.benefitUtilizationSummaries.listByBillingProfileId( + "c0a00000-0e04-5ee3-000e-f0c6e00000ec:c0a00000-0e04-5ee3-000e-f0c6e00000ec", + "200e5e90-000e-4960-8dcd-8d00a02db000", + { filter: "properties/usageDate ge 2022-10-15 and properties/usageDate le 2022-10-18" }, )) { resArray.push(item); } + console.log(resArray); } async function main(): Promise { - savingsPlanUtilizationSummariesBillingProfile(); + await savingsPlanUtilizationSummariesBillingProfile(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/benefitUtilizationSummariesListBySavingsPlanIdSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/benefitUtilizationSummariesListBySavingsPlanIdSample.ts index ba8dcf03303b..9f99cdc708d2 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/benefitUtilizationSummariesListBySavingsPlanIdSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/benefitUtilizationSummariesListBySavingsPlanIdSample.ts @@ -1,37 +1,31 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists the savings plan utilization summaries for daily or monthly grain. + * This sample demonstrates how to lists the savings plan utilization summaries for daily or monthly grain. * - * @summary Lists the savings plan utilization summaries for daily or monthly grain. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanId-Monthly.json + * @summary lists the savings plan utilization summaries for daily or monthly grain. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanId-Monthly.json */ async function savingsPlanUtilizationSummariesMonthlyWithSavingsPlanId(): Promise { - const savingsPlanOrderId = "66cccc66-6ccc-6c66-666c-66cc6c6c66c6"; - const savingsPlanId = "222d22dd-d2d2-2dd2-222d-2dd2222ddddd"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.benefitUtilizationSummaries.listBySavingsPlanId( - savingsPlanOrderId, - savingsPlanId + for await (const item of client.benefitUtilizationSummaries.listBySavingsPlanId( + "66cccc66-6ccc-6c66-666c-66cc6c6c66c6", + "222d22dd-d2d2-2dd2-222d-2dd2222ddddd", )) { resArray.push(item); } + console.log(resArray); } async function main(): Promise { - savingsPlanUtilizationSummariesMonthlyWithSavingsPlanId(); + await savingsPlanUtilizationSummariesMonthlyWithSavingsPlanId(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/benefitUtilizationSummariesListBySavingsPlanOrderSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/benefitUtilizationSummariesListBySavingsPlanOrderSample.ts index f3f0582a0323..341a4a209acf 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/benefitUtilizationSummariesListBySavingsPlanOrderSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/benefitUtilizationSummariesListBySavingsPlanOrderSample.ts @@ -1,35 +1,30 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists the savings plan utilization summaries for daily or monthly grain. + * This sample demonstrates how to lists the savings plan utilization summaries for daily or monthly grain. * - * @summary Lists the savings plan utilization summaries for daily or monthly grain. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanOrderId-Daily.json + * @summary lists the savings plan utilization summaries for daily or monthly grain. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanOrderId-Daily.json */ async function savingsPlanUtilizationSummariesDaily(): Promise { - const savingsPlanOrderId = "66cccc66-6ccc-6c66-666c-66cc6c6c66c6"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.benefitUtilizationSummaries.listBySavingsPlanOrder( - savingsPlanOrderId + for await (const item of client.benefitUtilizationSummaries.listBySavingsPlanOrder( + "66cccc66-6ccc-6c66-666c-66cc6c6c66c6", )) { resArray.push(item); } + console.log(resArray); } async function main(): Promise { - savingsPlanUtilizationSummariesDaily(); + await savingsPlanUtilizationSummariesDaily(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/budgetsCreateOrUpdateSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/budgetsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..64d669ff4452 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/budgetsCreateOrUpdateSample.ts @@ -0,0 +1,448 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/Cost/CreateOrUpdate-Cost-Subscription-Budget.json + */ +async function createOrUpdateCostSubscriptionBudget(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "subscriptions/00000000-0000-0000-0000-000000000000", + "TestBudget", + { + eTag: '"1d34d016a593709"', + amount: 100.65, + category: "Cost", + filter: { + and: [ + { + dimensions: { + name: "ResourceId", + operator: "In", + values: [ + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/MSVM2", + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/platformcloudplatformGeneric1", + ], + }, + }, + { tags: { name: "category", operator: "In", values: ["Dev", "Prod"] } }, + { tags: { name: "department", operator: "In", values: ["engineering", "sales"] } }, + ], + }, + notifications: { + Actual_GreaterThan_80_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + contactGroups: [ + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/microsoft.insights/actionGroups/SampleActionGroup", + ], + contactRoles: ["Contributor", "Reader"], + enabled: true, + locale: "en-us", + operator: "GreaterThan", + threshold: 80, + thresholdType: "Actual", + }, + }, + timeGrain: "Monthly", + timePeriod: { + endDate: new Date("2024-10-31T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/EA/BillingAccountEA-AlertRule-ReservationIdFilter.json + */ +async function createOrUpdateReservationUtilizationBillingAccountEAAlertRuleReservationIdFilter(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: { + dimensions: { + name: "ReservationId", + operator: "In", + values: [ + "00000000-0000-0000-0000-000000000000", + "00000000-0000-0000-0000-000000000001", + "00000000-0000-0000-0000-000000000002", + ], + }, + }, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Weekly", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last7Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/EA/BillingAccountEA-AlertRule-ReservedResourceTypeFilter.json + */ +async function createOrUpdateReservationUtilizationBillingAccountEAAlertRuleReservedResourceTypeFilter(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: { + dimensions: { + name: "ReservedResourceType", + operator: "In", + values: ["VirtualMachines", "SqlDatabases", "CosmosDb"], + }, + }, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Weekly", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last7Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/EA/BillingAccountEA-AlertRule.json + */ +async function createOrUpdateReservationUtilizationBillingAccountEAAlertRule(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: {}, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Weekly", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last7Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/MCA/BillingProfile-AlertRule-ReservationIdFilter.json + */ +async function createOrUpdateReservationUtilizationBillingProfileMCAAlertRuleReservationIdFilter(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/KKKK-LLLL-MMM-NNN", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: { + dimensions: { + name: "ReservationId", + operator: "In", + values: [ + "00000000-0000-0000-0000-000000000000", + "00000000-0000-0000-0000-000000000001", + "00000000-0000-0000-0000-000000000002", + ], + }, + }, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Daily", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last30Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/MCA/BillingProfile-AlertRule-ReservedResourceTypeFilter.json + */ +async function createOrUpdateReservationUtilizationBillingProfileMCAAlertRuleReservedResourceTypeFilter(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/KKKK-LLLL-MMM-NNN", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: { + dimensions: { + name: "ReservedResourceType", + operator: "In", + values: ["VirtualMachines", "SqlDatabases", "CosmosDb"], + }, + }, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Daily", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last30Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/MCA/BillingProfile-AlertRule.json + */ +async function createOrUpdateReservationUtilizationBillingProfileMCAAlertRuleJson(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/KKKK-LLLL-MMM-NNN", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: {}, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Daily", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last30Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/MCA/Customer-AlertRule-ReservationIdFilter.json + */ +async function createOrUpdateReservationUtilizationCustomerCSPAlertRuleReservationIdFilter(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/customers/000000-1111-2222-3333-444444444444", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: { + dimensions: { + name: "ReservationId", + operator: "In", + values: [ + "00000000-0000-0000-0000-000000000000", + "00000000-0000-0000-0000-000000000001", + "00000000-0000-0000-0000-000000000002", + ], + }, + }, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Daily", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last30Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/MCA/Customer-AlertRule-ReservedResourceTypeFilter.json + */ +async function createOrUpdateReservationUtilizationCustomerCSPAlertRuleReservedResourceTypeFilter(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/customers/000000-1111-2222-3333-444444444444", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: { + dimensions: { + name: "ReservedResourceType", + operator: "In", + values: ["VirtualMachines", "SqlDatabases", "CosmosDb"], + }, + }, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Daily", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last30Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * + * @summary the operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + * x-ms-original-file: 2025-03-01/Budgets/CreateOrUpdate/ReservationUtilization/MCA/Customer-AlertRule.json + */ +async function createOrUpdateReservationUtilizationCustomerCSPAlertRuleJson(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/customers/000000-1111-2222-3333-444444444444", + "TestAlertRule", + { + eTag: '"1d34d016a593709"', + category: "ReservationUtilization", + filter: {}, + notifications: { + Actual_LessThan_99_Percent: { + contactEmails: ["johndoe@contoso.com", "janesmith@contoso.com"], + enabled: true, + frequency: "Daily", + locale: "en-us", + operator: "LessThan", + threshold: 99, + }, + }, + timeGrain: "Last30Days", + timePeriod: { + endDate: new Date("2025-04-01T00:00:00Z"), + startDate: new Date("2023-04-01T00:00:00Z"), + }, + }, + ); + console.log(result); +} + +async function main(): Promise { + await createOrUpdateCostSubscriptionBudget(); + await createOrUpdateReservationUtilizationBillingAccountEAAlertRuleReservationIdFilter(); + await createOrUpdateReservationUtilizationBillingAccountEAAlertRuleReservedResourceTypeFilter(); + await createOrUpdateReservationUtilizationBillingAccountEAAlertRule(); + await createOrUpdateReservationUtilizationBillingProfileMCAAlertRuleReservationIdFilter(); + await createOrUpdateReservationUtilizationBillingProfileMCAAlertRuleReservedResourceTypeFilter(); + await createOrUpdateReservationUtilizationBillingProfileMCAAlertRuleJson(); + await createOrUpdateReservationUtilizationCustomerCSPAlertRuleReservationIdFilter(); + await createOrUpdateReservationUtilizationCustomerCSPAlertRuleReservedResourceTypeFilter(); + await createOrUpdateReservationUtilizationCustomerCSPAlertRuleJson(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/budgetsDeleteSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/budgetsDeleteSample.ts new file mode 100644 index 000000000000..4af444432dee --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/budgetsDeleteSample.ts @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to the operation to delete a budget. + * + * @summary the operation to delete a budget. + * x-ms-original-file: 2025-03-01/Budgets/Delete/DeleteBudget.json + */ +async function deleteBudget(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + await client.budgets.delete("subscriptions/00000000-0000-0000-0000-000000000000", "TestBudget"); +} + +async function main(): Promise { + await deleteBudget(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/budgetsGetSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/budgetsGetSample.ts new file mode 100644 index 000000000000..99ea5931b095 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/budgetsGetSample.ts @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets the budget for the scope by budget name. + * + * @summary gets the budget for the scope by budget name. + * x-ms-original-file: 2025-03-01/Budgets/Get/Cost/Get-Cost-Budget.json + */ +async function getCostBudget(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.get( + "subscriptions/00000000-0000-0000-0000-000000000000", + "TestBudget", + ); + console.log(result); +} + +/** + * This sample demonstrates how to gets the budget for the scope by budget name. + * + * @summary gets the budget for the scope by budget name. + * x-ms-original-file: 2025-03-01/Budgets/Get/ReservationUtilization/Get-ReservationUtilization-AlertRule.json + */ +async function getReservationUtilizationAlertRule(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.budgets.get( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/KKKK-LLLL-MMM-NNN", + "TestAlertRule", + ); + console.log(result); +} + +async function main(): Promise { + await getCostBudget(); + await getReservationUtilizationAlertRule(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/budgetsListSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/budgetsListSample.ts new file mode 100644 index 000000000000..c86fb9aedf21 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/budgetsListSample.ts @@ -0,0 +1,294 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/EA/BillingAccountBudgetsList-EA-CategoryTypeFilter.json + */ +async function billingAccountBudgetsListEACategoryTypeFilter(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/123456", + { filter: "properties/category eq 'ReservationUtilization'" }, + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/EA/BillingAccountBudgetsList-EA.json + */ +async function billingAccountBudgetsListEA(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/123456", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/EA/DepartmentBudgetsList.json + */ +async function departmentBudgetsListEA(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/123456/departments/789101", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/EA/EnrollmentAccountBudgetsList.json + */ +async function enrollmentAccountBudgetsListEA(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/123456/enrollmentAccounts/473845", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/MCA/BillingAccountBudgetsList-MCA-CategoryTypeFilter.json + */ +async function billingAccountBudgetsListMCACategoryTypeFilter(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01", + { filter: "properties/category eq 'ReservationUtilization'" }, + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/MCA/BillingAccountBudgetsList-MCA.json + */ +async function billingAccountBudgetsListMCA(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/MCA/BillingProfileBudgetsList-CategoryTypeFilter.json + */ +async function billingProfileBudgetsListMCACategoryTypeFilter(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/MYDEVTESTBP", + { filter: "properties/category eq 'ReservationUtilization'" }, + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/MCA/BillingProfileBudgetsList.json + */ +async function billingProfileBudgetsListMCA(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/MYDEVTESTBP", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/MCA/CustomerBudgetsList-CategoryTypeFilter.json + */ +async function customerBudgetsListMCACSPCategoryTypeFilter(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/customers/000000-1111-2222-3333-444444444444", + { filter: "properties/category eq 'ReservationUtilization'" }, + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/MCA/CustomerBudgetsList.json + */ +async function customerBudgetsListMCACSP(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/customers/000000-1111-2222-3333-444444444444", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/MCA/InvoiceSectionBudgetsList.json + */ +async function invoiceSectionBudgetsListMCA(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/MYDEVTESTBP/invoiceSections/AAAA-BBBB-CCC-DDD", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/RBAC/ManagementGroupBudgetsList.json + */ +async function managementGroupBudgetsList(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "Microsoft.Management/managementGroups/MYDEVTESTMG", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/RBAC/ResourceGroupBudgetsList.json + */ +async function resourceGroupBudgetsList(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists all budgets for the defined scope. + * + * @summary lists all budgets for the defined scope. + * x-ms-original-file: 2025-03-01/Budgets/List/RBAC/SubscriptionBudgetsList.json + */ +async function subscriptionBudgetsList(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.budgets.list( + "subscriptions/00000000-0000-0000-0000-000000000000", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await billingAccountBudgetsListEACategoryTypeFilter(); + await billingAccountBudgetsListEA(); + await departmentBudgetsListEA(); + await enrollmentAccountBudgetsListEA(); + await billingAccountBudgetsListMCACategoryTypeFilter(); + await billingAccountBudgetsListMCA(); + await billingProfileBudgetsListMCACategoryTypeFilter(); + await billingProfileBudgetsListMCA(); + await customerBudgetsListMCACSPCategoryTypeFilter(); + await customerBudgetsListMCACSP(); + await invoiceSectionBudgetsListMCA(); + await managementGroupBudgetsList(); + await resourceGroupBudgetsList(); + await subscriptionBudgetsList(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/costAllocationRulesCheckNameAvailabilitySample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/costAllocationRulesCheckNameAvailabilitySample.ts new file mode 100644 index 000000000000..2d1ea22a11f4 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/costAllocationRulesCheckNameAvailabilitySample.ts @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to checks availability and correctness of a name for a cost allocation rule + * + * @summary checks availability and correctness of a name for a cost allocation rule + * x-ms-original-file: 2025-03-01/CostAllocationRuleCheckNameAvailability.json + */ +async function costAllocationRuleCheckNameAvailability(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.costAllocationRules.checkNameAvailability("100", { + name: "testRule", + type: "Microsoft.CostManagement/costAllocationRules", + }); + console.log(result); +} + +async function main(): Promise { + await costAllocationRuleCheckNameAvailability(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/costAllocationRulesCreateOrUpdateSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/costAllocationRulesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..0882c11621f7 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/costAllocationRulesCreateOrUpdateSample.ts @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment. + * + * @summary create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment. + * x-ms-original-file: 2025-03-01/CostAllocationRuleCreate.json + */ +async function costAllocationRulesCreateResourceGroup(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.costAllocationRules.createOrUpdate("100", "testRule", { + properties: { + description: "This is a testRule", + status: "Active", + details: { + sourceResources: [ + { + name: "ResourceGroupName", + resourceType: "Dimension", + values: ["sampleRG", "secondRG"], + }, + ], + targetResources: [ + { + name: "ResourceGroupName", + policyType: "FixedProportion", + resourceType: "Dimension", + values: [ + { name: "destinationRG", percentage: 45 }, + { name: "destinationRG2", percentage: 54 }, + ], + }, + ], + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment. + * + * @summary create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment. + * x-ms-original-file: 2025-03-01/CostAllocationRuleCreateTag.json + */ +async function costAllocationRulesCreateTag(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.costAllocationRules.createOrUpdate("100", "testRule", { + properties: { + description: "This is a testRule", + status: "Active", + details: { + sourceResources: [{ name: "category", resourceType: "Tag", values: ["devops"] }], + targetResources: [ + { + name: "ResourceGroupName", + policyType: "FixedProportion", + resourceType: "Dimension", + values: [ + { name: "destinationRG", percentage: 33.33 }, + { name: "destinationRG2", percentage: 33.33 }, + { name: "destinationRG3", percentage: 33.34 }, + ], + }, + ], + }, + }, + }); + console.log(result); +} + +async function main(): Promise { + await costAllocationRulesCreateResourceGroup(); + await costAllocationRulesCreateTag(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/costAllocationRulesDeleteSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/costAllocationRulesDeleteSample.ts new file mode 100644 index 000000000000..e401589fd3c8 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/costAllocationRulesDeleteSample.ts @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete cost allocation rule for billing account or enterprise enrollment. + * + * @summary delete cost allocation rule for billing account or enterprise enrollment. + * x-ms-original-file: 2025-03-01/CostAllocationRuleDelete.json + */ +async function deleteCostAllocationRule(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + await client.costAllocationRules.delete("100", "testRule"); +} + +async function main(): Promise { + await deleteCostAllocationRule(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/costAllocationRulesGetSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/costAllocationRulesGetSample.ts new file mode 100644 index 000000000000..cd0f33b02c4f --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/costAllocationRulesGetSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a cost allocation rule by rule name and billing account or enterprise enrollment. + * + * @summary get a cost allocation rule by rule name and billing account or enterprise enrollment. + * x-ms-original-file: 2025-03-01/CostAllocationRuleGet.json + */ +async function costAllocationRules(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.costAllocationRules.get("100", "testRule"); + console.log(result); +} + +async function main(): Promise { + await costAllocationRules(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/costAllocationRulesListSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/costAllocationRulesListSample.ts new file mode 100644 index 000000000000..788d7777128f --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/costAllocationRulesListSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get the list of all cost allocation rules for a billing account or enterprise enrollment. + * + * @summary get the list of all cost allocation rules for a billing account or enterprise enrollment. + * x-ms-original-file: 2025-03-01/CostAllocationRulesList.json + */ +async function costAllocationRulesList(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.costAllocationRules.list("100")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await costAllocationRulesList(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/dimensionsByExternalCloudProviderTypeSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/dimensionsByExternalCloudProviderTypeSample.ts deleted file mode 100644 index 071480b0d338..000000000000 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/dimensionsByExternalCloudProviderTypeSample.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { CostManagementClient } from "@azure/arm-costmanagement"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Lists the dimensions by the external cloud provider type. - * - * @summary Lists the dimensions by the external cloud provider type. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalBillingAccountsDimensions.json - */ -async function externalBillingAccountDimensionList(): Promise { - const externalCloudProviderType = "externalBillingAccounts"; - const externalCloudProviderId = "100"; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const resArray = new Array(); - for await (let item of client.dimensions.listByExternalCloudProviderType( - externalCloudProviderType, - externalCloudProviderId - )) { - resArray.push(item); - } - console.log(resArray); -} - -/** - * This sample demonstrates how to Lists the dimensions by the external cloud provider type. - * - * @summary Lists the dimensions by the external cloud provider type. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalSubscriptionsDimensions.json - */ -async function externalSubscriptionDimensionList(): Promise { - const externalCloudProviderType = "externalSubscriptions"; - const externalCloudProviderId = "100"; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const resArray = new Array(); - for await (let item of client.dimensions.listByExternalCloudProviderType( - externalCloudProviderType, - externalCloudProviderId - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - externalBillingAccountDimensionList(); - externalSubscriptionDimensionList(); -} - -main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/dimensionsListByExternalCloudProviderTypeSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/dimensionsListByExternalCloudProviderTypeSample.ts new file mode 100644 index 000000000000..e9283372526c --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/dimensionsListByExternalCloudProviderTypeSample.ts @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists the dimensions by the external cloud provider type. + * + * @summary lists the dimensions by the external cloud provider type. + * x-ms-original-file: 2025-03-01/ExternalBillingAccountsDimensions.json + */ +async function externalBillingAccountDimensionList(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.dimensions.listByExternalCloudProviderType( + "externalBillingAccounts", + "100", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists the dimensions by the external cloud provider type. + * + * @summary lists the dimensions by the external cloud provider type. + * x-ms-original-file: 2025-03-01/ExternalSubscriptionsDimensions.json + */ +async function externalSubscriptionDimensionList(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const resArray = new Array(); + for await (const item of client.dimensions.listByExternalCloudProviderType( + "externalSubscriptions", + "100", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await externalBillingAccountDimensionList(); + await externalSubscriptionDimensionList(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/dimensionsListSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/dimensionsListSample.ts index 722b9f6f8f9b..2292fe52c313 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/dimensionsListSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/dimensionsListSample.ts @@ -1,564 +1,548 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { - DimensionsListOptionalParams, - CostManagementClient -} from "@azure/arm-costmanagement"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/BillingAccountDimensionsList.json */ async function billingAccountDimensionsListLegacy(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/100"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingAccountDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/BillingAccountDimensionsListExpandAndTop.json */ -async function billingAccountDimensionsListMca(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789"; +async function billingAccountDimensionsListExpandAndTopLegacy(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountDimensionsListExpandAndTop.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/BillingAccountDimensionsListWithFilter.json */ -async function billingAccountDimensionsListExpandAndTopLegacy(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/100"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { expand, top }; +async function billingAccountDimensionsListWithFilterLegacy(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100", + { filter: "properties/category eq 'resourceId'", expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingAccountDimensionsListExpandAndTop.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/DepartmentDimensionsList.json */ -async function billingAccountDimensionsListExpandAndTopMca(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { expand, top }; +async function departmentDimensionsListLegacy(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100/departments/123", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountDimensionsListWithFilter.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/DepartmentDimensionsListExpandAndTop.json */ -async function billingAccountDimensionsListWithFilterLegacy(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/100"; - const filter = "properties/category eq 'resourceId'"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { filter, expand, top }; +async function departmentDimensionsListExpandAndTopLegacy(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100/departments/123", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingAccountDimensionsListWithFilter.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/DepartmentDimensionsListWithFilter.json */ -async function billingAccountDimensionsListWithFilterMca(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789"; - const filter = "properties/category eq 'resourceId'"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { filter, expand, top }; +async function departmentDimensionsListWithFilterLegacy(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100/departments/123", + { filter: "properties/category eq 'resourceId'", expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingProfileDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/EnrollmentAccountDimensionsList.json */ -async function billingProfileDimensionsListMca(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; +async function enrollmentAccountDimensionsListLegacy(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingProfileDimensionsListExpandAndTop.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/EnrollmentAccountDimensionsListExpandAndTop.json */ -async function billingProfileDimensionsListExpandAndTopMca(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { expand, top }; +async function enrollmentAccountDimensionsListExpandAndTopLegacy(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingProfileDimensionsListWithFilter.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/EnrollmentAccountDimensionsListWithFilter.json */ -async function billingProfileDimensionsListWithFilterMca(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; - const filter = "properties/category eq 'resourceId'"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { filter, expand, top }; +async function enrollmentAccountDimensionsListWithFilterLegacy(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + { filter: "properties/category eq 'resourceId'", expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCACustomerDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCABillingAccountDimensionsList.json */ -async function customerDimensionsListMca(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"; +async function billingAccountDimensionsListMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCACustomerDimensionsListExpandAndTop.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCABillingAccountDimensionsListExpandAndTop.json */ -async function customerDimensionsListExpandAndTopMca(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { expand, top }; +async function billingAccountDimensionsListExpandAndTopMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCACustomerDimensionsListWithFilter.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCABillingAccountDimensionsListWithFilter.json */ -async function customerDimensionsListWithFilterMca(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"; - const filter = "properties/category eq 'resourceId'"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { filter, expand, top }; +async function billingAccountDimensionsListWithFilterMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789", + { filter: "properties/category eq 'resourceId'", expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCABillingProfileDimensionsList.json */ -async function departmentDimensionsListLegacy(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/100/departments/123"; +async function billingProfileDimensionsListMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentDimensionsListExpandAndTop.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCABillingProfileDimensionsListExpandAndTop.json */ -async function departmentDimensionsListExpandAndTopLegacy(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/100/departments/123"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { expand, top }; +async function billingProfileDimensionsListExpandAndTopMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentDimensionsListWithFilter.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCABillingProfileDimensionsListWithFilter.json */ -async function departmentDimensionsListWithFilterLegacy(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/100/departments/123"; - const filter = "properties/category eq 'resourceId'"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { filter, expand, top }; +async function billingProfileDimensionsListWithFilterMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + { filter: "properties/category eq 'resourceId'", expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCACustomerDimensionsList.json */ -async function enrollmentAccountDimensionsListLegacy(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; +async function customerDimensionsListMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountDimensionsListExpandAndTop.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCACustomerDimensionsListExpandAndTop.json */ -async function enrollmentAccountDimensionsListExpandAndTopLegacy(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { expand, top }; +async function customerDimensionsListExpandAndTopMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountDimensionsListWithFilter.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCACustomerDimensionsListWithFilter.json */ -async function enrollmentAccountDimensionsListWithFilterLegacy(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const filter = "properties/category eq 'resourceId'"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { filter, expand, top }; +async function customerDimensionsListWithFilterMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", + { filter: "properties/category eq 'resourceId'", expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCAInvoiceSectionDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCAInvoiceSectionDimensionsList.json */ -async function invoiceSectionDimensionsListMca(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876"; +async function invoiceSectionDimensionsListMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCAInvoiceSectionDimensionsListExpandAndTop.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCAInvoiceSectionDimensionsListExpandAndTop.json */ -async function invoiceSectionDimensionsListExpandAndTopMca(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { expand, top }; +async function invoiceSectionDimensionsListExpandAndTopMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCAInvoiceSectionDimensionsListWithFilter.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/MCAInvoiceSectionDimensionsListWithFilter.json */ -async function invoiceSectionDimensionsListWithFilterMca(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876"; - const filter = "properties/category eq 'resourceId'"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { filter, expand, top }; +async function invoiceSectionDimensionsListWithFilterMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", + { filter: "properties/category eq 'resourceId'", expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ManagementGroupDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/ManagementGroupDimensionsList.json */ async function managementGroupDimensionsListLegacy(): Promise { - const scope = "providers/Microsoft.Management/managementGroups/MyMgId"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Management/managementGroups/MyMgId", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ManagementGroupDimensionsListExpandAndTop.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/ManagementGroupDimensionsListExpandAndTop.json */ async function managementGroupDimensionsListExpandAndTopLegacy(): Promise { - const scope = "providers/Microsoft.Management/managementGroups/MyMgId"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { expand, top }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Management/managementGroups/MyMgId", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ManagementGroupDimensionsListWithFilter.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/ManagementGroupDimensionsListWithFilter.json */ async function managementGroupDimensionsListWithFilterLegacy(): Promise { - const scope = "providers/Microsoft.Management/managementGroups/MyMgId"; - const filter = "properties/category eq 'resourceId'"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { filter, expand, top }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "providers/Microsoft.Management/managementGroups/MyMgId", + { filter: "properties/category eq 'resourceId'", expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ResourceGroupDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/ResourceGroupDimensionsList.json */ async function resourceGroupDimensionsListLegacy(): Promise { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/system.orlando"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { expand, top }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/system.orlando", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists the dimensions by the defined scope. + * This sample demonstrates how to lists the dimensions by the defined scope. * - * @summary Lists the dimensions by the defined scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SubscriptionDimensionsList.json + * @summary lists the dimensions by the defined scope. + * x-ms-original-file: 2025-03-01/SubscriptionDimensionsList.json */ async function subscriptionDimensionsListLegacy(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const expand = "properties/data"; - const top = 5; - const options: DimensionsListOptionalParams = { expand, top }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.dimensions.list(scope, options)) { + for await (const item of client.dimensions.list( + "subscriptions/00000000-0000-0000-0000-000000000000", + { expand: "properties/data", top: 5 }, + )) { resArray.push(item); } + console.log(resArray); } async function main(): Promise { - billingAccountDimensionsListLegacy(); - billingAccountDimensionsListMca(); - billingAccountDimensionsListExpandAndTopLegacy(); - billingAccountDimensionsListExpandAndTopMca(); - billingAccountDimensionsListWithFilterLegacy(); - billingAccountDimensionsListWithFilterMca(); - billingProfileDimensionsListMca(); - billingProfileDimensionsListExpandAndTopMca(); - billingProfileDimensionsListWithFilterMca(); - customerDimensionsListMca(); - customerDimensionsListExpandAndTopMca(); - customerDimensionsListWithFilterMca(); - departmentDimensionsListLegacy(); - departmentDimensionsListExpandAndTopLegacy(); - departmentDimensionsListWithFilterLegacy(); - enrollmentAccountDimensionsListLegacy(); - enrollmentAccountDimensionsListExpandAndTopLegacy(); - enrollmentAccountDimensionsListWithFilterLegacy(); - invoiceSectionDimensionsListMca(); - invoiceSectionDimensionsListExpandAndTopMca(); - invoiceSectionDimensionsListWithFilterMca(); - managementGroupDimensionsListLegacy(); - managementGroupDimensionsListExpandAndTopLegacy(); - managementGroupDimensionsListWithFilterLegacy(); - resourceGroupDimensionsListLegacy(); - subscriptionDimensionsListLegacy(); + await billingAccountDimensionsListLegacy(); + await billingAccountDimensionsListExpandAndTopLegacy(); + await billingAccountDimensionsListWithFilterLegacy(); + await departmentDimensionsListLegacy(); + await departmentDimensionsListExpandAndTopLegacy(); + await departmentDimensionsListWithFilterLegacy(); + await enrollmentAccountDimensionsListLegacy(); + await enrollmentAccountDimensionsListExpandAndTopLegacy(); + await enrollmentAccountDimensionsListWithFilterLegacy(); + await billingAccountDimensionsListMCA(); + await billingAccountDimensionsListExpandAndTopMCA(); + await billingAccountDimensionsListWithFilterMCA(); + await billingProfileDimensionsListMCA(); + await billingProfileDimensionsListExpandAndTopMCA(); + await billingProfileDimensionsListWithFilterMCA(); + await customerDimensionsListMCA(); + await customerDimensionsListExpandAndTopMCA(); + await customerDimensionsListWithFilterMCA(); + await invoiceSectionDimensionsListMCA(); + await invoiceSectionDimensionsListExpandAndTopMCA(); + await invoiceSectionDimensionsListWithFilterMCA(); + await managementGroupDimensionsListLegacy(); + await managementGroupDimensionsListExpandAndTopLegacy(); + await managementGroupDimensionsListWithFilterLegacy(); + await resourceGroupDimensionsListLegacy(); + await subscriptionDimensionsListLegacy(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsCreateOrUpdateSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsCreateOrUpdateSample.ts index eb8eee1f697c..0d664de6e29f 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsCreateOrUpdateSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsCreateOrUpdateSample.ts @@ -1,348 +1,592 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { Export, CostManagementClient } from "@azure/arm-costmanagement"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateByBillingAccount.json + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByBillingAccount.json */ async function exportCreateOrUpdateByBillingAccount(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/123456"; - const exportName = "TestExport"; - const parameters: Export = { - format: "Csv", - definition: { - type: "ActualCost", - dataSet: { - configuration: { - columns: [ - "Date", - "MeterId", - "ResourceId", - "ResourceLocation", - "Quantity" - ] + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ActualCost", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timeframe: "MonthToDate", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", }, - granularity: "Daily" }, - timeframe: "MonthToDate" - }, - deliveryInfo: { - destination: { - container: "exports", - resourceId: - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", - rootFolderPath: "ad-hoc" - } + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2020-06-01T00:00:00Z"), + to: new Date("2020-06-30T00:00:00Z"), + }, + status: "Active", + }, }, - schedule: { - recurrence: "Weekly", - recurrencePeriod: { - from: new Date("2020-06-01T00:00:00Z"), - to: new Date("2020-10-31T00:00:00Z") - }, - status: "Active" - } - }; + ); + console.log(result); +} + +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByBillingAccountCustom.json + */ +async function exportCreateOrUpdateByBillingAccountCustom(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const result = await client.exports.createOrUpdate( - scope, - exportName, - parameters + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ActualCost", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timePeriod: { + from: new Date("2025-04-03T00:00:00.000Z"), + to: new Date("2025-04-03T00:00:00.000Z"), + }, + timeframe: "Custom", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, + }, + exportDescription: "This is a test export.", + partitionData: true, + schedule: { status: "Inactive" }, + }, ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateByDepartment.json + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByBillingAccountMonthly.json */ -async function exportCreateOrUpdateByDepartment(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12/departments/1234"; - const exportName = "TestExport"; - const parameters: Export = { - format: "Csv", - definition: { - type: "ActualCost", - dataSet: { - configuration: { - columns: [ - "Date", - "MeterId", - "ResourceId", - "ResourceLocation", - "Quantity" - ] +async function exportCreateOrUpdateByBillingAccountMonthly(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ActualCost", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timeframe: "TheLastMonth", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", }, - granularity: "Daily" }, - timeframe: "MonthToDate" - }, - deliveryInfo: { - destination: { - container: "exports", - resourceId: - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", - rootFolderPath: "ad-hoc" - } + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Monthly", + recurrencePeriod: { + from: new Date("2020-06-05T00:00:00Z"), + to: new Date("2030-06-30T00:00:00Z"), + }, + status: "Active", + }, }, - schedule: { - recurrence: "Weekly", - recurrencePeriod: { - from: new Date("2020-06-01T00:00:00Z"), - to: new Date("2020-10-31T00:00:00Z") - }, - status: "Active" - } - }; + ); + console.log(result); +} + +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByBillingAccountPricesheet.json + */ +async function exportCreateOrUpdateByBillingAccountPricesheet(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const result = await client.exports.createOrUpdate( - scope, - exportName, - parameters + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "PriceSheet", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timeframe: "TheCurrentMonth", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, + }, + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2023-06-01T00:00:00Z"), + to: new Date("2023-06-30T00:00:00Z"), + }, + status: "Active", + }, + }, ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateByEnrollmentAccount.json + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByBillingAccountReservationDetails.json */ -async function exportCreateOrUpdateByEnrollmentAccount(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const exportName = "TestExport"; - const parameters: Export = { - format: "Csv", - definition: { - type: "ActualCost", - dataSet: { - configuration: { - columns: [ - "Date", - "MeterId", - "ResourceId", - "ResourceLocation", - "Quantity" - ] +async function exportCreateOrUpdateByBillingAccountReservationDetails(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ReservationDetails", + dataSet: { configuration: { dataVersion: "2023-03-01" }, granularity: "Daily" }, + timeframe: "MonthToDate", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", }, - granularity: "Daily" }, - timeframe: "MonthToDate" - }, - deliveryInfo: { - destination: { - container: "exports", - resourceId: - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", - rootFolderPath: "ad-hoc" - } + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2023-06-01T00:00:00Z"), + to: new Date("2023-06-30T00:00:00Z"), + }, + status: "Active", + }, }, - schedule: { - recurrence: "Weekly", - recurrencePeriod: { - from: new Date("2020-06-01T00:00:00Z"), - to: new Date("2020-10-31T00:00:00Z") - }, - status: "Active" - } - }; + ); + console.log(result); +} + +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByBillingAccountReservationRecommendation.json + */ +async function exportCreateOrUpdateByBillingAccountReservationRecommendation(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const result = await client.exports.createOrUpdate( - scope, - exportName, - parameters + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ReservationRecommendations", + dataSet: { + configuration: { + dataVersion: "2023-05-01", + filters: [ + { name: "ReservationScope", value: "Single" }, + { name: "ResourceType", value: "VirtualMachines" }, + { name: "LookBackPeriod", value: "Last7Days" }, + ], + }, + }, + timeframe: "MonthToDate", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, + }, + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2023-06-01T00:00:00Z"), + to: new Date("2023-06-30T00:00:00Z"), + }, + status: "Active", + }, + }, ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateByManagementGroup.json + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByBillingAccountReservationTransactions.json */ -async function exportCreateOrUpdateByManagementGroup(): Promise { - const scope = "providers/Microsoft.Management/managementGroups/TestMG"; - const exportName = "TestExport"; - const parameters: Export = { - format: "Csv", - definition: { - type: "ActualCost", - dataSet: { - configuration: { - columns: [ - "Date", - "MeterId", - "ResourceId", - "ResourceLocation", - "Quantity" - ] +async function exportCreateOrUpdateExportCreateOrUpdateByBillingAccountReservationTransactionsByBillingAccount(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ReservationTransactions", + dataSet: { configuration: { dataVersion: "2023-05-01" } }, + timeframe: "MonthToDate", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", }, - granularity: "Daily" }, - timeframe: "MonthToDate" - }, - deliveryInfo: { - destination: { - container: "exports", - resourceId: - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", - rootFolderPath: "ad-hoc" - } + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2023-06-01T00:00:00Z"), + to: new Date("2023-06-30T00:00:00Z"), + }, + status: "Active", + }, }, - schedule: { - recurrence: "Weekly", - recurrencePeriod: { - from: new Date("2020-06-01T00:00:00Z"), - to: new Date("2020-10-31T00:00:00Z") - }, - status: "Active" - } - }; + ); + console.log(result); +} + +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByDepartment.json + */ +async function exportCreateOrUpdateByDepartment(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const result = await client.exports.createOrUpdate( - scope, - exportName, - parameters + "providers/Microsoft.Billing/billingAccounts/12/departments/1234", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Parquet", + compressionMode: "snappy", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ActualCost", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timeframe: "MonthToDate", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, + }, + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2020-06-01T00:00:00Z"), + to: new Date("2020-06-30T00:00:00Z"), + }, + status: "Active", + }, + }, ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateByResourceGroup.json + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByEnrollmentAccount.json */ -async function exportCreateOrUpdateByResourceGroup(): Promise { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; - const exportName = "TestExport"; - const parameters: Export = { - format: "Csv", - definition: { - type: "ActualCost", - dataSet: { - configuration: { - columns: [ - "Date", - "MeterId", - "ResourceId", - "ResourceLocation", - "Quantity" - ] +async function exportCreateOrUpdateByEnrollmentAccount(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.exports.createOrUpdate( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ActualCost", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timeframe: "MonthToDate", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", }, - granularity: "Daily" }, - timeframe: "MonthToDate" - }, - deliveryInfo: { - destination: { - container: "exports", - resourceId: - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", - rootFolderPath: "ad-hoc" - } + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2020-06-01T00:00:00Z"), + to: new Date("2020-06-30T00:00:00Z"), + }, + status: "Active", + }, }, - schedule: { - recurrence: "Weekly", - recurrencePeriod: { - from: new Date("2020-06-01T00:00:00Z"), - to: new Date("2020-10-31T00:00:00Z") - }, - status: "Active" - } - }; + ); + console.log(result); +} + +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByManagementGroup.json + */ +async function exportCreateOrUpdateByManagementGroup(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const result = await client.exports.createOrUpdate( - scope, - exportName, - parameters + "providers/Microsoft.Management/managementGroups/TestMG", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ActualCost", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timeframe: "MonthToDate", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, + }, + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2020-06-01T00:00:00Z"), + to: new Date("2020-06-30T00:00:00Z"), + }, + status: "Active", + }, + }, ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateBySubscription.json + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateByResourceGroup.json */ -async function exportCreateOrUpdateBySubscription(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const exportName = "TestExport"; - const parameters: Export = { - format: "Csv", - definition: { - type: "ActualCost", - dataSet: { - configuration: { - columns: [ - "Date", - "MeterId", - "ResourceId", - "ResourceLocation", - "Quantity" - ] +async function exportCreateOrUpdateByResourceGroup(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.exports.createOrUpdate( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ActualCost", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timeframe: "MonthToDate", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", }, - granularity: "Daily" }, - timeframe: "MonthToDate" - }, - deliveryInfo: { - destination: { - container: "exports", - resourceId: - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", - rootFolderPath: "ad-hoc" - } + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2020-06-01T00:00:00Z"), + to: new Date("2020-06-30T00:00:00Z"), + }, + status: "Active", + }, }, - schedule: { - recurrence: "Weekly", - recurrencePeriod: { - from: new Date("2020-06-01T00:00:00Z"), - to: new Date("2020-10-31T00:00:00Z") - }, - status: "Active" - } - }; + ); + console.log(result); +} + +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/ExportCreateOrUpdateBySubscription.json + */ +async function exportCreateOrUpdateBySubscription(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const result = await client.exports.createOrUpdate( - scope, - exportName, - parameters + "subscriptions/00000000-0000-0000-0000-000000000000", + "TestExport", + { + identity: { type: "SystemAssigned" }, + location: "centralus", + format: "Csv", + compressionMode: "gzip", + dataOverwriteBehavior: "OverwritePreviousReport", + definition: { + type: "ActualCost", + dataSet: { configuration: { dataVersion: "2023-05-01" }, granularity: "Daily" }, + timeframe: "MonthToDate", + }, + deliveryInfo: { + destination: { + type: "AzureBlob", + container: "exports", + resourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182", + rootFolderPath: "ad-hoc", + }, + }, + exportDescription: "This is a test export.", + partitionData: true, + schedule: { + recurrence: "Daily", + recurrencePeriod: { + from: new Date("2020-06-01T00:00:00Z"), + to: new Date("2020-06-30T00:00:00Z"), + }, + status: "Active", + }, + }, ); console.log(result); } async function main(): Promise { - exportCreateOrUpdateByBillingAccount(); - exportCreateOrUpdateByDepartment(); - exportCreateOrUpdateByEnrollmentAccount(); - exportCreateOrUpdateByManagementGroup(); - exportCreateOrUpdateByResourceGroup(); - exportCreateOrUpdateBySubscription(); + await exportCreateOrUpdateByBillingAccount(); + await exportCreateOrUpdateByBillingAccountCustom(); + await exportCreateOrUpdateByBillingAccountMonthly(); + await exportCreateOrUpdateByBillingAccountPricesheet(); + await exportCreateOrUpdateByBillingAccountReservationDetails(); + await exportCreateOrUpdateByBillingAccountReservationRecommendation(); + await exportCreateOrUpdateExportCreateOrUpdateByBillingAccountReservationTransactionsByBillingAccount(); + await exportCreateOrUpdateByDepartment(); + await exportCreateOrUpdateByEnrollmentAccount(); + await exportCreateOrUpdateByManagementGroup(); + await exportCreateOrUpdateByResourceGroup(); + await exportCreateOrUpdateBySubscription(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsDeleteSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsDeleteSample.ts index 9becff4a28c6..24348b04694a 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsDeleteSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsDeleteSample.ts @@ -1,114 +1,100 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to The operation to delete a export. + * This sample demonstrates how to the operation to delete a export. * - * @summary The operation to delete a export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteByBillingAccount.json + * @summary the operation to delete a export. + * x-ms-original-file: 2025-03-01/ExportDeleteByBillingAccount.json */ async function exportDeleteByBillingAccount(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/123456"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.delete(scope, exportName); - console.log(result); + await client.exports.delete("providers/Microsoft.Billing/billingAccounts/123456", "TestExport"); } /** - * This sample demonstrates how to The operation to delete a export. + * This sample demonstrates how to the operation to delete a export. * - * @summary The operation to delete a export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteByDepartment.json + * @summary the operation to delete a export. + * x-ms-original-file: 2025-03-01/ExportDeleteByDepartment.json */ async function exportDeleteByDepartment(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12/departments/1234"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.delete(scope, exportName); - console.log(result); + await client.exports.delete( + "providers/Microsoft.Billing/billingAccounts/12/departments/1234", + "TestExport", + ); } /** - * This sample demonstrates how to The operation to delete a export. + * This sample demonstrates how to the operation to delete a export. * - * @summary The operation to delete a export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteByEnrollmentAccount.json + * @summary the operation to delete a export. + * x-ms-original-file: 2025-03-01/ExportDeleteByEnrollmentAccount.json */ async function exportDeleteByEnrollmentAccount(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.delete(scope, exportName); - console.log(result); + await client.exports.delete( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + "TestExport", + ); } /** - * This sample demonstrates how to The operation to delete a export. + * This sample demonstrates how to the operation to delete a export. * - * @summary The operation to delete a export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteByManagementGroup.json + * @summary the operation to delete a export. + * x-ms-original-file: 2025-03-01/ExportDeleteByManagementGroup.json */ async function exportDeleteByManagementGroup(): Promise { - const scope = "providers/Microsoft.Management/managementGroups/TestMG"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.delete(scope, exportName); - console.log(result); + await client.exports.delete( + "providers/Microsoft.Management/managementGroups/TestMG", + "TestExport", + ); } /** - * This sample demonstrates how to The operation to delete a export. + * This sample demonstrates how to the operation to delete a export. * - * @summary The operation to delete a export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteByResourceGroup.json + * @summary the operation to delete a export. + * x-ms-original-file: 2025-03-01/ExportDeleteByResourceGroup.json */ async function exportDeleteByResourceGroup(): Promise { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.delete(scope, exportName); - console.log(result); + await client.exports.delete( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + "TestExport", + ); } /** - * This sample demonstrates how to The operation to delete a export. + * This sample demonstrates how to the operation to delete a export. * - * @summary The operation to delete a export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteBySubscription.json + * @summary the operation to delete a export. + * x-ms-original-file: 2025-03-01/ExportDeleteBySubscription.json */ async function exportDeleteBySubscription(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.delete(scope, exportName); - console.log(result); + await client.exports.delete("subscriptions/00000000-0000-0000-0000-000000000000", "TestExport"); } async function main(): Promise { - exportDeleteByBillingAccount(); - exportDeleteByDepartment(); - exportDeleteByEnrollmentAccount(); - exportDeleteByManagementGroup(); - exportDeleteByResourceGroup(); - exportDeleteBySubscription(); + await exportDeleteByBillingAccount(); + await exportDeleteByDepartment(); + await exportDeleteByEnrollmentAccount(); + await exportDeleteByManagementGroup(); + await exportDeleteByResourceGroup(); + await exportDeleteBySubscription(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsExecuteSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsExecuteSample.ts index dbc74d2f8914..80acc1696b79 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsExecuteSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsExecuteSample.ts @@ -1,114 +1,113 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to The operation to run an export. + * This sample demonstrates how to the operation to run an export. * - * @summary The operation to run an export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunByBillingAccount.json + * @summary the operation to run an export. + * x-ms-original-file: 2025-03-01/ExportRunByBillingAccount.json */ async function exportRunByBillingAccount(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/123456"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.execute(scope, exportName); - console.log(result); + await client.exports.execute("providers/Microsoft.Billing/billingAccounts/123456", "TestExport"); +} + +/** + * This sample demonstrates how to the operation to run an export. + * + * @summary the operation to run an export. + * x-ms-original-file: 2025-03-01/ExportRunByBillingAccountWithOptionalRequestBody.json + */ +async function exportRunByBillingAccountWithOptionalRequestBody(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + await client.exports.execute("providers/Microsoft.Billing/billingAccounts/123456", "TestExport"); } /** - * This sample demonstrates how to The operation to run an export. + * This sample demonstrates how to the operation to run an export. * - * @summary The operation to run an export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunByDepartment.json + * @summary the operation to run an export. + * x-ms-original-file: 2025-03-01/ExportRunByDepartment.json */ async function exportRunByDepartment(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12/departments/1234"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.execute(scope, exportName); - console.log(result); + await client.exports.execute( + "providers/Microsoft.Billing/billingAccounts/12/departments/1234", + "TestExport", + ); } /** - * This sample demonstrates how to The operation to run an export. + * This sample demonstrates how to the operation to run an export. * - * @summary The operation to run an export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunByEnrollmentAccount.json + * @summary the operation to run an export. + * x-ms-original-file: 2025-03-01/ExportRunByEnrollmentAccount.json */ async function exportRunByEnrollmentAccount(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.execute(scope, exportName); - console.log(result); + await client.exports.execute( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + "TestExport", + ); } /** - * This sample demonstrates how to The operation to run an export. + * This sample demonstrates how to the operation to run an export. * - * @summary The operation to run an export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunByManagementGroup.json + * @summary the operation to run an export. + * x-ms-original-file: 2025-03-01/ExportRunByManagementGroup.json */ async function exportRunByManagementGroup(): Promise { - const scope = "providers/Microsoft.Management/managementGroups/TestMG"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.execute(scope, exportName); - console.log(result); + await client.exports.execute( + "providers/Microsoft.Management/managementGroups/TestMG", + "TestExport", + ); } /** - * This sample demonstrates how to The operation to run an export. + * This sample demonstrates how to the operation to run an export. * - * @summary The operation to run an export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunByResourceGroup.json + * @summary the operation to run an export. + * x-ms-original-file: 2025-03-01/ExportRunByResourceGroup.json */ async function exportRunByResourceGroup(): Promise { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.execute(scope, exportName); - console.log(result); + await client.exports.execute( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + "TestExport", + ); } /** - * This sample demonstrates how to The operation to run an export. + * This sample demonstrates how to the operation to run an export. * - * @summary The operation to run an export. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunBySubscription.json + * @summary the operation to run an export. + * x-ms-original-file: 2025-03-01/ExportRunBySubscription.json */ async function exportRunBySubscription(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.execute(scope, exportName); - console.log(result); + await client.exports.execute("subscriptions/00000000-0000-0000-0000-000000000000", "TestExport"); } async function main(): Promise { - exportRunByBillingAccount(); - exportRunByDepartment(); - exportRunByEnrollmentAccount(); - exportRunByManagementGroup(); - exportRunByResourceGroup(); - exportRunBySubscription(); + await exportRunByBillingAccount(); + await exportRunByBillingAccountWithOptionalRequestBody(); + await exportRunByDepartment(); + await exportRunByEnrollmentAccount(); + await exportRunByManagementGroup(); + await exportRunByResourceGroup(); + await exportRunBySubscription(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsGetExecutionHistorySample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsGetExecutionHistorySample.ts index a7ce527f2b3f..27fb24ba8033 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsGetExecutionHistorySample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsGetExecutionHistorySample.ts @@ -1,114 +1,112 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to The operation to get the run history of an export for the defined scope and export name. + * This sample demonstrates how to the operation to get the run history of an export for the defined scope and export name. * - * @summary The operation to get the run history of an export for the defined scope and export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetByBillingAccount.json + * @summary the operation to get the run history of an export for the defined scope and export name. + * x-ms-original-file: 2025-03-01/ExportRunHistoryGetByBillingAccount.json */ async function exportRunHistoryGetByBillingAccount(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/123456"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.getExecutionHistory(scope, exportName); + const result = await client.exports.getExecutionHistory( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the run history of an export for the defined scope and export name. + * This sample demonstrates how to the operation to get the run history of an export for the defined scope and export name. * - * @summary The operation to get the run history of an export for the defined scope and export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetByDepartment.json + * @summary the operation to get the run history of an export for the defined scope and export name. + * x-ms-original-file: 2025-03-01/ExportRunHistoryGetByDepartment.json */ async function exportRunHistoryGetByDepartment(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12/departments/1234"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.getExecutionHistory(scope, exportName); + const result = await client.exports.getExecutionHistory( + "providers/Microsoft.Billing/billingAccounts/12/departments/1234", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the run history of an export for the defined scope and export name. + * This sample demonstrates how to the operation to get the run history of an export for the defined scope and export name. * - * @summary The operation to get the run history of an export for the defined scope and export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetByEnrollmentAccount.json + * @summary the operation to get the run history of an export for the defined scope and export name. + * x-ms-original-file: 2025-03-01/ExportRunHistoryGetByEnrollmentAccount.json */ async function exportRunHistoryGetByEnrollmentAccount(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.getExecutionHistory(scope, exportName); + const result = await client.exports.getExecutionHistory( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the run history of an export for the defined scope and export name. + * This sample demonstrates how to the operation to get the run history of an export for the defined scope and export name. * - * @summary The operation to get the run history of an export for the defined scope and export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetByManagementGroup.json + * @summary the operation to get the run history of an export for the defined scope and export name. + * x-ms-original-file: 2025-03-01/ExportRunHistoryGetByManagementGroup.json */ async function exportRunHistoryGetByManagementGroup(): Promise { - const scope = "providers/Microsoft.Management/managementGroups/TestMG"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.getExecutionHistory(scope, exportName); + const result = await client.exports.getExecutionHistory( + "providers/Microsoft.Management/managementGroups/TestMG", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the run history of an export for the defined scope and export name. + * This sample demonstrates how to the operation to get the run history of an export for the defined scope and export name. * - * @summary The operation to get the run history of an export for the defined scope and export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetByResourceGroup.json + * @summary the operation to get the run history of an export for the defined scope and export name. + * x-ms-original-file: 2025-03-01/ExportRunHistoryGetByResourceGroup.json */ async function exportRunHistoryGetByResourceGroup(): Promise { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.getExecutionHistory(scope, exportName); + const result = await client.exports.getExecutionHistory( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the run history of an export for the defined scope and export name. + * This sample demonstrates how to the operation to get the run history of an export for the defined scope and export name. * - * @summary The operation to get the run history of an export for the defined scope and export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetBySubscription.json + * @summary the operation to get the run history of an export for the defined scope and export name. + * x-ms-original-file: 2025-03-01/ExportRunHistoryGetBySubscription.json */ async function exportRunHistoryGetBySubscription(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.getExecutionHistory(scope, exportName); + const result = await client.exports.getExecutionHistory( + "subscriptions/00000000-0000-0000-0000-000000000000", + "TestExport", + ); console.log(result); } async function main(): Promise { - exportRunHistoryGetByBillingAccount(); - exportRunHistoryGetByDepartment(); - exportRunHistoryGetByEnrollmentAccount(); - exportRunHistoryGetByManagementGroup(); - exportRunHistoryGetByResourceGroup(); - exportRunHistoryGetBySubscription(); + await exportRunHistoryGetByBillingAccount(); + await exportRunHistoryGetByDepartment(); + await exportRunHistoryGetByEnrollmentAccount(); + await exportRunHistoryGetByManagementGroup(); + await exportRunHistoryGetByResourceGroup(); + await exportRunHistoryGetBySubscription(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsGetSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsGetSample.ts index acf91dc3678f..afc0cc231482 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsGetSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsGetSample.ts @@ -1,114 +1,112 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to The operation to get the export for the defined scope by export name. + * This sample demonstrates how to the operation to get the export for the defined scope by export name. * - * @summary The operation to get the export for the defined scope by export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetByBillingAccount.json + * @summary the operation to get the export for the defined scope by export name. + * x-ms-original-file: 2025-03-01/ExportGetByBillingAccount.json */ async function exportGetByBillingAccount(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/123456"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.get(scope, exportName); + const result = await client.exports.get( + "providers/Microsoft.Billing/billingAccounts/123456", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the export for the defined scope by export name. + * This sample demonstrates how to the operation to get the export for the defined scope by export name. * - * @summary The operation to get the export for the defined scope by export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetByDepartment.json + * @summary the operation to get the export for the defined scope by export name. + * x-ms-original-file: 2025-03-01/ExportGetByDepartment.json */ async function exportGetByDepartment(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12/departments/1234"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.get(scope, exportName); + const result = await client.exports.get( + "providers/Microsoft.Billing/billingAccounts/12/departments/1234", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the export for the defined scope by export name. + * This sample demonstrates how to the operation to get the export for the defined scope by export name. * - * @summary The operation to get the export for the defined scope by export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetByEnrollmentAccount.json + * @summary the operation to get the export for the defined scope by export name. + * x-ms-original-file: 2025-03-01/ExportGetByEnrollmentAccount.json */ async function exportGetByEnrollmentAccount(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.get(scope, exportName); + const result = await client.exports.get( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the export for the defined scope by export name. + * This sample demonstrates how to the operation to get the export for the defined scope by export name. * - * @summary The operation to get the export for the defined scope by export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetByManagementGroup.json + * @summary the operation to get the export for the defined scope by export name. + * x-ms-original-file: 2025-03-01/ExportGetByManagementGroup.json */ async function exportGetByManagementGroup(): Promise { - const scope = "providers/Microsoft.Management/managementGroups/TestMG"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.get(scope, exportName); + const result = await client.exports.get( + "providers/Microsoft.Management/managementGroups/TestMG", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the export for the defined scope by export name. + * This sample demonstrates how to the operation to get the export for the defined scope by export name. * - * @summary The operation to get the export for the defined scope by export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetByResourceGroup.json + * @summary the operation to get the export for the defined scope by export name. + * x-ms-original-file: 2025-03-01/ExportGetByResourceGroup.json */ async function exportGetByResourceGroup(): Promise { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.get(scope, exportName); + const result = await client.exports.get( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + "TestExport", + ); console.log(result); } /** - * This sample demonstrates how to The operation to get the export for the defined scope by export name. + * This sample demonstrates how to the operation to get the export for the defined scope by export name. * - * @summary The operation to get the export for the defined scope by export name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetBySubscription.json + * @summary the operation to get the export for the defined scope by export name. + * x-ms-original-file: 2025-03-01/ExportGetBySubscription.json */ async function exportGetBySubscription(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const exportName = "TestExport"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.get(scope, exportName); + const result = await client.exports.get( + "subscriptions/00000000-0000-0000-0000-000000000000", + "TestExport", + ); console.log(result); } async function main(): Promise { - exportGetByBillingAccount(); - exportGetByDepartment(); - exportGetByEnrollmentAccount(); - exportGetByManagementGroup(); - exportGetByResourceGroup(); - exportGetBySubscription(); + await exportGetByBillingAccount(); + await exportGetByDepartment(); + await exportGetByEnrollmentAccount(); + await exportGetByManagementGroup(); + await exportGetByResourceGroup(); + await exportGetBySubscription(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsListSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsListSample.ts index 9ca242334e3a..59f873610271 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsListSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/exportsListSample.ts @@ -1,108 +1,102 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to The operation to list all exports at the given scope. + * This sample demonstrates how to the operation to list all exports at the given scope. * - * @summary The operation to list all exports at the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetByBillingAccount.json + * @summary the operation to list all exports at the given scope. + * x-ms-original-file: 2025-03-01/ExportsGetByBillingAccount.json */ async function exportsGetByBillingAccount(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/123456"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.list(scope); + const result = await client.exports.list("providers/Microsoft.Billing/billingAccounts/123456"); console.log(result); } /** - * This sample demonstrates how to The operation to list all exports at the given scope. + * This sample demonstrates how to the operation to list all exports at the given scope. * - * @summary The operation to list all exports at the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetByDepartment.json + * @summary the operation to list all exports at the given scope. + * x-ms-original-file: 2025-03-01/ExportsGetByDepartment.json */ async function exportsGetByDepartment(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12/departments/123"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.list(scope); + const result = await client.exports.list( + "providers/Microsoft.Billing/billingAccounts/12/departments/123", + ); console.log(result); } /** - * This sample demonstrates how to The operation to list all exports at the given scope. + * This sample demonstrates how to the operation to list all exports at the given scope. * - * @summary The operation to list all exports at the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetByEnrollmentAccount.json + * @summary the operation to list all exports at the given scope. + * x-ms-original-file: 2025-03-01/ExportsGetByEnrollmentAccount.json */ async function exportsGetByEnrollmentAccount(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.list(scope); + const result = await client.exports.list( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + ); console.log(result); } /** - * This sample demonstrates how to The operation to list all exports at the given scope. + * This sample demonstrates how to the operation to list all exports at the given scope. * - * @summary The operation to list all exports at the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetByManagementGroup.json + * @summary the operation to list all exports at the given scope. + * x-ms-original-file: 2025-03-01/ExportsGetByManagementGroup.json */ async function exportsGetByManagementGroup(): Promise { - const scope = "providers/Microsoft.Management/managementGroups/TestMG"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.list(scope); + const result = await client.exports.list( + "providers/Microsoft.Management/managementGroups/TestMG", + ); console.log(result); } /** - * This sample demonstrates how to The operation to list all exports at the given scope. + * This sample demonstrates how to the operation to list all exports at the given scope. * - * @summary The operation to list all exports at the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetByResourceGroup.json + * @summary the operation to list all exports at the given scope. + * x-ms-original-file: 2025-03-01/ExportsGetByResourceGroup.json */ async function exportsGetByResourceGroup(): Promise { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.list(scope); + const result = await client.exports.list( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + ); console.log(result); } /** - * This sample demonstrates how to The operation to list all exports at the given scope. + * This sample demonstrates how to the operation to list all exports at the given scope. * - * @summary The operation to list all exports at the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetBySubscription.json + * @summary the operation to list all exports at the given scope. + * x-ms-original-file: 2025-03-01/ExportsGetBySubscription.json */ async function exportsGetBySubscription(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.exports.list(scope); + const result = await client.exports.list("subscriptions/00000000-0000-0000-0000-000000000000"); console.log(result); } async function main(): Promise { - exportsGetByBillingAccount(); - exportsGetByDepartment(); - exportsGetByEnrollmentAccount(); - exportsGetByManagementGroup(); - exportsGetByResourceGroup(); - exportsGetBySubscription(); + await exportsGetByBillingAccount(); + await exportsGetByDepartment(); + await exportsGetByEnrollmentAccount(); + await exportsGetByManagementGroup(); + await exportsGetByResourceGroup(); + await exportsGetBySubscription(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/forecastExternalCloudProviderUsageSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/forecastExternalCloudProviderUsageSample.ts index 54cd3425413a..05e5f68fd173 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/forecastExternalCloudProviderUsageSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/forecastExternalCloudProviderUsageSample.ts @@ -1,87 +1,64 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { - ForecastDefinition, - CostManagementClient -} from "@azure/arm-costmanagement"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists the forecast charges for external cloud provider type defined. + * This sample demonstrates how to lists the forecast charges for external cloud provider type defined. * - * @summary Lists the forecast charges for external cloud provider type defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalBillingAccountForecast.json + * @summary lists the forecast charges for external cloud provider type defined. + * x-ms-original-file: 2025-03-01/ExternalBillingAccountForecast.json */ async function externalBillingAccountForecast(): Promise { - const externalCloudProviderType = "externalBillingAccounts"; - const externalCloudProviderId = "100"; - const parameters: ForecastDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "Cost", function: "Sum" } }, - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"] - } - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"] - } - } - ] - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"] - } - } - ] - }, - granularity: "Daily" - }, - timePeriod: { - from: new Date("2022-08-01T00:00:00+00:00"), - to: new Date("2022-08-31T23:59:59+00:00") - }, - timeframe: "Custom" - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const result = await client.forecast.externalCloudProviderUsage( - externalCloudProviderType, - externalCloudProviderId, - parameters + "externalBillingAccounts", + "100", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "Cost", function: "Sum" } }, + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, + }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], + }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", + }, + timePeriod: { + from: new Date("2022-08-01T00:00:00+00:00"), + to: new Date("2022-08-31T23:59:59+00:00"), + }, + timeframe: "Custom", + }, ); console.log(result); } /** - * This sample demonstrates how to Lists the forecast charges for external cloud provider type defined. + * This sample demonstrates how to lists the forecast charges for external cloud provider type defined. * - * @summary Lists the forecast charges for external cloud provider type defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalSubscriptionForecast.json + * @summary lists the forecast charges for external cloud provider type defined. + * x-ms-original-file: 2025-03-01/ExternalSubscriptionForecast.json */ async function externalSubscriptionForecast(): Promise { - const externalCloudProviderType = "externalSubscriptions"; - const externalCloudProviderId = "100"; - const parameters: ForecastDefinition = { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.forecast.externalCloudProviderUsage("externalSubscriptions", "100", { type: "Usage", dataset: { aggregation: { totalCost: { name: "Cost", function: "Sum" } }, @@ -93,48 +70,29 @@ async function externalSubscriptionForecast(): Promise { dimensions: { name: "ResourceLocation", operator: "In", - values: ["East US", "West Europe"] - } + values: ["East US", "West Europe"], + }, }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"] - } - } - ] + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"] - } - } - ] + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], }, - granularity: "Daily" + granularity: "Daily", }, timePeriod: { from: new Date("2022-08-01T00:00:00+00:00"), - to: new Date("2022-08-31T23:59:59+00:00") + to: new Date("2022-08-31T23:59:59+00:00"), }, - timeframe: "Custom" - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.forecast.externalCloudProviderUsage( - externalCloudProviderType, - externalCloudProviderId, - parameters - ); + timeframe: "Custom", + }); console.log(result); } async function main(): Promise { - externalBillingAccountForecast(); - externalSubscriptionForecast(); + await externalBillingAccountForecast(); + await externalSubscriptionForecast(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/forecastUsageSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/forecastUsageSample.ts index 94d6a4e0dd10..f576b0ccf3da 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/forecastUsageSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/forecastUsageSample.ts @@ -1,373 +1,295 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { - ForecastDefinition, - CostManagementClient -} from "@azure/arm-costmanagement"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists the forecast charges for scope defined. + * This sample demonstrates how to lists the forecast charges for scope defined. * - * @summary Lists the forecast charges for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountForecast.json + * @summary lists the forecast charges for scope defined. + * x-ms-original-file: 2025-03-01/BillingAccountForecast.json */ async function billingAccountForecast(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789"; - const parameters: ForecastDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "Cost", function: "Sum" } }, - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"] - } - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"] - } - } - ] - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"] - } - } - ] - }, - granularity: "Daily" - }, - includeActualCost: false, - includeFreshPartialCost: false, - timePeriod: { - from: new Date("2022-08-01T00:00:00+00:00"), - to: new Date("2022-08-31T23:59:59+00:00") - }, - timeframe: "Custom" - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.forecast.usage(scope, parameters); + const result = await client.forecast.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "Cost", function: "Sum" } }, + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, + }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], + }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", + }, + includeActualCost: false, + includeFreshPartialCost: false, + timePeriod: { + from: new Date("2022-08-01T00:00:00+00:00"), + to: new Date("2022-08-31T23:59:59+00:00"), + }, + timeframe: "Custom", + }, + ); console.log(result); } /** - * This sample demonstrates how to Lists the forecast charges for scope defined. + * This sample demonstrates how to lists the forecast charges for scope defined. * - * @summary Lists the forecast charges for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingProfileForecast.json + * @summary lists the forecast charges for scope defined. + * x-ms-original-file: 2025-03-01/BillingProfileForecast.json */ async function billingProfileForecast(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; - const parameters: ForecastDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "Cost", function: "Sum" } }, - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"] - } - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"] - } - } - ] - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"] - } - } - ] - }, - granularity: "Daily" - }, - includeActualCost: false, - includeFreshPartialCost: false, - timePeriod: { - from: new Date("2022-08-01T00:00:00+00:00"), - to: new Date("2022-08-31T23:59:59+00:00") - }, - timeframe: "Custom" - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.forecast.usage(scope, parameters); + const result = await client.forecast.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "Cost", function: "Sum" } }, + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, + }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], + }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", + }, + includeActualCost: false, + includeFreshPartialCost: false, + timePeriod: { + from: new Date("2022-08-01T00:00:00+00:00"), + to: new Date("2022-08-31T23:59:59+00:00"), + }, + timeframe: "Custom", + }, + ); console.log(result); } /** - * This sample demonstrates how to Lists the forecast charges for scope defined. + * This sample demonstrates how to lists the forecast charges for scope defined. * - * @summary Lists the forecast charges for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentForecast.json + * @summary lists the forecast charges for scope defined. + * x-ms-original-file: 2025-03-01/DepartmentForecast.json */ async function departmentForecast(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123"; - const parameters: ForecastDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "Cost", function: "Sum" } }, - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"] - } - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"] - } - } - ] - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"] - } - } - ] - }, - granularity: "Daily" - }, - includeActualCost: false, - includeFreshPartialCost: false, - timePeriod: { - from: new Date("2022-08-01T00:00:00+00:00"), - to: new Date("2022-08-31T23:59:59+00:00") - }, - timeframe: "Custom" - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.forecast.usage(scope, parameters); + const result = await client.forecast.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "Cost", function: "Sum" } }, + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, + }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], + }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", + }, + includeActualCost: false, + includeFreshPartialCost: false, + timePeriod: { + from: new Date("2022-08-01T00:00:00+00:00"), + to: new Date("2022-08-31T23:59:59+00:00"), + }, + timeframe: "Custom", + }, + ); console.log(result); } /** - * This sample demonstrates how to Lists the forecast charges for scope defined. + * This sample demonstrates how to lists the forecast charges for scope defined. * - * @summary Lists the forecast charges for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountForecast.json + * @summary lists the forecast charges for scope defined. + * x-ms-original-file: 2025-03-01/EnrollmentAccountForecast.json */ async function enrollmentAccountForecast(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456"; - const parameters: ForecastDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "Cost", function: "Sum" } }, - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"] - } - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"] - } - } - ] - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"] - } - } - ] - }, - granularity: "Daily" - }, - includeActualCost: false, - includeFreshPartialCost: false, - timePeriod: { - from: new Date("2022-08-01T00:00:00+00:00"), - to: new Date("2022-08-31T23:59:59+00:00") - }, - timeframe: "Custom" - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.forecast.usage(scope, parameters); + const result = await client.forecast.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "Cost", function: "Sum" } }, + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, + }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], + }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", + }, + includeActualCost: false, + includeFreshPartialCost: false, + timePeriod: { + from: new Date("2022-08-01T00:00:00+00:00"), + to: new Date("2022-08-31T23:59:59+00:00"), + }, + timeframe: "Custom", + }, + ); console.log(result); } /** - * This sample demonstrates how to Lists the forecast charges for scope defined. + * This sample demonstrates how to lists the forecast charges for scope defined. * - * @summary Lists the forecast charges for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/InvoiceSectionForecast.json + * @summary lists the forecast charges for scope defined. + * x-ms-original-file: 2025-03-01/InvoiceSectionForecast.json */ async function invoiceSectionForecast(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876"; - const parameters: ForecastDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "Cost", function: "Sum" } }, - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"] - } - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"] - } - } - ] - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"] - } - } - ] - }, - granularity: "Daily" - }, - includeActualCost: false, - includeFreshPartialCost: false, - timePeriod: { - from: new Date("2022-08-01T00:00:00+00:00"), - to: new Date("2022-08-31T23:59:59+00:00") - }, - timeframe: "Custom" - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.forecast.usage(scope, parameters); + const result = await client.forecast.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "Cost", function: "Sum" } }, + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, + }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], + }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", + }, + includeActualCost: false, + includeFreshPartialCost: false, + timePeriod: { + from: new Date("2022-08-01T00:00:00+00:00"), + to: new Date("2022-08-31T23:59:59+00:00"), + }, + timeframe: "Custom", + }, + ); console.log(result); } /** - * This sample demonstrates how to Lists the forecast charges for scope defined. + * This sample demonstrates how to lists the forecast charges for scope defined. * - * @summary Lists the forecast charges for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ResourceGroupForecast.json + * @summary lists the forecast charges for scope defined. + * x-ms-original-file: 2025-03-01/ResourceGroupForecast.json */ async function resourceGroupForecast(): Promise { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"; - const parameters: ForecastDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "Cost", function: "Sum" } }, - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"] - } - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"] - } - } - ] - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"] - } - } - ] - }, - granularity: "Daily" - }, - includeActualCost: false, - includeFreshPartialCost: false, - timePeriod: { - from: new Date("2022-08-01T00:00:00+00:00"), - to: new Date("2022-08-31T23:59:59+00:00") - }, - timeframe: "Custom" - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.forecast.usage(scope, parameters); + const result = await client.forecast.usage( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "Cost", function: "Sum" } }, + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, + }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], + }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", + }, + includeActualCost: false, + includeFreshPartialCost: false, + timePeriod: { + from: new Date("2022-08-01T00:00:00+00:00"), + to: new Date("2022-08-31T23:59:59+00:00"), + }, + timeframe: "Custom", + }, + ); console.log(result); } /** - * This sample demonstrates how to Lists the forecast charges for scope defined. + * This sample demonstrates how to lists the forecast charges for scope defined. * - * @summary Lists the forecast charges for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SubscriptionForecast.json + * @summary lists the forecast charges for scope defined. + * x-ms-original-file: 2025-03-01/SubscriptionForecast.json */ async function subscriptionForecast(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const parameters: ForecastDefinition = { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.forecast.usage("subscriptions/00000000-0000-0000-0000-000000000000", { type: "Usage", dataset: { aggregation: { totalCost: { name: "Cost", function: "Sum" } }, @@ -379,51 +301,36 @@ async function subscriptionForecast(): Promise { dimensions: { name: "ResourceLocation", operator: "In", - values: ["East US", "West Europe"] - } + values: ["East US", "West Europe"], + }, }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"] - } - } - ] + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"] - } - } - ] + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], }, - granularity: "Daily" + granularity: "Daily", }, includeActualCost: false, includeFreshPartialCost: false, timePeriod: { from: new Date("2022-08-01T00:00:00+00:00"), - to: new Date("2022-08-31T23:59:59+00:00") + to: new Date("2022-08-31T23:59:59+00:00"), }, - timeframe: "Custom" - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.forecast.usage(scope, parameters); + timeframe: "Custom", + }); console.log(result); } async function main(): Promise { - billingAccountForecast(); - billingProfileForecast(); - departmentForecast(); - enrollmentAccountForecast(); - invoiceSectionForecast(); - resourceGroupForecast(); - subscriptionForecast(); + await billingAccountForecast(); + await billingProfileForecast(); + await departmentForecast(); + await enrollmentAccountForecast(); + await invoiceSectionForecast(); + await resourceGroupForecast(); + await subscriptionForecast(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateBenefitUtilizationSummariesReportGenerateByBillingAccountSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateBenefitUtilizationSummariesReportGenerateByBillingAccountSample.ts new file mode 100644 index 000000000000..05cc7b517761 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateBenefitUtilizationSummariesReportGenerateByBillingAccountSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. + * + * @summary triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByBillingAccount.json + */ +async function generateUtilizationSummariesReportByBillingAccount(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.generateBenefitUtilizationSummariesReport.generateByBillingAccount( + "8099099", + { + endDate: new Date("2022-08-31T00:00:00Z"), + grain: "Daily", + kind: "Reservation", + startDate: new Date("2022-06-01T00:00:00Z"), + }, + ); + console.log(result); +} + +async function main(): Promise { + await generateUtilizationSummariesReportByBillingAccount(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateBenefitUtilizationSummariesReportGenerateByBillingProfileSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateBenefitUtilizationSummariesReportGenerateByBillingProfileSample.ts new file mode 100644 index 000000000000..0c520caaf357 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateBenefitUtilizationSummariesReportGenerateByBillingProfileSample.ts @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. + * + * @summary triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByBillingProfile.json + */ +async function generateUtilizationSummariesReportByBillingProfile(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.generateBenefitUtilizationSummariesReport.generateByBillingProfile( + "00000000-0000-0000-0000-000000000000", + "CZSFR-SDFXC-DSDF", + { + endDate: new Date("2022-08-31T00:00:00Z"), + grain: "Daily", + kind: "Reservation", + startDate: new Date("2022-06-01T00:00:00Z"), + }, + ); + console.log(result); +} + +async function main(): Promise { + await generateUtilizationSummariesReportByBillingProfile(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateBenefitUtilizationSummariesReportGenerateByReservationIdSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateBenefitUtilizationSummariesReportGenerateByReservationIdSample.ts new file mode 100644 index 000000000000..ffbcdffff4fa --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateBenefitUtilizationSummariesReportGenerateByReservationIdSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to triggers generation of a benefit utilization summaries report for the provided reservation. + * + * @summary triggers generation of a benefit utilization summaries report for the provided reservation. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByReservation.json + */ +async function generateUtilizationSummariesReportByReservation(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.generateBenefitUtilizationSummariesReport.generateByReservationId( + "00000000-0000-0000-0000-000000000000", + "00000000-0000-0000-0000-000000000000", + { + endDate: new Date("2022-08-31T00:00:00Z"), + grain: "Daily", + startDate: new Date("2022-06-01T00:00:00Z"), + }, + ); + console.log(result); +} + +async function main(): Promise { + await generateUtilizationSummariesReportByReservation(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateBenefitUtilizationSummariesReportGenerateByReservationOrderIdSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateBenefitUtilizationSummariesReportGenerateByReservationOrderIdSample.ts new file mode 100644 index 000000000000..21b0e5f73419 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateBenefitUtilizationSummariesReportGenerateByReservationOrderIdSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to triggers generation of a benefit utilization summaries report for the provided reservation order. + * + * @summary triggers generation of a benefit utilization summaries report for the provided reservation order. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByReservationOrder.json + */ +async function generateUtilizationSummariesReportByReservationOrder(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = + await client.generateBenefitUtilizationSummariesReport.generateByReservationOrderId( + "00000000-0000-0000-0000-000000000000", + { + endDate: new Date("2022-08-31T00:00:00Z"), + grain: "Daily", + startDate: new Date("2022-06-01T00:00:00Z"), + }, + ); + console.log(result); +} + +async function main(): Promise { + await generateUtilizationSummariesReportByReservationOrder(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdSample.ts new file mode 100644 index 000000000000..b4bd2f7a28e7 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to triggers generation of a benefit utilization summaries report for the provided savings plan. + * + * @summary triggers generation of a benefit utilization summaries report for the provided savings plan. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportBySavingsPlan.json + */ +async function generateUtilizationSummariesReportBySavingsPlan(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.generateBenefitUtilizationSummariesReport.generateBySavingsPlanId( + "00000000-0000-0000-0000-000000000000", + "00000000-0000-0000-0000-000000000000", + { + endDate: new Date("2022-08-31T00:00:00Z"), + grain: "Daily", + startDate: new Date("2022-06-01T00:00:00Z"), + }, + ); + console.log(result); +} + +async function main(): Promise { + await generateUtilizationSummariesReportBySavingsPlan(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdSample.ts new file mode 100644 index 000000000000..9f40ed084f11 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to triggers generation of a benefit utilization summaries report for the provided savings plan order. + * + * @summary triggers generation of a benefit utilization summaries report for the provided savings plan order. + * x-ms-original-file: 2025-03-01/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportBySavingsPlanOrder.json + */ +async function generateUtilizationSummariesReportBySavingsPlanOrder(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = + await client.generateBenefitUtilizationSummariesReport.generateBySavingsPlanOrderId( + "00000000-0000-0000-0000-000000000000", + { + endDate: new Date("2022-08-31T00:00:00Z"), + grain: "Daily", + startDate: new Date("2022-06-01T00:00:00Z"), + }, + ); + console.log(result); +} + +async function main(): Promise { + await generateUtilizationSummariesReportBySavingsPlanOrder(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateCostDetailsReportCreateOperationSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateCostDetailsReportCreateOperationSample.ts index 5f904678dab0..402084ea55ac 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateCostDetailsReportCreateOperationSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateCostDetailsReportCreateOperationSample.ts @@ -1,175 +1,129 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { - GenerateCostDetailsReportRequestDefinition, - CostManagementClient -} from "@azure/arm-costmanagement"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields + * This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields * - * @summary This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod.json + * @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields + * x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod.json */ async function generateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345"; - const parameters: GenerateCostDetailsReportRequestDefinition = { - billingPeriod: "202205", - metric: "ActualCost" - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateCostDetailsReport.beginCreateOperationAndWait( - scope, - parameters + const result = await client.generateCostDetailsReport.createOperation( + "providers/Microsoft.Billing/billingAccounts/12345", + { billingPeriod: "202205", metric: "ActualCost" }, ); console.log(result); } /** - * This sample demonstrates how to This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields + * This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields * - * @summary This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByBillingProfileAndInvoiceId.json + * @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields + * x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByBillingProfileAndInvoiceId.json */ async function generateCostDetailsReportByBillingProfileAndInvoiceId(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; - const parameters: GenerateCostDetailsReportRequestDefinition = { - invoiceId: "M1234567", - metric: "ActualCost" - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateCostDetailsReport.beginCreateOperationAndWait( - scope, - parameters + const result = await client.generateCostDetailsReport.createOperation( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + { invoiceId: "M1234567", metric: "ActualCost" }, ); console.log(result); } /** - * This sample demonstrates how to This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields + * This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields * - * @summary This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByBillingProfileAndInvoiceIdAndCustomerId.json + * @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields + * x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByBillingProfileAndInvoiceIdAndCustomerId.json */ async function generateCostDetailsReportByBillingProfileAndInvoiceIdAndCustomerId(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579"; - const parameters: GenerateCostDetailsReportRequestDefinition = { - invoiceId: "M1234567", - metric: "ActualCost" - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateCostDetailsReport.beginCreateOperationAndWait( - scope, - parameters + const result = await client.generateCostDetailsReport.createOperation( + "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579", + { invoiceId: "M1234567", metric: "ActualCost" }, ); console.log(result); } /** - * This sample demonstrates how to This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields + * This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields * - * @summary This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByCustomerAndTimePeriod.json + * @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields + * x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByCustomerAndTimePeriod.json */ async function generateCostDetailsReportByCustomerAndTimePeriod(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579"; - const parameters: GenerateCostDetailsReportRequestDefinition = { - metric: "ActualCost", - timePeriod: { end: "2020-03-15", start: "2020-03-01" } - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateCostDetailsReport.beginCreateOperationAndWait( - scope, - parameters + const result = await client.generateCostDetailsReport.createOperation( + "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579", + { metric: "ActualCost", timePeriod: { end: "2020-03-15", start: "2020-03-01" } }, ); console.log(result); } /** - * This sample demonstrates how to This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields + * This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields * - * @summary This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByDepartmentsAndTimePeriod.json + * @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields + * x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByDepartmentsAndTimePeriod.json */ async function generateCostDetailsReportByDepartmentsAndTimePeriod(): Promise { - const scope = "providers/Microsoft.Billing/departments/12345"; - const parameters: GenerateCostDetailsReportRequestDefinition = { - metric: "ActualCost", - timePeriod: { end: "2020-03-15", start: "2020-03-01" } - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateCostDetailsReport.beginCreateOperationAndWait( - scope, - parameters + const result = await client.generateCostDetailsReport.createOperation( + "providers/Microsoft.Billing/departments/12345", + { metric: "ActualCost", timePeriod: { end: "2020-03-15", start: "2020-03-01" } }, ); console.log(result); } /** - * This sample demonstrates how to This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields + * This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields * - * @summary This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByEnrollmentAccountsAndTimePeriod.json + * @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields + * x-ms-original-file: 2025-03-01/GenerateCostDetailsReportByEnrollmentAccountsAndTimePeriod.json */ async function generateCostDetailsReportByEnrollmentAccountsAndTimePeriod(): Promise { - const scope = "providers/Microsoft.Billing/enrollmentAccounts/1234"; - const parameters: GenerateCostDetailsReportRequestDefinition = { - metric: "ActualCost", - timePeriod: { end: "2020-03-15", start: "2020-03-01" } - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateCostDetailsReport.beginCreateOperationAndWait( - scope, - parameters + const result = await client.generateCostDetailsReport.createOperation( + "providers/Microsoft.Billing/enrollmentAccounts/1234", + { metric: "ActualCost", timePeriod: { end: "2020-03-15", start: "2020-03-01" } }, ); console.log(result); } /** - * This sample demonstrates how to This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields + * This sample demonstrates how to this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields * - * @summary This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportBySubscriptionAndTimePeriod.json + * @summary this API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields + * x-ms-original-file: 2025-03-01/GenerateCostDetailsReportBySubscriptionAndTimePeriod.json */ async function generateCostDetailsReportBySubscriptionAndTimePeriod(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const parameters: GenerateCostDetailsReportRequestDefinition = { - metric: "ActualCost", - timePeriod: { end: "2020-03-15", start: "2020-03-01" } - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateCostDetailsReport.beginCreateOperationAndWait( - scope, - parameters + const result = await client.generateCostDetailsReport.createOperation( + "subscriptions/00000000-0000-0000-0000-000000000000", + { metric: "ActualCost", timePeriod: { end: "2020-03-15", start: "2020-03-01" } }, ); console.log(result); } async function main(): Promise { - generateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod(); - generateCostDetailsReportByBillingProfileAndInvoiceId(); - generateCostDetailsReportByBillingProfileAndInvoiceIdAndCustomerId(); - generateCostDetailsReportByCustomerAndTimePeriod(); - generateCostDetailsReportByDepartmentsAndTimePeriod(); - generateCostDetailsReportByEnrollmentAccountsAndTimePeriod(); - generateCostDetailsReportBySubscriptionAndTimePeriod(); + await generateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod(); + await generateCostDetailsReportByBillingProfileAndInvoiceId(); + await generateCostDetailsReportByBillingProfileAndInvoiceIdAndCustomerId(); + await generateCostDetailsReportByCustomerAndTimePeriod(); + await generateCostDetailsReportByDepartmentsAndTimePeriod(); + await generateCostDetailsReportByEnrollmentAccountsAndTimePeriod(); + await generateCostDetailsReportBySubscriptionAndTimePeriod(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateCostDetailsReportGetOperationResultsSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateCostDetailsReportGetOperationResultsSample.ts index d9dd673019b6..8fecb7092340 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateCostDetailsReportGetOperationResultsSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateCostDetailsReportGetOperationResultsSample.ts @@ -1,34 +1,27 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get the result of the specified operation. This link is provided in the CostDetails creation request response Location header. + * This sample demonstrates how to get the result of the specified operation. This link is provided in the CostDetails creation request response Location header. * - * @summary Get the result of the specified operation. This link is provided in the CostDetails creation request response Location header. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/CostDetailsOperationResultsBySubscriptionScope.json + * @summary get the result of the specified operation. This link is provided in the CostDetails creation request response Location header. + * x-ms-original-file: 2025-03-01/CostDetailsOperationResultsBySubscriptionScope.json */ async function getDetailsOfTheOperationResult(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const operationId = "00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateCostDetailsReport.beginGetOperationResultsAndWait( - scope, - operationId + const result = await client.generateCostDetailsReport.getOperationResults( + "subscriptions/00000000-0000-0000-0000-000000000000", + "00000000-0000-0000-0000-000000000000", ); console.log(result); } async function main(): Promise { - getDetailsOfTheOperationResult(); + await getDetailsOfTheOperationResult(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateDetailedCostReportCreateOperationSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateDetailedCostReportCreateOperationSample.ts index b8022203d87a..26e96c773629 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateDetailedCostReportCreateOperationSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateDetailedCostReportCreateOperationSample.ts @@ -1,132 +1,95 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { - GenerateDetailedCostReportDefinition, - CostManagementClient -} from "@azure/arm-costmanagement"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportByBillingAccountLegacyAndBillingPeriod.json + * @summary 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. + * x-ms-original-file: 2025-03-01/GenerateDetailedCostReportByBillingAccountLegacyAndBillingPeriod.json */ async function generateDetailedCostReportByBillingAccountLegacyAndBillingPeriod(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345"; - const parameters: GenerateDetailedCostReportDefinition = { - billingPeriod: "202008", - metric: "ActualCost" - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateDetailedCostReport.beginCreateOperationAndWait( - scope, - parameters + const result = await client.generateDetailedCostReport.createOperation( + "providers/Microsoft.Billing/billingAccounts/12345", + { billingPeriod: "202008", metric: "ActualCost" }, ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportByBillingProfileAndInvoiceId.json + * @summary 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. + * x-ms-original-file: 2025-03-01/GenerateDetailedCostReportByBillingProfileAndInvoiceId.json */ async function generateDetailedCostReportByBillingProfileAndInvoiceId(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; - const parameters: GenerateDetailedCostReportDefinition = { - invoiceId: "M1234567", - metric: "ActualCost" - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateDetailedCostReport.beginCreateOperationAndWait( - scope, - parameters + const result = await client.generateDetailedCostReport.createOperation( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + { invoiceId: "M1234567", metric: "ActualCost" }, ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportByBillingProfileAndInvoiceIdAndCustomerId.json + * @summary 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. + * x-ms-original-file: 2025-03-01/GenerateDetailedCostReportByBillingProfileAndInvoiceIdAndCustomerId.json */ async function generateDetailedCostReportByBillingProfileAndInvoiceIdAndCustomerId(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; - const parameters: GenerateDetailedCostReportDefinition = { - customerId: "456789", - invoiceId: "M1234567", - metric: "ActualCost" - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateDetailedCostReport.beginCreateOperationAndWait( - scope, - parameters + const result = await client.generateDetailedCostReport.createOperation( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + { customerId: "456789", invoiceId: "M1234567", metric: "ActualCost" }, ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportByCustomerAndTimePeriod.json + * @summary 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. + * x-ms-original-file: 2025-03-01/GenerateDetailedCostReportByCustomerAndTimePeriod.json */ async function generateDetailedCostReportByCustomerAndTimePeriod(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579"; - const parameters: GenerateDetailedCostReportDefinition = { - metric: "ActualCost", - timePeriod: { end: "2020-03-15", start: "2020-03-01" } - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateDetailedCostReport.beginCreateOperationAndWait( - scope, - parameters + const result = await client.generateDetailedCostReport.createOperation( + "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/13579", + { metric: "ActualCost", timePeriod: { end: "2020-03-15", start: "2020-03-01" } }, ); console.log(result); } /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportBySubscriptionAndTimePeriod.json + * @summary 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. + * x-ms-original-file: 2025-03-01/GenerateDetailedCostReportBySubscriptionAndTimePeriod.json */ async function generateDetailedCostReportBySubscriptionAndTimePeriod(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const parameters: GenerateDetailedCostReportDefinition = { - metric: "ActualCost", - timePeriod: { end: "2020-03-15", start: "2020-03-01" } - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateDetailedCostReport.beginCreateOperationAndWait( - scope, - parameters + const result = await client.generateDetailedCostReport.createOperation( + "subscriptions/00000000-0000-0000-0000-000000000000", + { metric: "ActualCost", timePeriod: { end: "2020-03-15", start: "2020-03-01" } }, ); console.log(result); } async function main(): Promise { - generateDetailedCostReportByBillingAccountLegacyAndBillingPeriod(); - generateDetailedCostReportByBillingProfileAndInvoiceId(); - generateDetailedCostReportByBillingProfileAndInvoiceIdAndCustomerId(); - generateDetailedCostReportByCustomerAndTimePeriod(); - generateDetailedCostReportBySubscriptionAndTimePeriod(); + await generateDetailedCostReportByBillingAccountLegacyAndBillingPeriod(); + await generateDetailedCostReportByBillingProfileAndInvoiceId(); + await generateDetailedCostReportByBillingProfileAndInvoiceIdAndCustomerId(); + await generateDetailedCostReportByCustomerAndTimePeriod(); + await generateDetailedCostReportBySubscriptionAndTimePeriod(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateDetailedCostReportOperationResultsGetSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateDetailedCostReportOperationResultsGetSample.ts index 3c41fba98ac6..ea8e08dbf946 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateDetailedCostReportOperationResultsGetSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateDetailedCostReportOperationResultsGetSample.ts @@ -1,34 +1,27 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Gets the result of the specified operation. The link with this operationId is provided as a response header of the initial request. + * This sample demonstrates how to gets the result of the specified operation. The link with this operationId is provided as a response header of the initial request. * - * @summary Gets the result of the specified operation. The link with this operationId is provided as a response header of the initial request. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportOperationResultsBySubscriptionScope.json + * @summary gets the result of the specified operation. The link with this operationId is provided as a response header of the initial request. + * x-ms-original-file: 2025-03-01/GenerateDetailedCostReportOperationResultsBySubscriptionScope.json */ async function getDetailsOfTheOperationResult(): Promise { - const operationId = "00000000-0000-0000-0000-000000000000"; - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateDetailedCostReportOperationResults.beginGetAndWait( - operationId, - scope + const result = await client.generateDetailedCostReportOperationResults.get( + "00000000-0000-0000-0000-000000000000", + "subscriptions/00000000-0000-0000-0000-000000000000", ); console.log(result); } async function main(): Promise { - getDetailsOfTheOperationResult(); + await getDetailsOfTheOperationResult(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateDetailedCostReportOperationStatusGetSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateDetailedCostReportOperationStatusGetSample.ts index 71d0d7df68c3..04c2a2c9ad03 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateDetailedCostReportOperationStatusGetSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateDetailedCostReportOperationStatusGetSample.ts @@ -1,34 +1,27 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get the status of the specified operation. This link is provided in the GenerateDetailedCostReport creation request response header. + * This sample demonstrates how to get the status of the specified operation. This link is provided in the GenerateDetailedCostReport creation request response header. * - * @summary Get the status of the specified operation. This link is provided in the GenerateDetailedCostReport creation request response header. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportOperationStatusBySubscriptionScope.json + * @summary get the status of the specified operation. This link is provided in the GenerateDetailedCostReport creation request response header. + * x-ms-original-file: 2025-03-01/GenerateDetailedCostReportOperationStatusBySubscriptionScope.json */ async function getDetailsOfTheOperationStatus(): Promise { - const operationId = "00000000-0000-0000-0000-000000000000"; - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const result = await client.generateDetailedCostReportOperationStatus.get( - operationId, - scope + "00000000-0000-0000-0000-000000000000", + "subscriptions/00000000-0000-0000-0000-000000000000", ); console.log(result); } async function main(): Promise { - getDetailsOfTheOperationStatus(); + await getDetailsOfTheOperationStatus(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateReservationDetailsReportByBillingAccountIdSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateReservationDetailsReportByBillingAccountIdSample.ts index d8fe3e3c71b1..74adeaa72fec 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateReservationDetailsReportByBillingAccountIdSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateReservationDetailsReportByBillingAccountIdSample.ts @@ -1,36 +1,28 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to 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://learn.microsoft.com/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role + * This sample demonstrates how to 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 * - * @summary 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://learn.microsoft.com/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateReservationDetailsReportByBillingAccount.json + * @summary 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 + * x-ms-original-file: 2025-03-01/GenerateReservationDetailsReportByBillingAccount.json */ async function reservationDetails(): Promise { - const billingAccountId = "9845612"; - const startDate = "2020-01-01"; - const endDate = "2020-01-30"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateReservationDetailsReport.beginByBillingAccountIdAndWait( - billingAccountId, - startDate, - endDate + const result = await client.generateReservationDetailsReport.byBillingAccountId( + "9845612", + "2020-01-01", + "2020-01-30", ); console.log(result); } async function main(): Promise { - reservationDetails(); + await reservationDetails(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateReservationDetailsReportByBillingProfileIdSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateReservationDetailsReportByBillingProfileIdSample.ts index 79f918c61437..69e7a369c4d8 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateReservationDetailsReportByBillingProfileIdSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/generateReservationDetailsReportByBillingProfileIdSample.ts @@ -1,38 +1,29 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to 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://learn.microsoft.com/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access + * This sample demonstrates how to 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 * - * @summary 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://learn.microsoft.com/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateReservationDetailsReportByBillingProfile.json + * @summary 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 + * x-ms-original-file: 2025-03-01/GenerateReservationDetailsReportByBillingProfile.json */ async function reservationDetails(): Promise { - const billingAccountId = "00000000-0000-0000-0000-000000000000"; - const billingProfileId = "CZSFR-SDFXC-DSDF"; - const startDate = "2020-01-01"; - const endDate = "2020-01-30"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.generateReservationDetailsReport.beginByBillingProfileIdAndWait( - billingAccountId, - billingProfileId, - startDate, - endDate + const result = await client.generateReservationDetailsReport.byBillingProfileId( + "00000000-0000-0000-0000-000000000000", + "CZSFR-SDFXC-DSDF", + "2020-01-01", + "2020-01-30", ); console.log(result); } async function main(): Promise { - reservationDetails(); + await reservationDetails(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/operationsListSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/operationsListSample.ts index 68c37d310b48..de6fa34cc976 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/operationsListSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/operationsListSample.ts @@ -1,32 +1,28 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists all of the available cost management REST API operations. + * This sample demonstrates how to list the operations for the provider * - * @summary Lists all of the available cost management REST API operations. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/OperationList.json + * @summary list the operations for the provider + * x-ms-original-file: 2025-03-01/OperationList.json */ async function operationList(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.operations.list()) { + for await (const item of client.operations.list()) { resArray.push(item); } + console.log(resArray); } async function main(): Promise { - operationList(); + await operationList(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/priceSheetDownloadByBillingAccountSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/priceSheetDownloadByBillingAccountSample.ts new file mode 100644 index 000000000000..8e4c12e3c044 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/priceSheetDownloadByBillingAccountSample.ts @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to generates the pricesheet for the provided billing period asynchronously based on the Enrollment ID. This is for Enterprise Agreement customers. + * + * **Migrate to version 2025-03-01** + * + * You can use the 2025-03-01 API version with the new URI: + * + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.CostManagement/pricesheets/default/download' + * + * With a new schema detailed below, the new version of the price sheet provides additional information and includes prices for Azure Reserved Instances (RI) for the current billing period. We recommend downloading an Azure Price Sheet for when entering a new billing period if you would maintain an ongoing record of past Azure Reserved Instance (RI) pricing. + * + * The EA Azure price sheet is available for billing periods in the past 13 months. To request a price sheet for a billing period older than 13 months, please contact support. + * + * The Azure price sheet download experience has been updated from a single .csv file to a zip file containing multiple .csv files, each with max size of 75MB. The 2023-11-01 version has been upgraded to use http POST method; details can be found below. + * + * All versions of the Microsoft.Consumption Azure Price Sheet - Download by Billing Account (including 2022-06-01, 2021-10-01, 2020-01-01-preview, 2019-10-01, 2019-05-01) are scheduled to be retired on 01 June 2026 and will no longer be supported after this date. + * + * @summary generates the pricesheet for the provided billing period asynchronously based on the Enrollment ID. This is for Enterprise Agreement customers. + * + * **Migrate to version 2025-03-01** + * + * You can use the 2025-03-01 API version with the new URI: + * + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.CostManagement/pricesheets/default/download' + * + * With a new schema detailed below, the new version of the price sheet provides additional information and includes prices for Azure Reserved Instances (RI) for the current billing period. We recommend downloading an Azure Price Sheet for when entering a new billing period if you would maintain an ongoing record of past Azure Reserved Instance (RI) pricing. + * + * The EA Azure price sheet is available for billing periods in the past 13 months. To request a price sheet for a billing period older than 13 months, please contact support. + * + * The Azure price sheet download experience has been updated from a single .csv file to a zip file containing multiple .csv files, each with max size of 75MB. The 2023-11-01 version has been upgraded to use http POST method; details can be found below. + * + * All versions of the Microsoft.Consumption Azure Price Sheet - Download by Billing Account (including 2022-06-01, 2021-10-01, 2020-01-01-preview, 2019-10-01, 2019-05-01) are scheduled to be retired on 01 June 2026 and will no longer be supported after this date. + * x-ms-original-file: 2025-03-01/EAPriceSheetForBillingPeriod.json + */ +async function eaPriceSheetForBillingPeriod(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.priceSheet.downloadByBillingAccount("0000000", "202311"); + console.log(result); +} + +async function main(): Promise { + await eaPriceSheetForBillingPeriod(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/priceSheetDownloadByBillingProfileSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/priceSheetDownloadByBillingProfileSample.ts index ba791975d5da..cabc95ca36c8 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/priceSheetDownloadByBillingProfileSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/priceSheetDownloadByBillingProfileSample.ts @@ -1,35 +1,35 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. + * + * You can use the new 2023-09-01 API version for billing periods January 2023 onwards. Azure Reserved Instance (RI) pricing is only available through the new version of the API. + * + * Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv/json file to a Zip file containing multiple csv/json files, each with max size of 75MB. + * + * @summary 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. + * + * You can use the new 2023-09-01 API version for billing periods January 2023 onwards. Azure Reserved Instance (RI) pricing is only available through the new version of the API. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PricesheetDownloadByBillingProfile.json + * Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv/json file to a Zip file containing multiple csv/json files, each with max size of 75MB. + * x-ms-original-file: 2025-03-01/PricesheetDownloadByBillingProfile.json */ async function pricesheetDownloadByBillingProfile(): Promise { - const billingAccountName = - "7c05a543-80ff-571e-9f98-1063b3b53cf2:99ad03ad-2d1b-4889-a452-090ad407d25f_2019-05-31"; - const billingProfileName = "2USN-TPCD-BG7-TGB"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.priceSheet.beginDownloadByBillingProfileAndWait( - billingAccountName, - billingProfileName + const result = await client.priceSheet.downloadByBillingProfile( + "7c05a543-80ff-571e-9f98-1063b3b53cf2:99ad03ad-2d1b-4889-a452-090ad407d25f_2019-05-31", + "2USN-TPCD-BG7-TGB", ); console.log(result); } async function main(): Promise { - pricesheetDownloadByBillingProfile(); + await pricesheetDownloadByBillingProfile(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/priceSheetDownloadByInvoiceSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/priceSheetDownloadByInvoiceSample.ts new file mode 100644 index 000000000000..cb43bf813647 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/priceSheetDownloadByInvoiceSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to 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. + * + * @summary 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. + * x-ms-original-file: 2025-03-01/PricesheetDownload.json + */ +async function pricesheetDownload(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.priceSheet.downloadByInvoice( + "7c05a543-80ff-571e-9f98-1063b3b53cf2:99ad03ad-2d1b-4889-a452-090ad407d25f_2019-05-31", + "2USN-TPCD-BG7-TGB", + "T000940677", + ); + console.log(result); +} + +async function main(): Promise { + await pricesheetDownload(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/priceSheetDownloadSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/priceSheetDownloadSample.ts deleted file mode 100644 index b2032db5ee44..000000000000 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/priceSheetDownloadSample.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { CostManagementClient } from "@azure/arm-costmanagement"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to 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. - * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PricesheetDownload.json - */ -async function pricesheetDownload(): Promise { - const billingAccountName = - "7c05a543-80ff-571e-9f98-1063b3b53cf2:99ad03ad-2d1b-4889-a452-090ad407d25f_2019-05-31"; - const billingProfileName = "2USN-TPCD-BG7-TGB"; - const invoiceName = "T000940677"; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.priceSheet.beginDownloadAndWait( - billingAccountName, - billingProfileName, - invoiceName - ); - console.log(result); -} - -async function main(): Promise { - pricesheetDownload(); -} - -main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/queryUsageByExternalCloudProviderTypeSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/queryUsageByExternalCloudProviderTypeSample.ts index a455e416f644..8673c54109d0 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/queryUsageByExternalCloudProviderTypeSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/queryUsageByExternalCloudProviderTypeSample.ts @@ -1,130 +1,92 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { - QueryDefinition, - CostManagementClient -} from "@azure/arm-costmanagement"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Query the usage data for external cloud provider type defined. + * This sample demonstrates how to query the usage data for external cloud provider type defined. * - * @summary Query the usage data for external cloud provider type defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalBillingAccountsQuery.json + * @summary query the usage data for external cloud provider type defined. + * x-ms-original-file: 2025-03-01/ExternalBillingAccountsQuery.json */ async function externalBillingAccountQueryList(): Promise { - const externalCloudProviderType = "externalBillingAccounts"; - const externalCloudProviderId = "100"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"] - } - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"] - } - } - ] - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"] - } - } - ] - }, - granularity: "Daily" - }, - timeframe: "MonthToDate" - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const result = await client.query.usageByExternalCloudProviderType( - externalCloudProviderType, - externalCloudProviderId, - parameters + "externalBillingAccounts", + "100", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, + }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], + }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", + }, + timeframe: "MonthToDate", + }, ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for external cloud provider type defined. + * This sample demonstrates how to query the usage data for external cloud provider type defined. * - * @summary Query the usage data for external cloud provider type defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalSubscriptionsQuery.json + * @summary query the usage data for external cloud provider type defined. + * x-ms-original-file: 2025-03-01/ExternalSubscriptionsQuery.json */ async function externalSubscriptionsQuery(): Promise { - const externalCloudProviderType = "externalSubscriptions"; - const externalCloudProviderId = "100"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"] - } - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"] - } - } - ] - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"] - } - } - ] - }, - granularity: "Daily" - }, - timeframe: "MonthToDate" - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const result = await client.query.usageByExternalCloudProviderType( - externalCloudProviderType, - externalCloudProviderId, - parameters + "externalSubscriptions", + "100", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, + }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], + }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", + }, + timeframe: "MonthToDate", + }, ); console.log(result); } async function main(): Promise { - externalBillingAccountQueryList(); - externalSubscriptionsQuery(); + await externalBillingAccountQueryList(); + await externalSubscriptionsQuery(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/queryUsageSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/queryUsageSample.ts index 4b497dc4d8af..6094c6056deb 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/queryUsageSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/queryUsageSample.ts @@ -1,26 +1,19 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { - QueryDefinition, - CostManagementClient -} from "@azure/arm-costmanagement"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/BillingAccountQuery.json */ async function billingAccountQueryLegacy(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/70664866"; - const parameters: QueryDefinition = { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage("providers/Microsoft.Billing/billingAccounts/70664866", { type: "Usage", dataset: { filter: { @@ -31,665 +24,557 @@ async function billingAccountQueryLegacy(): Promise { dimensions: { name: "ResourceLocation", operator: "In", - values: ["East US", "West Europe"] - } + values: ["East US", "West Europe"], + }, }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"] - } - } - ] + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"] - } - } - ] + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], }, - granularity: "Daily" + granularity: "Daily", }, - timeframe: "MonthToDate" - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + timeframe: "MonthToDate", + }); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingAccountQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/BillingAccountQueryGrouping.json */ -async function billingAccountQueryMca(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789"; - const parameters: QueryDefinition = { +async function billingAccountQueryGroupingLegacy(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage("providers/Microsoft.Billing/billingAccounts/70664866", { type: "Usage", dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"] - } - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"] - } - } - ] - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"] - } - } - ] - }, - granularity: "Daily" + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "None", + grouping: [{ name: "ResourceGroup", type: "Dimension" }], }, - timeframe: "MonthToDate" - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + timeframe: "TheLastMonth", + }); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/DepartmentQuery.json */ -async function billingAccountQueryGroupingLegacy(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/70664866"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "None", - grouping: [{ name: "ResourceGroup", type: "Dimension" }] - }, - timeframe: "TheLastMonth" - }; +async function departmentQueryLegacy(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/100/departments/123", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, + }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], + }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", + }, + timeframe: "MonthToDate", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingAccountQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/DepartmentQueryGrouping.json */ -async function billingAccountQueryGroupingMca(): Promise { - const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "None", - grouping: [{ name: "ResourceGroup", type: "Dimension" }] - }, - timeframe: "TheLastMonth" - }; +async function departmentQueryGroupingLegacy(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/100/departments/123", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "None", + grouping: [{ name: "ResourceGroup", type: "Dimension" }], + }, + timeframe: "TheLastMonth", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingProfileQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/EnrollmentAccountQuery.json */ -async function billingProfileQueryMca(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"] - } - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"] - } - } - ] - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"] - } - } - ] - }, - granularity: "Daily" - }, - timeframe: "MonthToDate" - }; +async function enrollmentAccountQueryLegacy(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, + }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], + }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", + }, + timeframe: "MonthToDate", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingProfileQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/EnrollmentAccountQueryGrouping.json */ -async function billingProfileQueryGroupingMca(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "None", - grouping: [{ name: "ResourceGroup", type: "Dimension" }] - }, - timeframe: "TheLastMonth" - }; +async function enrollmentAccountQueryGroupingLegacy(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "Daily", + grouping: [{ name: "ResourceGroup", type: "Dimension" }], + }, + timeframe: "TheLastMonth", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCACustomerQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/MCABillingAccountQuery.json */ -async function customerQueryMca(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"] - } - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"] - } - } - ] - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"] - } - } - ] - }, - granularity: "Daily" - }, - timeframe: "MonthToDate" - }; +async function billingAccountQueryMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, + }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], + }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", + }, + timeframe: "MonthToDate", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCACustomerQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/MCABillingAccountQueryGrouping.json */ -async function customerQueryGroupingMca(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "None", - grouping: [{ name: "ResourceGroup", type: "Dimension" }] - }, - timeframe: "TheLastMonth" - }; +async function billingAccountQueryGroupingMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "None", + grouping: [{ name: "ResourceGroup", type: "Dimension" }], + }, + timeframe: "TheLastMonth", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/MCABillingProfileQuery.json */ -async function departmentQueryLegacy(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/100/departments/123"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"] - } - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"] - } - } - ] - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"] - } - } - ] - }, - granularity: "Daily" - }, - timeframe: "MonthToDate" - }; +async function billingProfileQueryMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, + }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], + }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", + }, + timeframe: "MonthToDate", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/MCABillingProfileQueryGrouping.json */ -async function departmentQueryGroupingLegacy(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/100/departments/123"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "None", - grouping: [{ name: "ResourceGroup", type: "Dimension" }] - }, - timeframe: "TheLastMonth" - }; +async function billingProfileQueryGroupingMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "None", + grouping: [{ name: "ResourceGroup", type: "Dimension" }], + }, + timeframe: "TheLastMonth", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/MCACustomerQuery.json */ -async function enrollmentAccountQueryLegacy(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"] - } - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"] - } - } - ] - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"] - } - } - ] - }, - granularity: "Daily" - }, - timeframe: "MonthToDate" - }; +async function customerQueryMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, + }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], + }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", + }, + timeframe: "MonthToDate", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/MCACustomerQueryGrouping.json */ -async function enrollmentAccountQueryGroupingLegacy(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "Daily", - grouping: [{ name: "ResourceGroup", type: "Dimension" }] - }, - timeframe: "TheLastMonth" - }; +async function customerQueryGroupingMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "None", + grouping: [{ name: "ResourceGroup", type: "Dimension" }], + }, + timeframe: "TheLastMonth", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCAInvoiceSectionQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/MCAInvoiceSectionQuery.json */ -async function invoiceSectionQueryMca(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"] - } - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"] - } - } - ] - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"] - } - } - ] - }, - granularity: "Daily" - }, - timeframe: "MonthToDate" - }; +async function invoiceSectionQueryMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, + }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], + }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", + }, + timeframe: "MonthToDate", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCAInvoiceSectionQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/MCAInvoiceSectionQueryGrouping.json */ -async function invoiceSectionQueryGroupingMca(): Promise { - const scope = - "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "None", - grouping: [{ name: "ResourceGroup", type: "Dimension" }] - }, - timeframe: "TheLastMonth" - }; +async function invoiceSectionQueryGroupingMCA(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "None", + grouping: [{ name: "ResourceGroup", type: "Dimension" }], + }, + timeframe: "TheLastMonth", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ManagementGroupQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/ManagementGroupQuery.json */ async function managementGroupQueryLegacy(): Promise { - const scope = "providers/Microsoft.Management/managementGroups/MyMgId"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"] - } - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"] - } - } - ] - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"] - } - } - ] - }, - granularity: "Daily" - }, - timeframe: "MonthToDate" - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Management/managementGroups/MyMgId", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, + }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], + }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", + }, + timeframe: "MonthToDate", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ManagementGroupQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/ManagementGroupQueryGrouping.json */ async function managementGroupQueryGroupingLegacy(): Promise { - const scope = "providers/Microsoft.Management/managementGroups/MyMgId"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "None", - grouping: [{ name: "ResourceGroup", type: "Dimension" }] - }, - timeframe: "TheLastMonth" - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "providers/Microsoft.Management/managementGroups/MyMgId", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "None", + grouping: [{ name: "ResourceGroup", type: "Dimension" }], + }, + timeframe: "TheLastMonth", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ResourceGroupQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/ResourceGroupQuery.json */ async function resourceGroupQueryLegacy(): Promise { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - filter: { - and: [ - { - or: [ - { - dimensions: { - name: "ResourceLocation", - operator: "In", - values: ["East US", "West Europe"] - } - }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"] - } - } - ] - }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"] - } - } - ] - }, - granularity: "Daily" - }, - timeframe: "MonthToDate" - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", + { + type: "Usage", + dataset: { + filter: { + and: [ + { + or: [ + { + dimensions: { + name: "ResourceLocation", + operator: "In", + values: ["East US", "West Europe"], + }, + }, + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], + }, + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], + }, + granularity: "Daily", + }, + timeframe: "MonthToDate", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ResourceGroupQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/ResourceGroupQueryGrouping.json */ async function resourceGroupQueryGroupingLegacy(): Promise { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"; - const parameters: QueryDefinition = { - type: "Usage", - dataset: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "Daily", - grouping: [{ name: "ResourceType", type: "Dimension" }] - }, - timeframe: "TheLastMonth" - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + const result = await client.query.usage( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", + { + type: "Usage", + dataset: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "Daily", + grouping: [{ name: "ResourceType", type: "Dimension" }], + }, + timeframe: "TheLastMonth", + }, + ); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SubscriptionQuery.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/SubscriptionQuery.json */ async function subscriptionQueryLegacy(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const parameters: QueryDefinition = { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage("subscriptions/00000000-0000-0000-0000-000000000000", { type: "Usage", dataset: { filter: { @@ -700,81 +585,64 @@ async function subscriptionQueryLegacy(): Promise { dimensions: { name: "ResourceLocation", operator: "In", - values: ["East US", "West Europe"] - } + values: ["East US", "West Europe"], + }, }, - { - tags: { - name: "Environment", - operator: "In", - values: ["UAT", "Prod"] - } - } - ] + { tags: { name: "Environment", operator: "In", values: ["UAT", "Prod"] } }, + ], }, - { - dimensions: { - name: "ResourceGroup", - operator: "In", - values: ["API"] - } - } - ] + { dimensions: { name: "ResourceGroup", operator: "In", values: ["API"] } }, + ], }, - granularity: "Daily" + granularity: "Daily", }, - timeframe: "MonthToDate" - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + timeframe: "MonthToDate", + }); console.log(result); } /** - * This sample demonstrates how to Query the usage data for scope defined. + * This sample demonstrates how to query the usage data for scope defined. * - * @summary Query the usage data for scope defined. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SubscriptionQueryGrouping.json + * @summary query the usage data for scope defined. + * x-ms-original-file: 2025-03-01/SubscriptionQueryGrouping.json */ async function subscriptionQueryGroupingLegacy(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const parameters: QueryDefinition = { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.query.usage("subscriptions/00000000-0000-0000-0000-000000000000", { type: "Usage", dataset: { aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, granularity: "None", - grouping: [{ name: "ResourceGroup", type: "Dimension" }] + grouping: [{ name: "ResourceGroup", type: "Dimension" }], }, - timeframe: "TheLastMonth" - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.query.usage(scope, parameters); + timeframe: "TheLastMonth", + }); console.log(result); } async function main(): Promise { - billingAccountQueryLegacy(); - billingAccountQueryMca(); - billingAccountQueryGroupingLegacy(); - billingAccountQueryGroupingMca(); - billingProfileQueryMca(); - billingProfileQueryGroupingMca(); - customerQueryMca(); - customerQueryGroupingMca(); - departmentQueryLegacy(); - departmentQueryGroupingLegacy(); - enrollmentAccountQueryLegacy(); - enrollmentAccountQueryGroupingLegacy(); - invoiceSectionQueryMca(); - invoiceSectionQueryGroupingMca(); - managementGroupQueryLegacy(); - managementGroupQueryGroupingLegacy(); - resourceGroupQueryLegacy(); - resourceGroupQueryGroupingLegacy(); - subscriptionQueryLegacy(); - subscriptionQueryGroupingLegacy(); + await billingAccountQueryLegacy(); + await billingAccountQueryGroupingLegacy(); + await departmentQueryLegacy(); + await departmentQueryGroupingLegacy(); + await enrollmentAccountQueryLegacy(); + await enrollmentAccountQueryGroupingLegacy(); + await billingAccountQueryMCA(); + await billingAccountQueryGroupingMCA(); + await billingProfileQueryMCA(); + await billingProfileQueryGroupingMCA(); + await customerQueryMCA(); + await customerQueryGroupingMCA(); + await invoiceSectionQueryMCA(); + await invoiceSectionQueryGroupingMCA(); + await managementGroupQueryLegacy(); + await managementGroupQueryGroupingLegacy(); + await resourceGroupQueryLegacy(); + await resourceGroupQueryGroupingLegacy(); + await subscriptionQueryLegacy(); + await subscriptionQueryGroupingLegacy(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsCheckNameAvailabilityByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsCheckNameAvailabilityByScopeSample.ts index fe94030dd226..394513bc53f1 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsCheckNameAvailabilityByScopeSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsCheckNameAvailabilityByScopeSample.ts @@ -1,40 +1,27 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { - CheckNameAvailabilityRequest, - CostManagementClient -} from "@azure/arm-costmanagement"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Checks availability and correctness of the name for a scheduled action within the given scope. + * This sample demonstrates how to checks availability and correctness of the name for a scheduled action within the given scope. * - * @summary Checks availability and correctness of the name for a scheduled action within the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/checkNameAvailability-shared-scheduledAction.json + * @summary checks availability and correctness of the name for a scheduled action within the given scope. + * x-ms-original-file: 2025-03-01/scheduledActions/checkNameAvailability-shared-scheduledAction.json */ async function scheduledActionCheckNameAvailabilityByScope(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const checkNameAvailabilityRequest: CheckNameAvailabilityRequest = { - name: "testName", - type: "Microsoft.CostManagement/ScheduledActions" - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const result = await client.scheduledActions.checkNameAvailabilityByScope( - scope, - checkNameAvailabilityRequest + "subscriptions/00000000-0000-0000-0000-000000000000", + { name: "testName", type: "Microsoft.CostManagement/ScheduledActions" }, ); console.log(result); } async function main(): Promise { - scheduledActionCheckNameAvailabilityByScope(); + await scheduledActionCheckNameAvailabilityByScope(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsCheckNameAvailabilitySample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsCheckNameAvailabilitySample.ts index fdd389f27cab..c0e2b0bf9f09 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsCheckNameAvailabilitySample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsCheckNameAvailabilitySample.ts @@ -1,38 +1,27 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { - CheckNameAvailabilityRequest, - CostManagementClient -} from "@azure/arm-costmanagement"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Checks availability and correctness of the name for a scheduled action. + * This sample demonstrates how to checks availability and correctness of the name for a scheduled action. * - * @summary Checks availability and correctness of the name for a scheduled action. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/checkNameAvailability-private-scheduledAction.json + * @summary checks availability and correctness of the name for a scheduled action. + * x-ms-original-file: 2025-03-01/scheduledActions/checkNameAvailability-private-scheduledAction.json */ async function scheduledActionCheckNameAvailability(): Promise { - const checkNameAvailabilityRequest: CheckNameAvailabilityRequest = { - name: "testName", - type: "Microsoft.CostManagement/ScheduledActions" - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.scheduledActions.checkNameAvailability( - checkNameAvailabilityRequest - ); + const result = await client.scheduledActions.checkNameAvailability({ + name: "testName", + type: "Microsoft.CostManagement/ScheduledActions", + }); console.log(result); } async function main(): Promise { - scheduledActionCheckNameAvailability(); + await scheduledActionCheckNameAvailability(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsCreateOrUpdateByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsCreateOrUpdateByScopeSample.ts index a7145080052f..156f0102a271 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsCreateOrUpdateByScopeSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsCreateOrUpdateByScopeSample.ts @@ -1,103 +1,80 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { - ScheduledAction, - ScheduledActionsCreateOrUpdateByScopeOptionalParams, - CostManagementClient -} from "@azure/arm-costmanagement"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Create or update a shared scheduled action within the given scope. + * This sample demonstrates how to create or update a shared scheduled action within the given scope. * - * @summary Create or update a shared scheduled action within the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-insightAlert-createOrUpdate-shared.json + * @summary create or update a shared scheduled action within the given scope. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-createOrUpdate-shared.json */ -async function createOrUpdateInsightAlertScheduledActionByScope(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const name = "dailyAnomalyByResource"; - const ifMatch = ""; - const scheduledAction: ScheduledAction = { - displayName: "Daily anomaly by resource", - kind: "InsightAlert", - notification: { - subject: "Cost anomaly detected in the resource", - to: ["user@gmail.com", "team@gmail.com"] - }, - schedule: { - endDate: new Date("2021-06-19T22:21:51.1287144Z"), - frequency: "Daily", - startDate: new Date("2020-06-19T22:21:51.1287144Z") - }, - status: "Enabled", - viewId: "/providers/Microsoft.CostManagement/views/swaggerExample" - }; - const options: ScheduledActionsCreateOrUpdateByScopeOptionalParams = { - ifMatch - }; +async function createOrUpdateScheduledActionByScope(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const result = await client.scheduledActions.createOrUpdateByScope( - scope, - name, - scheduledAction, - options + "subscriptions/00000000-0000-0000-0000-000000000000", + "monthlyCostByResource", + { + kind: "Email", + displayName: "Monthly Cost By Resource", + fileDestination: { fileFormats: ["Csv"] }, + notification: { + subject: "Cost by resource this month", + to: ["user@gmail.com", "team@gmail.com"], + }, + schedule: { + daysOfWeek: ["Monday"], + endDate: new Date("2021-06-19T22:21:51.1287144Z"), + frequency: "Monthly", + hourOfDay: 10, + startDate: new Date("2020-06-19T22:21:51.1287144Z"), + weeksOfMonth: ["First", "Third"], + }, + status: "Enabled", + viewId: "/providers/Microsoft.CostManagement/views/swaggerExample", + }, + { ifMatch: "" }, ); console.log(result); } /** - * This sample demonstrates how to Create or update a shared scheduled action within the given scope. + * This sample demonstrates how to create or update a shared scheduled action within the given scope. * - * @summary Create or update a shared scheduled action within the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-createOrUpdate-shared.json + * @summary create or update a shared scheduled action within the given scope. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-insightAlert-createOrUpdate-shared.json */ -async function createOrUpdateScheduledActionByScope(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const name = "monthlyCostByResource"; - const ifMatch = ""; - const scheduledAction: ScheduledAction = { - displayName: "Monthly Cost By Resource", - fileDestination: { fileFormats: ["Csv"] }, - kind: "Email", - notification: { - subject: "Cost by resource this month", - to: ["user@gmail.com", "team@gmail.com"] - }, - schedule: { - daysOfWeek: ["Monday"], - endDate: new Date("2021-06-19T22:21:51.1287144Z"), - frequency: "Monthly", - hourOfDay: 10, - startDate: new Date("2020-06-19T22:21:51.1287144Z"), - weeksOfMonth: ["First", "Third"] - }, - status: "Enabled", - viewId: "/providers/Microsoft.CostManagement/views/swaggerExample" - }; - const options: ScheduledActionsCreateOrUpdateByScopeOptionalParams = { - ifMatch - }; +async function createOrUpdateInsightAlertScheduledActionByScope(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const result = await client.scheduledActions.createOrUpdateByScope( - scope, - name, - scheduledAction, - options + "subscriptions/00000000-0000-0000-0000-000000000000", + "dailyAnomalyByResource", + { + kind: "InsightAlert", + displayName: "Daily anomaly by resource", + notification: { + subject: "Cost anomaly detected in the resource", + to: ["user@gmail.com", "team@gmail.com"], + }, + schedule: { + endDate: new Date("2021-06-19T22:21:51.1287144Z"), + frequency: "Daily", + startDate: new Date("2020-06-19T22:21:51.1287144Z"), + }, + status: "Enabled", + viewId: "/providers/Microsoft.CostManagement/views/swaggerExample", + }, + { ifMatch: "" }, ); console.log(result); } async function main(): Promise { - createOrUpdateInsightAlertScheduledActionByScope(); - createOrUpdateScheduledActionByScope(); + await createOrUpdateScheduledActionByScope(); + await createOrUpdateInsightAlertScheduledActionByScope(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsCreateOrUpdateSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsCreateOrUpdateSample.ts index 8f36ec01f17f..6d9529d1164b 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsCreateOrUpdateSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsCreateOrUpdateSample.ts @@ -1,58 +1,45 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { - ScheduledAction, - ScheduledActionsCreateOrUpdateOptionalParams, - CostManagementClient -} from "@azure/arm-costmanagement"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Create or update a private scheduled action. + * This sample demonstrates how to create or update a private scheduled action. * - * @summary Create or update a private scheduled action. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-createOrUpdate-private.json + * @summary create or update a private scheduled action. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-createOrUpdate-private.json */ async function createOrUpdatePrivateScheduledAction(): Promise { - const name = "monthlyCostByResource"; - const ifMatch = ""; - const scheduledAction: ScheduledAction = { - displayName: "Monthly Cost By Resource", - kind: "Email", - notification: { - subject: "Cost by resource this month", - to: ["user@gmail.com", "team@gmail.com"] - }, - schedule: { - daysOfWeek: ["Monday"], - endDate: new Date("2021-06-19T22:21:51.1287144Z"), - frequency: "Monthly", - hourOfDay: 10, - startDate: new Date("2020-06-19T22:21:51.1287144Z"), - weeksOfMonth: ["First", "Third"] - }, - status: "Enabled", - viewId: "/providers/Microsoft.CostManagement/views/swaggerExample" - }; - const options: ScheduledActionsCreateOrUpdateOptionalParams = { ifMatch }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const result = await client.scheduledActions.createOrUpdate( - name, - scheduledAction, - options + "monthlyCostByResource", + { + kind: "Email", + displayName: "Monthly Cost By Resource", + notification: { + subject: "Cost by resource this month", + to: ["user@gmail.com", "team@gmail.com"], + }, + schedule: { + daysOfWeek: ["Monday"], + endDate: new Date("2021-06-19T22:21:51.1287144Z"), + frequency: "Monthly", + hourOfDay: 10, + startDate: new Date("2020-06-19T22:21:51.1287144Z"), + weeksOfMonth: ["First", "Third"], + }, + status: "Enabled", + viewId: "/providers/Microsoft.CostManagement/views/swaggerExample", + }, + { ifMatch: "" }, ); console.log(result); } async function main(): Promise { - createOrUpdatePrivateScheduledAction(); + await createOrUpdatePrivateScheduledAction(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsDeleteByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsDeleteByScopeSample.ts index 1221a46232e3..c90a73712fde 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsDeleteByScopeSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsDeleteByScopeSample.ts @@ -1,31 +1,26 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Delete a scheduled action within the given scope. + * This sample demonstrates how to delete a scheduled action within the given scope. * - * @summary Delete a scheduled action within the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-delete-shared.json + * @summary delete a scheduled action within the given scope. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-delete-shared.json */ async function scheduledActionDeleteByScope(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const name = "monthlyCostByResource"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.scheduledActions.deleteByScope(scope, name); - console.log(result); + await client.scheduledActions.deleteByScope( + "subscriptions/00000000-0000-0000-0000-000000000000", + "monthlyCostByResource", + ); } async function main(): Promise { - scheduledActionDeleteByScope(); + await scheduledActionDeleteByScope(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsDeleteSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsDeleteSample.ts index 42d4a0c98a25..a98e831b0f17 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsDeleteSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsDeleteSample.ts @@ -1,30 +1,23 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Delete a private scheduled action. + * This sample demonstrates how to delete a private scheduled action. * - * @summary Delete a private scheduled action. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-delete-private.json + * @summary delete a private scheduled action. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-delete-private.json */ async function privateScheduledActionDelete(): Promise { - const name = "monthlyCostByResource"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.scheduledActions.delete(name); - console.log(result); + await client.scheduledActions.delete("monthlyCostByResource"); } async function main(): Promise { - privateScheduledActionDelete(); + await privateScheduledActionDelete(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsGetByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsGetByScopeSample.ts index f1be79ee64c5..8974e1bcc6ea 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsGetByScopeSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsGetByScopeSample.ts @@ -1,31 +1,27 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get the shared scheduled action from the given scope by name. + * This sample demonstrates how to get the shared scheduled action from the given scope by name. * - * @summary Get the shared scheduled action from the given scope by name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-get-shared.json + * @summary get the shared scheduled action from the given scope by name. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-get-shared.json */ async function scheduledActionByScope(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const name = "monthlyCostByResource"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.scheduledActions.getByScope(scope, name); + const result = await client.scheduledActions.getByScope( + "subscriptions/00000000-0000-0000-0000-000000000000", + "monthlyCostByResource", + ); console.log(result); } async function main(): Promise { - scheduledActionByScope(); + await scheduledActionByScope(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsGetSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsGetSample.ts index b64241fbc86d..3b809ee5b5aa 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsGetSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsGetSample.ts @@ -1,30 +1,24 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get the private scheduled action by name. + * This sample demonstrates how to get the private scheduled action by name. * - * @summary Get the private scheduled action by name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-get-private.json + * @summary get the private scheduled action by name. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-get-private.json */ async function privateScheduledAction(): Promise { - const name = "monthlyCostByResource"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.scheduledActions.get(name); + const result = await client.scheduledActions.get("monthlyCostByResource"); console.log(result); } async function main(): Promise { - privateScheduledAction(); + await privateScheduledAction(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsListByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsListByScopeSample.ts index 724ee0b27994..e6a6a55aca09 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsListByScopeSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsListByScopeSample.ts @@ -1,57 +1,51 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { - ScheduledActionsListByScopeOptionalParams, - CostManagementClient -} from "@azure/arm-costmanagement"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List all shared scheduled actions within the given scope. + * This sample demonstrates how to list all shared scheduled actions within the given scope. * - * @summary List all shared scheduled actions within the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledActions-list-shared.json + * @summary list all shared scheduled actions within the given scope. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledActions-list-shared.json */ async function scheduledActionsListByScope(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.scheduledActions.listByScope(scope)) { + for await (const item of client.scheduledActions.listByScope( + "subscriptions/00000000-0000-0000-0000-000000000000", + )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to List all shared scheduled actions within the given scope. + * This sample demonstrates how to list all shared scheduled actions within the given scope. * - * @summary List all shared scheduled actions within the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledActions-listWithFilter-shared.json + * @summary list all shared scheduled actions within the given scope. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledActions-listWithFilter-shared.json */ async function scheduledActionsListByScopeFilterByViewId(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const filter = - "properties/viewId eq '/providers/Microsoft.CostManagement/views/swaggerExample'"; - const options: ScheduledActionsListByScopeOptionalParams = { filter }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.scheduledActions.listByScope(scope, options)) { + for await (const item of client.scheduledActions.listByScope( + "subscriptions/00000000-0000-0000-0000-000000000000", + { filter: "properties/viewId eq '/providers/Microsoft.CostManagement/views/swaggerExample'" }, + )) { resArray.push(item); } + console.log(resArray); } async function main(): Promise { - scheduledActionsListByScope(); - scheduledActionsListByScopeFilterByViewId(); + await scheduledActionsListByScope(); + await scheduledActionsListByScopeFilterByViewId(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsListSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsListSample.ts index b8e3ea28632b..f7a471c472a4 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsListSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsListSample.ts @@ -1,55 +1,48 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { - ScheduledActionsListOptionalParams, - CostManagementClient -} from "@azure/arm-costmanagement"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List all private scheduled actions. + * This sample demonstrates how to list all private scheduled actions. * - * @summary List all private scheduled actions. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledActions-list-private.json + * @summary list all private scheduled actions. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledActions-list-private.json */ async function privateScheduledActionsList(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.scheduledActions.list()) { + for await (const item of client.scheduledActions.list()) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to List all private scheduled actions. + * This sample demonstrates how to list all private scheduled actions. * - * @summary List all private scheduled actions. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledActions-listWithFilter-private.json + * @summary list all private scheduled actions. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledActions-listWithFilter-private.json */ async function privateScheduledActionsListFilterByViewId(): Promise { - const filter = - "properties/viewId eq '/providers/Microsoft.CostManagement/views/swaggerExample'"; - const options: ScheduledActionsListOptionalParams = { filter }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.scheduledActions.list(options)) { + for await (const item of client.scheduledActions.list({ + filter: "properties/viewId eq '/providers/Microsoft.CostManagement/views/swaggerExample'", + })) { resArray.push(item); } + console.log(resArray); } async function main(): Promise { - privateScheduledActionsList(); - privateScheduledActionsListFilterByViewId(); + await privateScheduledActionsList(); + await privateScheduledActionsListFilterByViewId(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsRunByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsRunByScopeSample.ts index 7cfab0a0bef5..621b8543949c 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsRunByScopeSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsRunByScopeSample.ts @@ -1,31 +1,26 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Runs a shared scheduled action within the given scope. + * This sample demonstrates how to runs a shared scheduled action within the given scope. * - * @summary Runs a shared scheduled action within the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-sendNow-shared.json + * @summary runs a shared scheduled action within the given scope. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-sendNow-shared.json */ async function scheduledActionRunByScope(): Promise { - const scope = "subscriptions/00000000-0000-0000-0000-000000000000"; - const name = "monthlyCostByResource"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.scheduledActions.runByScope(scope, name); - console.log(result); + await client.scheduledActions.runByScope( + "subscriptions/00000000-0000-0000-0000-000000000000", + "monthlyCostByResource", + ); } async function main(): Promise { - scheduledActionRunByScope(); + await scheduledActionRunByScope(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsRunSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsRunSample.ts index 1cdc83e58738..5698f838a7e4 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsRunSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/scheduledActionsRunSample.ts @@ -1,30 +1,23 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Processes a private scheduled action. + * This sample demonstrates how to processes a private scheduled action. * - * @summary Processes a private scheduled action. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-sendNow-private.json + * @summary processes a private scheduled action. + * x-ms-original-file: 2025-03-01/scheduledActions/scheduledAction-sendNow-private.json */ async function scheduledActionSendNow(): Promise { - const name = "monthlyCostByResource"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.scheduledActions.run(name); - console.log(result); + await client.scheduledActions.run("monthlyCostByResource"); } async function main(): Promise { - scheduledActionSendNow(); + await scheduledActionSendNow(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/settingsCreateOrUpdateByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/settingsCreateOrUpdateByScopeSample.ts new file mode 100644 index 000000000000..27e173b5c493 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/settingsCreateOrUpdateByScopeSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create or update a setting within the given scope. + * + * @summary create or update a setting within the given scope. + * x-ms-original-file: 2025-03-01/settings-createOrUpdate.json + */ +async function createOrUpdateSettingByScope(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.settings.createOrUpdateByScope( + "subscriptions/00000000-0000-0000-0000-000000000000", + "taginheritance", + { kind: "taginheritance", properties: { preferContainerTags: false } }, + ); + console.log(result); +} + +async function main(): Promise { + await createOrUpdateSettingByScope(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/settingsDeleteByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/settingsDeleteByScopeSample.ts new file mode 100644 index 000000000000..9097a97031ff --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/settingsDeleteByScopeSample.ts @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a setting within the given scope. + * + * @summary delete a setting within the given scope. + * x-ms-original-file: 2025-03-01/setting-delete.json + */ +async function settingDeleteByScope(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + await client.settings.deleteByScope( + "subscriptions/00000000-0000-0000-0000-000000000000", + "taginheritance", + ); +} + +async function main(): Promise { + await settingDeleteByScope(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/settingsGetByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/settingsGetByScopeSample.ts new file mode 100644 index 000000000000..780a4dc0fddc --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/settingsGetByScopeSample.ts @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get the setting from the given scope by name. + * + * @summary get the setting from the given scope by name. + * x-ms-original-file: 2025-03-01/setting-get.json + */ +async function settingByScope(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.settings.getByScope( + "subscriptions/00000000-0000-0000-0000-000000000000", + "taginheritance", + ); + console.log(result); +} + +async function main(): Promise { + await settingByScope(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/settingsListSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/settingsListSample.ts new file mode 100644 index 000000000000..0ef5ea4ce75d --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/settingsListSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list all cost management settings in the requested scope. + * + * @summary list all cost management settings in the requested scope. + * x-ms-original-file: 2025-03-01/settingsList.json + */ +async function settingsList(): Promise { + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.settings.list("subscriptions/00000000-0000-0000-0000-000000000000"); + console.log(result); +} + +async function main(): Promise { + await settingsList(); +} + +main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsCreateOrUpdateByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsCreateOrUpdateByScopeSample.ts index d958dcc456f7..01a96996c4c8 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsCreateOrUpdateByScopeSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsCreateOrUpdateByScopeSample.ts @@ -1,65 +1,57 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { View, CostManagementClient } from "@azure/arm-costmanagement"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ViewCreateOrUpdateByResourceGroup.json + * @summary 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. + * x-ms-original-file: 2025-03-01/ViewCreateOrUpdateByResourceGroup.json */ async function resourceGroupCreateOrUpdateView(): Promise { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; - const viewName = "swaggerExample"; - const parameters: View = { - typePropertiesQueryType: "Usage", - accumulated: "true", - chart: "Table", - dataSet: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "Daily", - grouping: [], - sorting: [{ name: "UsageDate", direction: "Ascending" }] - }, - displayName: "swagger Example", - eTag: '"1d4ff9fe66f1d10"', - kpis: [ - { type: "Forecast", enabled: true, id: undefined }, - { - type: "Budget", - enabled: true, - id: - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo" - } - ], - metric: "ActualCost", - pivots: [ - { name: "ServiceName", type: "Dimension" }, - { name: "MeterCategory", type: "Dimension" }, - { name: "swaggerTagKey", type: "TagKey" } - ], - timeframe: "MonthToDate" - }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const result = await client.views.createOrUpdateByScope( - scope, - viewName, - parameters + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + "swaggerExample", + { + eTag: '"1d4ff9fe66f1d10"', + accumulated: "true", + chart: "Table", + displayName: "swagger Example", + kpis: [ + { type: "Forecast", enabled: true }, + { + type: "Budget", + enabled: true, + id: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo", + }, + ], + metric: "ActualCost", + pivots: [ + { name: "ServiceName", type: "Dimension" }, + { name: "MeterCategory", type: "Dimension" }, + { name: "swaggerTagKey", type: "TagKey" }, + ], + query: { + type: "Usage", + dataSet: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "Daily", + grouping: [], + sorting: [{ name: "UsageDate", direction: "Ascending" }], + }, + timeframe: "MonthToDate", + }, + }, ); console.log(result); } async function main(): Promise { - resourceGroupCreateOrUpdateView(); + await resourceGroupCreateOrUpdateView(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsCreateOrUpdateSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsCreateOrUpdateSample.ts index cc339818619a..9e5b93b723a7 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsCreateOrUpdateSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsCreateOrUpdateSample.ts @@ -1,59 +1,53 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { View, CostManagementClient } from "@azure/arm-costmanagement"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to 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. + * This sample demonstrates how to 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. * - * @summary 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. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PrivateViewCreateOrUpdate.json + * @summary 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. + * x-ms-original-file: 2025-03-01/PrivateViewCreateOrUpdate.json */ async function createOrUpdatePrivateView(): Promise { - const viewName = "swaggerExample"; - const parameters: View = { - typePropertiesQueryType: "Usage", + const credential = new DefaultAzureCredential(); + const client = new CostManagementClient(credential); + const result = await client.views.createOrUpdate("swaggerExample", { + eTag: '"1d4ff9fe66f1d10"', accumulated: "true", chart: "Table", - dataSet: { - aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, - granularity: "Daily", - grouping: [], - sorting: [{ name: "UsageDate", direction: "Ascending" }] - }, displayName: "swagger Example", - eTag: '"1d4ff9fe66f1d10"', kpis: [ - { type: "Forecast", enabled: true, id: undefined }, + { type: "Forecast", enabled: true }, { type: "Budget", enabled: true, - id: - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo" - } + id: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo", + }, ], metric: "ActualCost", pivots: [ { name: "ServiceName", type: "Dimension" }, { name: "MeterCategory", type: "Dimension" }, - { name: "swaggerTagKey", type: "TagKey" } + { name: "swaggerTagKey", type: "TagKey" }, ], - timeframe: "MonthToDate" - }; - const credential = new DefaultAzureCredential(); - const client = new CostManagementClient(credential); - const result = await client.views.createOrUpdate(viewName, parameters); + query: { + type: "Usage", + dataSet: { + aggregation: { totalCost: { name: "PreTaxCost", function: "Sum" } }, + granularity: "Daily", + grouping: [], + sorting: [{ name: "UsageDate", direction: "Ascending" }], + }, + timeframe: "MonthToDate", + }, + }); console.log(result); } async function main(): Promise { - createOrUpdatePrivateView(); + await createOrUpdatePrivateView(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsDeleteByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsDeleteByScopeSample.ts index d0654badb5bb..340c874d417b 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsDeleteByScopeSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsDeleteByScopeSample.ts @@ -1,32 +1,26 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to The operation to delete a view. + * This sample demonstrates how to the operation to delete a view. * - * @summary The operation to delete a view. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ViewDeleteByResourceGroup.json + * @summary the operation to delete a view. + * x-ms-original-file: 2025-03-01/ViewDeleteByResourceGroup.json */ async function resourceGroupDeleteView(): Promise { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; - const viewName = "TestView"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.views.deleteByScope(scope, viewName); - console.log(result); + await client.views.deleteByScope( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + "TestView", + ); } async function main(): Promise { - resourceGroupDeleteView(); + await resourceGroupDeleteView(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsDeleteSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsDeleteSample.ts index d140d321e9e4..f89ddce9cb44 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsDeleteSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsDeleteSample.ts @@ -1,30 +1,23 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to The operation to delete a view. + * This sample demonstrates how to the operation to delete a view. * - * @summary The operation to delete a view. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PrivateViewDelete.json + * @summary the operation to delete a view. + * x-ms-original-file: 2025-03-01/PrivateViewDelete.json */ async function deletePrivateView(): Promise { - const viewName = "TestView"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.views.delete(viewName); - console.log(result); + await client.views.delete("TestView"); } async function main(): Promise { - deletePrivateView(); + await deletePrivateView(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsGetByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsGetByScopeSample.ts index 9882c30be7b5..3969679a7f1a 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsGetByScopeSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsGetByScopeSample.ts @@ -1,32 +1,27 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Gets the view for the defined scope by view name. + * This sample demonstrates how to gets the view for the defined scope by view name. * - * @summary Gets the view for the defined scope by view name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ViewByResourceGroup.json + * @summary gets the view for the defined scope by view name. + * x-ms-original-file: 2025-03-01/ViewByResourceGroup.json */ async function resourceGroupView(): Promise { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; - const viewName = "swaggerExample"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.views.getByScope(scope, viewName); + const result = await client.views.getByScope( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + "swaggerExample", + ); console.log(result); } async function main(): Promise { - resourceGroupView(); + await resourceGroupView(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsGetSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsGetSample.ts index 2edd9f49594d..e2c224892e59 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsGetSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsGetSample.ts @@ -1,30 +1,24 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Gets the view by view name. + * This sample demonstrates how to gets the view by view name. * - * @summary Gets the view by view name. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PrivateView.json + * @summary gets the view by view name. + * x-ms-original-file: 2025-03-01/PrivateView.json */ async function privateView(): Promise { - const viewName = "swaggerExample"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); - const result = await client.views.get(viewName); + const result = await client.views.get("swaggerExample"); console.log(result); } async function main(): Promise { - privateView(); + await privateView(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsListByScopeSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsListByScopeSample.ts index 753d36bb5cc6..63294fe27916 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsListByScopeSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsListByScopeSample.ts @@ -1,34 +1,30 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists all views at the given scope. + * This sample demonstrates how to lists all views at the given scope. * - * @summary Lists all views at the given scope. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ViewListByResourceGroup.json + * @summary lists all views at the given scope. + * x-ms-original-file: 2025-03-01/ViewListByResourceGroup.json */ async function resourceGroupViewList(): Promise { - const scope = - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.views.listByScope(scope)) { + for await (const item of client.views.listByScope( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", + )) { resArray.push(item); } + console.log(resArray); } async function main(): Promise { - resourceGroupViewList(); + await resourceGroupViewList(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsListSample.ts b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsListSample.ts index 58055decb53a..b4b951d35b6c 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsListSample.ts +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/src/viewsListSample.ts @@ -1,32 +1,28 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { CostManagementClient } from "@azure/arm-costmanagement"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists all views by tenant and object. + * This sample demonstrates how to lists all views by tenant and object. * - * @summary Lists all views by tenant and object. - * x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PrivateViewList.json + * @summary lists all views by tenant and object. + * x-ms-original-file: 2025-03-01/PrivateViewList.json */ async function privateViewList(): Promise { const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); - for await (let item of client.views.list()) { + for await (const item of client.views.list()) { resArray.push(item); } + console.log(resArray); } async function main(): Promise { - privateViewList(); + await privateViewList(); } main().catch(console.error); diff --git a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/tsconfig.json b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/tsconfig.json index 984eed535aa8..82d2ed3be723 100644 --- a/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/tsconfig.json +++ b/sdk/cost-management/arm-costmanagement/samples/v1-beta/typescript/tsconfig.json @@ -1,8 +1,8 @@ { "compilerOptions": { - "target": "ES2020", - "module": "commonjs", - "moduleResolution": "node", + "target": "ES2023", + "module": "nodenext", + "moduleResolution": "nodenext", "resolveJsonModule": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, diff --git a/sdk/cost-management/arm-costmanagement/src/api/alerts/index.ts b/sdk/cost-management/arm-costmanagement/src/api/alerts/index.ts new file mode 100644 index 000000000000..12f090ef230a --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/alerts/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { listExternal, list, dismiss, get } from "./operations.js"; +export type { + AlertsListExternalOptionalParams, + AlertsListOptionalParams, + AlertsDismissOptionalParams, + AlertsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/api/alerts/operations.ts b/sdk/cost-management/arm-costmanagement/src/api/alerts/operations.ts new file mode 100644 index 000000000000..3dec6e0d9408 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/alerts/operations.ts @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext as Client } from "../index.js"; +import type { + Alert, + DismissAlertPayload, + AlertsResult, + ExternalCloudProviderType, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + alertDeserializer, + dismissAlertPayloadSerializer, + alertsResultDeserializer, +} from "../../models/models.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + AlertsListExternalOptionalParams, + AlertsListOptionalParams, + AlertsDismissOptionalParams, + AlertsGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _listExternalSend( + context: Client, + externalCloudProviderType: ExternalCloudProviderType, + externalCloudProviderId: string, + options: AlertsListExternalOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts{?api%2Dversion}", + { + externalCloudProviderType: externalCloudProviderType, + externalCloudProviderId: externalCloudProviderId, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listExternalDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return alertsResultDeserializer(result.body); +} + +/** Lists the Alerts for external cloud provider type defined. */ +export async function listExternal( + context: Client, + externalCloudProviderType: ExternalCloudProviderType, + externalCloudProviderId: string, + options: AlertsListExternalOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listExternalSend( + context, + externalCloudProviderType, + externalCloudProviderId, + options, + ); + return _listExternalDeserialize(result); +} + +export function _listSend( + context: Client, + scope: string, + options: AlertsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{+scope}/providers/Microsoft.CostManagement/alerts{?api%2Dversion}", + { + scope: scope, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return alertsResultDeserializer(result.body); +} + +/** Lists the alerts for scope defined. */ +export async function list( + context: Client, + scope: string, + options: AlertsListOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listSend(context, scope, options); + return _listDeserialize(result); +} + +export function _dismissSend( + context: Client, + scope: string, + alertId: string, + parameters: DismissAlertPayload, + options: AlertsDismissOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{+scope}/providers/Microsoft.CostManagement/alerts/{+alertId}{?api%2Dversion}", + { + scope: scope, + alertId: alertId, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: dismissAlertPayloadSerializer(parameters), + }); +} + +export async function _dismissDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return alertDeserializer(result.body); +} + +/** Dismisses the specified alert */ +export async function dismiss( + context: Client, + scope: string, + alertId: string, + parameters: DismissAlertPayload, + options: AlertsDismissOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _dismissSend(context, scope, alertId, parameters, options); + return _dismissDeserialize(result); +} + +export function _getSend( + context: Client, + scope: string, + alertId: string, + options: AlertsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{+scope}/providers/Microsoft.CostManagement/alerts/{+alertId}{?api%2Dversion}", + { + scope: scope, + alertId: alertId, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return alertDeserializer(result.body); +} + +/** Gets the alert for the scope by alert ID. */ +export async function get( + context: Client, + scope: string, + alertId: string, + options: AlertsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, scope, alertId, options); + return _getDeserialize(result); +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/alerts/options.ts b/sdk/cost-management/arm-costmanagement/src/api/alerts/options.ts new file mode 100644 index 000000000000..f7e81ef42806 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/alerts/options.ts @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface AlertsListExternalOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AlertsListOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AlertsDismissOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AlertsGetOptionalParams extends OperationOptions {} diff --git a/sdk/cost-management/arm-costmanagement/src/api/benefitRecommendations/index.ts b/sdk/cost-management/arm-costmanagement/src/api/benefitRecommendations/index.ts new file mode 100644 index 000000000000..0535961767a5 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/benefitRecommendations/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list } from "./operations.js"; +export type { BenefitRecommendationsListOptionalParams } from "./options.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/api/benefitRecommendations/operations.ts b/sdk/cost-management/arm-costmanagement/src/api/benefitRecommendations/operations.ts new file mode 100644 index 000000000000..6fefa300466b --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/benefitRecommendations/operations.ts @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext as Client } from "../index.js"; +import type { + _BenefitRecommendationsListResult, + BenefitRecommendationModel, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + _benefitRecommendationsListResultDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { BenefitRecommendationsListOptionalParams } from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _listSend( + context: Client, + billingScope: string, + options: BenefitRecommendationsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{+billingScope}/providers/Microsoft.CostManagement/benefitRecommendations{?api%2Dversion,%24filter,%24orderby,%24expand}", + { + billingScope: billingScope, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + "%24filter": options?.filter, + "%24orderby": options?.orderby, + "%24expand": options?.expand, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_BenefitRecommendationsListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return _benefitRecommendationsListResultDeserializer(result.body); +} + +/** List of recommendations for purchasing savings plan. */ +export function list( + context: Client, + billingScope: string, + options: BenefitRecommendationsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, billingScope, options), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink", apiVersion: context.apiVersion ?? "2025-03-01" }, + ); +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/benefitRecommendations/options.ts b/sdk/cost-management/arm-costmanagement/src/api/benefitRecommendations/options.ts new file mode 100644 index 000000000000..e1453a6eb42a --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/benefitRecommendations/options.ts @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface BenefitRecommendationsListOptionalParams extends OperationOptions { + /** Can be used to filter benefitRecommendations by: properties/scope with allowed values ['Single', 'Shared'] and default value 'Shared'; and properties/lookBackPeriod with allowed values ['Last7Days', 'Last30Days', 'Last60Days'] and default value 'Last60Days'; properties/term with allowed values ['P1Y', 'P3Y'] and default value 'P3Y'; properties/subscriptionId; properties/resourceGroup */ + filter?: string; + /** May be used to order the recommendations by: properties/armSkuName. For the savings plan, the results are in order by default. There is no need to use this clause. */ + orderby?: string; + /** May be used to expand the properties by: properties/usage, properties/allRecommendationDetails */ + expand?: string; +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/benefitUtilizationSummaries/index.ts b/sdk/cost-management/arm-costmanagement/src/api/benefitUtilizationSummaries/index.ts new file mode 100644 index 000000000000..19bdb3534111 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/benefitUtilizationSummaries/index.ts @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + listBySavingsPlanId, + listBySavingsPlanOrder, + listByBillingProfileId, + listByBillingAccountId, +} from "./operations.js"; +export type { + BenefitUtilizationSummariesListBySavingsPlanIdOptionalParams, + BenefitUtilizationSummariesListBySavingsPlanOrderOptionalParams, + BenefitUtilizationSummariesListByBillingProfileIdOptionalParams, + BenefitUtilizationSummariesListByBillingAccountIdOptionalParams, +} from "./options.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/api/benefitUtilizationSummaries/operations.ts b/sdk/cost-management/arm-costmanagement/src/api/benefitUtilizationSummaries/operations.ts new file mode 100644 index 000000000000..c9c09ce954da --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/benefitUtilizationSummaries/operations.ts @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext as Client } from "../index.js"; +import type { + _BenefitUtilizationSummariesListResult, + BenefitUtilizationSummaryUnion, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + _benefitUtilizationSummariesListResultDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + BenefitUtilizationSummariesListBySavingsPlanIdOptionalParams, + BenefitUtilizationSummariesListBySavingsPlanOrderOptionalParams, + BenefitUtilizationSummariesListByBillingProfileIdOptionalParams, + BenefitUtilizationSummariesListByBillingAccountIdOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _listBySavingsPlanIdSend( + context: Client, + savingsPlanOrderId: string, + savingsPlanId: string, + options: BenefitUtilizationSummariesListBySavingsPlanIdOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries{?api%2Dversion,%24filter,grainParameter}", + { + savingsPlanOrderId: savingsPlanOrderId, + savingsPlanId: savingsPlanId, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + "%24filter": options?.filter, + grainParameter: options?.grainParameter, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listBySavingsPlanIdDeserialize( + result: PathUncheckedResponse, +): Promise<_BenefitUtilizationSummariesListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return _benefitUtilizationSummariesListResultDeserializer(result.body); +} + +/** Lists the savings plan utilization summaries for daily or monthly grain. */ +export function listBySavingsPlanId( + context: Client, + savingsPlanOrderId: string, + savingsPlanId: string, + options: BenefitUtilizationSummariesListBySavingsPlanIdOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listBySavingsPlanIdSend(context, savingsPlanOrderId, savingsPlanId, options), + _listBySavingsPlanIdDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink", apiVersion: context.apiVersion ?? "2025-03-01" }, + ); +} + +export function _listBySavingsPlanOrderSend( + context: Client, + savingsPlanOrderId: string, + options: BenefitUtilizationSummariesListBySavingsPlanOrderOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries{?api%2Dversion,%24filter,grainParameter}", + { + savingsPlanOrderId: savingsPlanOrderId, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + "%24filter": options?.filter, + grainParameter: options?.grainParameter, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listBySavingsPlanOrderDeserialize( + result: PathUncheckedResponse, +): Promise<_BenefitUtilizationSummariesListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return _benefitUtilizationSummariesListResultDeserializer(result.body); +} + +/** Lists the savings plan utilization summaries for daily or monthly grain. */ +export function listBySavingsPlanOrder( + context: Client, + savingsPlanOrderId: string, + options: BenefitUtilizationSummariesListBySavingsPlanOrderOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listBySavingsPlanOrderSend(context, savingsPlanOrderId, options), + _listBySavingsPlanOrderDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink", apiVersion: context.apiVersion ?? "2025-03-01" }, + ); +} + +export function _listByBillingProfileIdSend( + context: Client, + billingAccountId: string, + billingProfileId: string, + options: BenefitUtilizationSummariesListByBillingProfileIdOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries{?api%2Dversion,grainParameter,filter}", + { + billingAccountId: billingAccountId, + billingProfileId: billingProfileId, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + grainParameter: options?.grainParameter, + filter: options?.filter, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listByBillingProfileIdDeserialize( + result: PathUncheckedResponse, +): Promise<_BenefitUtilizationSummariesListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return _benefitUtilizationSummariesListResultDeserializer(result.body); +} + +/** Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. */ +export function listByBillingProfileId( + context: Client, + billingAccountId: string, + billingProfileId: string, + options: BenefitUtilizationSummariesListByBillingProfileIdOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByBillingProfileIdSend(context, billingAccountId, billingProfileId, options), + _listByBillingProfileIdDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink", apiVersion: context.apiVersion ?? "2025-03-01" }, + ); +} + +export function _listByBillingAccountIdSend( + context: Client, + billingAccountId: string, + options: BenefitUtilizationSummariesListByBillingAccountIdOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries{?api%2Dversion,grainParameter,filter}", + { + billingAccountId: billingAccountId, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + grainParameter: options?.grainParameter, + filter: options?.filter, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listByBillingAccountIdDeserialize( + result: PathUncheckedResponse, +): Promise<_BenefitUtilizationSummariesListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return _benefitUtilizationSummariesListResultDeserializer(result.body); +} + +/** Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. */ +export function listByBillingAccountId( + context: Client, + billingAccountId: string, + options: BenefitUtilizationSummariesListByBillingAccountIdOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByBillingAccountIdSend(context, billingAccountId, options), + _listByBillingAccountIdDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink", apiVersion: context.apiVersion ?? "2025-03-01" }, + ); +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/benefitUtilizationSummaries/options.ts b/sdk/cost-management/arm-costmanagement/src/api/benefitUtilizationSummaries/options.ts new file mode 100644 index 000000000000..d3f8ce7720c3 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/benefitUtilizationSummaries/options.ts @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { GrainParameter } from "../../models/models.js"; +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface BenefitUtilizationSummariesListBySavingsPlanIdOptionalParams extends OperationOptions { + /** Supports filtering by properties/usageDate. */ + filter?: string; + /** Grain. */ + grainParameter?: GrainParameter; +} + +/** Optional parameters. */ +export interface BenefitUtilizationSummariesListBySavingsPlanOrderOptionalParams extends OperationOptions { + /** Supports filtering by properties/usageDate. */ + filter?: string; + /** Grain. */ + grainParameter?: GrainParameter; +} + +/** Optional parameters. */ +export interface BenefitUtilizationSummariesListByBillingProfileIdOptionalParams extends OperationOptions { + /** Grain. */ + grainParameter?: GrainParameter; + /** Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. */ + filter?: string; +} + +/** Optional parameters. */ +export interface BenefitUtilizationSummariesListByBillingAccountIdOptionalParams extends OperationOptions { + /** Grain. */ + grainParameter?: GrainParameter; + /** Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. */ + filter?: string; +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/budgets/index.ts b/sdk/cost-management/arm-costmanagement/src/api/budgets/index.ts new file mode 100644 index 000000000000..7d5513f7b096 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/budgets/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list, $delete, createOrUpdate, get } from "./operations.js"; +export type { + BudgetsListOptionalParams, + BudgetsDeleteOptionalParams, + BudgetsCreateOrUpdateOptionalParams, + BudgetsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/api/budgets/operations.ts b/sdk/cost-management/arm-costmanagement/src/api/budgets/operations.ts new file mode 100644 index 000000000000..75a42a31ff4e --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/budgets/operations.ts @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext as Client } from "../index.js"; +import type { Budget, _BudgetsListResult } from "../../models/models.js"; +import { + errorResponseDeserializer, + budgetSerializer, + budgetDeserializer, + _budgetsListResultDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + BudgetsListOptionalParams, + BudgetsDeleteOptionalParams, + BudgetsCreateOrUpdateOptionalParams, + BudgetsGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _listSend( + context: Client, + scope: string, + options: BudgetsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{+scope}/providers/Microsoft.CostManagement/budgets{?api%2Dversion,%24filter}", + { + scope: scope, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + "%24filter": options?.filter, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize(result: PathUncheckedResponse): Promise<_BudgetsListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return _budgetsListResultDeserializer(result.body); +} + +/** Lists all budgets for the defined scope. */ +export function list( + context: Client, + scope: string, + options: BudgetsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, scope, options), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink", apiVersion: context.apiVersion ?? "2025-03-01" }, + ); +} + +export function _$deleteSend( + context: Client, + scope: string, + budgetName: string, + options: BudgetsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{+scope}/providers/Microsoft.CostManagement/budgets/{budgetName}{?api%2Dversion}", + { + scope: scope, + budgetName: budgetName, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return; +} + +/** The operation to delete a budget. */ +export async function $delete( + context: Client, + scope: string, + budgetName: string, + options: BudgetsDeleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _$deleteSend(context, scope, budgetName, options); + return _$deleteDeserialize(result); +} + +export function _createOrUpdateSend( + context: Client, + scope: string, + budgetName: string, + parameters: Budget, + options: BudgetsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{+scope}/providers/Microsoft.CostManagement/budgets/{budgetName}{?api%2Dversion}", + { + scope: scope, + budgetName: budgetName, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: budgetSerializer(parameters), + }); +} + +export async function _createOrUpdateDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return budgetDeserializer(result.body); +} + +/** The operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. */ +export async function createOrUpdate( + context: Client, + scope: string, + budgetName: string, + parameters: Budget, + options: BudgetsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createOrUpdateSend(context, scope, budgetName, parameters, options); + return _createOrUpdateDeserialize(result); +} + +export function _getSend( + context: Client, + scope: string, + budgetName: string, + options: BudgetsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{+scope}/providers/Microsoft.CostManagement/budgets/{budgetName}{?api%2Dversion}", + { + scope: scope, + budgetName: budgetName, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return budgetDeserializer(result.body); +} + +/** Gets the budget for the scope by budget name. */ +export async function get( + context: Client, + scope: string, + budgetName: string, + options: BudgetsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, scope, budgetName, options); + return _getDeserialize(result); +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/budgets/options.ts b/sdk/cost-management/arm-costmanagement/src/api/budgets/options.ts new file mode 100644 index 000000000000..324a2af16444 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/budgets/options.ts @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface BudgetsListOptionalParams extends OperationOptions { + /** OData filter option. May be used to filter budgets by properties/category. The filter supports 'eq' only. */ + filter?: string; +} + +/** Optional parameters. */ +export interface BudgetsDeleteOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface BudgetsCreateOrUpdateOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface BudgetsGetOptionalParams extends OperationOptions {} diff --git a/sdk/cost-management/arm-costmanagement/src/api/costAllocationRules/index.ts b/sdk/cost-management/arm-costmanagement/src/api/costAllocationRules/index.ts new file mode 100644 index 000000000000..d97bbf5d742e --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/costAllocationRules/index.ts @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { checkNameAvailability, list, $delete, createOrUpdate, get } from "./operations.js"; +export type { + CostAllocationRulesCheckNameAvailabilityOptionalParams, + CostAllocationRulesListOptionalParams, + CostAllocationRulesDeleteOptionalParams, + CostAllocationRulesCreateOrUpdateOptionalParams, + CostAllocationRulesGetOptionalParams, +} from "./options.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/api/costAllocationRules/operations.ts b/sdk/cost-management/arm-costmanagement/src/api/costAllocationRules/operations.ts new file mode 100644 index 000000000000..02297dfe11f4 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/costAllocationRules/operations.ts @@ -0,0 +1,295 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext as Client } from "../index.js"; +import type { + CostAllocationRuleDefinition, + _CostAllocationRuleList, + CostAllocationRuleCheckNameAvailabilityRequest, + CostAllocationRuleCheckNameAvailabilityResponse, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + costAllocationRuleDefinitionSerializer, + costAllocationRuleDefinitionDeserializer, + _costAllocationRuleListDeserializer, + costAllocationRuleCheckNameAvailabilityRequestSerializer, + costAllocationRuleCheckNameAvailabilityResponseDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + CostAllocationRulesCheckNameAvailabilityOptionalParams, + CostAllocationRulesListOptionalParams, + CostAllocationRulesDeleteOptionalParams, + CostAllocationRulesCreateOrUpdateOptionalParams, + CostAllocationRulesGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _checkNameAvailabilitySend( + context: Client, + billingAccountId: string, + costAllocationRuleCheckNameAvailabilityRequest: CostAllocationRuleCheckNameAvailabilityRequest, + options: CostAllocationRulesCheckNameAvailabilityOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/checkNameAvailability{?api%2Dversion}", + { + billingAccountId: billingAccountId, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: costAllocationRuleCheckNameAvailabilityRequestSerializer( + costAllocationRuleCheckNameAvailabilityRequest, + ), + }); +} + +export async function _checkNameAvailabilityDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return costAllocationRuleCheckNameAvailabilityResponseDeserializer(result.body); +} + +/** Checks availability and correctness of a name for a cost allocation rule */ +export async function checkNameAvailability( + context: Client, + billingAccountId: string, + costAllocationRuleCheckNameAvailabilityRequest: CostAllocationRuleCheckNameAvailabilityRequest, + options: CostAllocationRulesCheckNameAvailabilityOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _checkNameAvailabilitySend( + context, + billingAccountId, + costAllocationRuleCheckNameAvailabilityRequest, + options, + ); + return _checkNameAvailabilityDeserialize(result); +} + +export function _listSend( + context: Client, + billingAccountId: string, + options: CostAllocationRulesListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules{?api%2Dversion}", + { + billingAccountId: billingAccountId, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_CostAllocationRuleList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return _costAllocationRuleListDeserializer(result.body); +} + +/** Get the list of all cost allocation rules for a billing account or enterprise enrollment. */ +export function list( + context: Client, + billingAccountId: string, + options: CostAllocationRulesListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, billingAccountId, options), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink", apiVersion: context.apiVersion ?? "2025-03-01" }, + ); +} + +export function _$deleteSend( + context: Client, + billingAccountId: string, + ruleName: string, + options: CostAllocationRulesDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName}{?api%2Dversion}", + { + billingAccountId: billingAccountId, + ruleName: ruleName, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return; +} + +/** Delete cost allocation rule for billing account or enterprise enrollment. */ +export async function $delete( + context: Client, + billingAccountId: string, + ruleName: string, + options: CostAllocationRulesDeleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _$deleteSend(context, billingAccountId, ruleName, options); + return _$deleteDeserialize(result); +} + +export function _createOrUpdateSend( + context: Client, + billingAccountId: string, + ruleName: string, + costAllocationRule: CostAllocationRuleDefinition, + options: CostAllocationRulesCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName}{?api%2Dversion}", + { + billingAccountId: billingAccountId, + ruleName: ruleName, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: costAllocationRuleDefinitionSerializer(costAllocationRule), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return costAllocationRuleDefinitionDeserializer(result.body); +} + +/** Create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment. */ +export async function createOrUpdate( + context: Client, + billingAccountId: string, + ruleName: string, + costAllocationRule: CostAllocationRuleDefinition, + options: CostAllocationRulesCreateOrUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createOrUpdateSend( + context, + billingAccountId, + ruleName, + costAllocationRule, + options, + ); + return _createOrUpdateDeserialize(result); +} + +export function _getSend( + context: Client, + billingAccountId: string, + ruleName: string, + options: CostAllocationRulesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName}{?api%2Dversion}", + { + billingAccountId: billingAccountId, + ruleName: ruleName, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return costAllocationRuleDefinitionDeserializer(result.body); +} + +/** Get a cost allocation rule by rule name and billing account or enterprise enrollment. */ +export async function get( + context: Client, + billingAccountId: string, + ruleName: string, + options: CostAllocationRulesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, billingAccountId, ruleName, options); + return _getDeserialize(result); +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/costAllocationRules/options.ts b/sdk/cost-management/arm-costmanagement/src/api/costAllocationRules/options.ts new file mode 100644 index 000000000000..b173cc5bf3c6 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/costAllocationRules/options.ts @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface CostAllocationRulesCheckNameAvailabilityOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CostAllocationRulesListOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CostAllocationRulesDeleteOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CostAllocationRulesCreateOrUpdateOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CostAllocationRulesGetOptionalParams extends OperationOptions {} diff --git a/sdk/cost-management/arm-costmanagement/src/api/costManagementContext.ts b/sdk/cost-management/arm-costmanagement/src/api/costManagementContext.ts new file mode 100644 index 000000000000..32eadbfb6960 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/costManagementContext.ts @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { logger } from "../logger.js"; +import { KnownVersions } from "../models/models.js"; +import type { AzureSupportedClouds } from "../static-helpers/cloudSettingHelpers.js"; +import { getArmEndpoint } from "../static-helpers/cloudSettingHelpers.js"; +import type { Client, ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; +import type { TokenCredential } from "@azure/core-auth"; + +/** CostManagement management client provides access to CostManagement resources for Azure Enterprise Subscriptions. */ +export interface CostManagementContext extends Client { + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion?: string; +} + +/** Optional parameters for the client. */ +export interface CostManagementClientOptionalParams extends ClientOptions { + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion?: string; + /** Specifies the Azure cloud environment for the client. */ + cloudSetting?: AzureSupportedClouds; +} + +/** CostManagement management client provides access to CostManagement resources for Azure Enterprise Subscriptions. */ +export function createCostManagement( + credential: TokenCredential, + options: CostManagementClientOptionalParams = {}, +): CostManagementContext { + const endpointUrl = + options.endpoint ?? getArmEndpoint(options.cloudSetting) ?? "https://management.azure.com"; + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentInfo = `azsdk-js-arm-costmanagement/1.0.0-beta.3`; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}` + : `azsdk-js-api ${userAgentInfo}`; + const { apiVersion: _, ...updatedOptions } = { + ...options, + userAgentOptions: { userAgentPrefix }, + loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, + credentials: { + scopes: options.credentials?.scopes ?? ["https://management.azure.com/.default"], + }, + }; + const clientContext = getClient(endpointUrl, credential, updatedOptions); + const apiVersion = options.apiVersion; + return { ...clientContext, apiVersion } as CostManagementContext; +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/dimensions/index.ts b/sdk/cost-management/arm-costmanagement/src/api/dimensions/index.ts new file mode 100644 index 000000000000..eadb41723098 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/dimensions/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { listByExternalCloudProviderType, list } from "./operations.js"; +export type { + DimensionsListByExternalCloudProviderTypeOptionalParams, + DimensionsListOptionalParams, +} from "./options.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/api/dimensions/operations.ts b/sdk/cost-management/arm-costmanagement/src/api/dimensions/operations.ts new file mode 100644 index 000000000000..183db9c18e9f --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/dimensions/operations.ts @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext as Client } from "../index.js"; +import type { + _DimensionsListResult, + Dimension, + ExternalCloudProviderType, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + _dimensionsListResultDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + DimensionsListByExternalCloudProviderTypeOptionalParams, + DimensionsListOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _listByExternalCloudProviderTypeSend( + context: Client, + externalCloudProviderType: ExternalCloudProviderType, + externalCloudProviderId: string, + options: DimensionsListByExternalCloudProviderTypeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions{?api%2Dversion,%24filter,%24expand,%24skiptoken,%24top}", + { + externalCloudProviderType: externalCloudProviderType, + externalCloudProviderId: externalCloudProviderId, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + "%24filter": options?.filter, + "%24expand": options?.expand, + "%24skiptoken": options?.skiptoken, + "%24top": options?.top, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listByExternalCloudProviderTypeDeserialize( + result: PathUncheckedResponse, +): Promise<_DimensionsListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return _dimensionsListResultDeserializer(result.body); +} + +/** Lists the dimensions by the external cloud provider type. */ +export function listByExternalCloudProviderType( + context: Client, + externalCloudProviderType: ExternalCloudProviderType, + externalCloudProviderId: string, + options: DimensionsListByExternalCloudProviderTypeOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _listByExternalCloudProviderTypeSend( + context, + externalCloudProviderType, + externalCloudProviderId, + options, + ), + _listByExternalCloudProviderTypeDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink", apiVersion: context.apiVersion ?? "2025-03-01" }, + ); +} + +export function _listSend( + context: Client, + scope: string, + options: DimensionsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{+scope}/providers/Microsoft.CostManagement/dimensions{?api%2Dversion,%24filter,%24expand,%24skiptoken,%24top}", + { + scope: scope, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + "%24filter": options?.filter, + "%24expand": options?.expand, + "%24skiptoken": options?.skiptoken, + "%24top": options?.top, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_DimensionsListResult> { + const expectedStatuses = ["200", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return _dimensionsListResultDeserializer(result.body); +} + +/** Lists the dimensions by the defined scope. */ +export function list( + context: Client, + scope: string, + options: DimensionsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, scope, options), + _listDeserialize, + ["200", "204"], + { itemName: "value", nextLinkName: "nextLink", apiVersion: context.apiVersion ?? "2025-03-01" }, + ); +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/dimensions/options.ts b/sdk/cost-management/arm-costmanagement/src/api/dimensions/options.ts new file mode 100644 index 000000000000..7e248161f71c --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/dimensions/options.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface DimensionsListByExternalCloudProviderTypeOptionalParams extends OperationOptions { + /** May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'. */ + filter?: string; + /** May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions. */ + expand?: string; + /** Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. */ + skiptoken?: string; + /** May be used to limit the number of results to the most recent N dimension data. */ + top?: number; +} + +/** Optional parameters. */ +export interface DimensionsListOptionalParams extends OperationOptions { + /** May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'. */ + filter?: string; + /** May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions. */ + expand?: string; + /** Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. */ + skiptoken?: string; + /** May be used to limit the number of results to the most recent N dimension data. */ + top?: number; +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/exports/index.ts b/sdk/cost-management/arm-costmanagement/src/api/exports/index.ts new file mode 100644 index 000000000000..171745a4b8f6 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/exports/index.ts @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { getExecutionHistory, execute, list, $delete, createOrUpdate, get } from "./operations.js"; +export type { + ExportsGetExecutionHistoryOptionalParams, + ExportsExecuteOptionalParams, + ExportsListOptionalParams, + ExportsDeleteOptionalParams, + ExportsCreateOrUpdateOptionalParams, + ExportsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/api/exports/operations.ts b/sdk/cost-management/arm-costmanagement/src/api/exports/operations.ts new file mode 100644 index 000000000000..9dd723b7d6f2 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/exports/operations.ts @@ -0,0 +1,317 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext as Client } from "../index.js"; +import type { Export, ExportExecutionListResult, ExportListResult } from "../../models/models.js"; +import { + errorResponseDeserializer, + exportSerializer, + exportDeserializer, + exportExecutionListResultDeserializer, + exportListResultDeserializer, + exportRunRequestSerializer, +} from "../../models/models.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + ExportsGetExecutionHistoryOptionalParams, + ExportsExecuteOptionalParams, + ExportsListOptionalParams, + ExportsDeleteOptionalParams, + ExportsCreateOrUpdateOptionalParams, + ExportsGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _getExecutionHistorySend( + context: Client, + scope: string, + exportName: string, + options: ExportsGetExecutionHistoryOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{+scope}/providers/Microsoft.CostManagement/exports/{exportName}/runHistory{?api%2Dversion}", + { + scope: scope, + exportName: exportName, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getExecutionHistoryDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return exportExecutionListResultDeserializer(result.body); +} + +/** The operation to get the run history of an export for the defined scope and export name. */ +export async function getExecutionHistory( + context: Client, + scope: string, + exportName: string, + options: ExportsGetExecutionHistoryOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getExecutionHistorySend(context, scope, exportName, options); + return _getExecutionHistoryDeserialize(result); +} + +export function _executeSend( + context: Client, + scope: string, + exportName: string, + options: ExportsExecuteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{+scope}/providers/Microsoft.CostManagement/exports/{exportName}/run{?api%2Dversion}", + { + scope: scope, + exportName: exportName, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: !options?.parameters + ? options?.parameters + : exportRunRequestSerializer(options?.parameters), + }); +} + +export async function _executeDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return; +} + +/** The operation to run an export. */ +export async function execute( + context: Client, + scope: string, + exportName: string, + options: ExportsExecuteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _executeSend(context, scope, exportName, options); + return _executeDeserialize(result); +} + +export function _listSend( + context: Client, + scope: string, + options: ExportsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{+scope}/providers/Microsoft.CostManagement/exports{?api%2Dversion,%24expand}", + { + scope: scope, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + "%24expand": options?.expand, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return exportListResultDeserializer(result.body); +} + +/** The operation to list all exports at the given scope. */ +export async function list( + context: Client, + scope: string, + options: ExportsListOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listSend(context, scope, options); + return _listDeserialize(result); +} + +export function _$deleteSend( + context: Client, + scope: string, + exportName: string, + options: ExportsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{+scope}/providers/Microsoft.CostManagement/exports/{exportName}{?api%2Dversion}", + { + scope: scope, + exportName: exportName, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return; +} + +/** The operation to delete a export. */ +export async function $delete( + context: Client, + scope: string, + exportName: string, + options: ExportsDeleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _$deleteSend(context, scope, exportName, options); + return _$deleteDeserialize(result); +} + +export function _createOrUpdateSend( + context: Client, + scope: string, + exportName: string, + parameters: Export, + options: ExportsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{+scope}/providers/Microsoft.CostManagement/exports/{exportName}{?api%2Dversion}", + { + scope: scope, + exportName: exportName, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: exportSerializer(parameters), + }); +} + +export async function _createOrUpdateDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return exportDeserializer(result.body); +} + +/** 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. */ +export async function createOrUpdate( + context: Client, + scope: string, + exportName: string, + parameters: Export, + options: ExportsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createOrUpdateSend(context, scope, exportName, parameters, options); + return _createOrUpdateDeserialize(result); +} + +export function _getSend( + context: Client, + scope: string, + exportName: string, + options: ExportsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{+scope}/providers/Microsoft.CostManagement/exports/{exportName}{?api%2Dversion,%24expand}", + { + scope: scope, + exportName: exportName, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + "%24expand": options?.expand, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return exportDeserializer(result.body); +} + +/** The operation to get the export for the defined scope by export name. */ +export async function get( + context: Client, + scope: string, + exportName: string, + options: ExportsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, scope, exportName, options); + return _getDeserialize(result); +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/exports/options.ts b/sdk/cost-management/arm-costmanagement/src/api/exports/options.ts new file mode 100644 index 000000000000..573e4265823e --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/exports/options.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { ExportRunRequest } from "../../models/models.js"; +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface ExportsGetExecutionHistoryOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ExportsExecuteOptionalParams extends OperationOptions { + /** Parameters supplied to the Execute Export operation. */ + parameters?: ExportRunRequest; +} + +/** Optional parameters. */ +export interface ExportsListOptionalParams extends OperationOptions { + /** May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last run of each export. */ + expand?: string; +} + +/** Optional parameters. */ +export interface ExportsDeleteOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ExportsCreateOrUpdateOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ExportsGetOptionalParams extends OperationOptions { + /** May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last 10 runs of the export. */ + expand?: string; +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/forecast/index.ts b/sdk/cost-management/arm-costmanagement/src/api/forecast/index.ts new file mode 100644 index 000000000000..109162f2c024 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/forecast/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { externalCloudProviderUsage, usage } from "./operations.js"; +export type { + ForecastExternalCloudProviderUsageOptionalParams, + ForecastUsageOptionalParams, +} from "./options.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/api/forecast/operations.ts b/sdk/cost-management/arm-costmanagement/src/api/forecast/operations.ts new file mode 100644 index 000000000000..cf8665bce4b6 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/forecast/operations.ts @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext as Client } from "../index.js"; +import type { + ForecastDefinition, + ForecastResult, + ExternalCloudProviderType, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + forecastDefinitionSerializer, + forecastResultDeserializer, +} from "../../models/models.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + ForecastExternalCloudProviderUsageOptionalParams, + ForecastUsageOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _externalCloudProviderUsageSend( + context: Client, + externalCloudProviderType: ExternalCloudProviderType, + externalCloudProviderId: string, + parameters: ForecastDefinition, + options: ForecastExternalCloudProviderUsageOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast{?api%2Dversion,%24filter}", + { + externalCloudProviderType: externalCloudProviderType, + externalCloudProviderId: externalCloudProviderId, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + "%24filter": options?.filter, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: forecastDefinitionSerializer(parameters), + }); +} + +export async function _externalCloudProviderUsageDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return forecastResultDeserializer(result.body); +} + +/** Lists the forecast charges for external cloud provider type defined. */ +export async function externalCloudProviderUsage( + context: Client, + externalCloudProviderType: ExternalCloudProviderType, + externalCloudProviderId: string, + parameters: ForecastDefinition, + options: ForecastExternalCloudProviderUsageOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _externalCloudProviderUsageSend( + context, + externalCloudProviderType, + externalCloudProviderId, + parameters, + options, + ); + return _externalCloudProviderUsageDeserialize(result); +} + +export function _usageSend( + context: Client, + scope: string, + parameters: ForecastDefinition, + options: ForecastUsageOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{+scope}/providers/Microsoft.CostManagement/forecast{?api%2Dversion,%24filter}", + { + scope: scope, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + "%24filter": options?.filter, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: forecastDefinitionSerializer(parameters), + }); +} + +export async function _usageDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return result.body ? forecastResultDeserializer(result.body) : undefined; +} + +/** Lists the forecast charges for scope defined. */ +export async function usage( + context: Client, + scope: string, + parameters: ForecastDefinition, + options: ForecastUsageOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _usageSend(context, scope, parameters, options); + return _usageDeserialize(result); +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/forecast/options.ts b/sdk/cost-management/arm-costmanagement/src/api/forecast/options.ts new file mode 100644 index 000000000000..41c067856d6e --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/forecast/options.ts @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface ForecastExternalCloudProviderUsageOptionalParams extends OperationOptions { + /** 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; +} + +/** Optional parameters. */ +export interface ForecastUsageOptionalParams extends OperationOptions { + /** 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; +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/generateBenefitUtilizationSummariesReport/index.ts b/sdk/cost-management/arm-costmanagement/src/api/generateBenefitUtilizationSummariesReport/index.ts new file mode 100644 index 000000000000..f83bc91b0631 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/generateBenefitUtilizationSummariesReport/index.ts @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + generateBySavingsPlanId, + generateBySavingsPlanOrderId, + generateByReservationId, + generateByReservationOrderId, + generateByBillingProfile, + generateByBillingAccount, +} from "./operations.js"; +export type { + GenerateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdOptionalParams, + GenerateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdOptionalParams, + GenerateBenefitUtilizationSummariesReportGenerateByReservationIdOptionalParams, + GenerateBenefitUtilizationSummariesReportGenerateByReservationOrderIdOptionalParams, + GenerateBenefitUtilizationSummariesReportGenerateByBillingProfileOptionalParams, + GenerateBenefitUtilizationSummariesReportGenerateByBillingAccountOptionalParams, +} from "./options.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/api/generateBenefitUtilizationSummariesReport/operations.ts b/sdk/cost-management/arm-costmanagement/src/api/generateBenefitUtilizationSummariesReport/operations.ts new file mode 100644 index 000000000000..e4692bafaa44 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/generateBenefitUtilizationSummariesReport/operations.ts @@ -0,0 +1,490 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext as Client } from "../index.js"; +import type { + BenefitUtilizationSummariesRequest, + BenefitUtilizationSummariesOperationStatus, +} from "../../models/models.js"; +import { + benefitUtilizationSummariesRequestSerializer, + benefitUtilizationSummariesOperationStatusDeserializer, + armErrorResponseDeserializer, +} from "../../models/models.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + GenerateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdOptionalParams, + GenerateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdOptionalParams, + GenerateBenefitUtilizationSummariesReportGenerateByReservationIdOptionalParams, + GenerateBenefitUtilizationSummariesReportGenerateByReservationOrderIdOptionalParams, + GenerateBenefitUtilizationSummariesReportGenerateByBillingProfileOptionalParams, + GenerateBenefitUtilizationSummariesReportGenerateByBillingAccountOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _generateBySavingsPlanIdSend( + context: Client, + savingsPlanOrderId: string, + savingsPlanId: string, + benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, + options: GenerateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport{?api%2Dversion}", + { + savingsPlanOrderId: savingsPlanOrderId, + savingsPlanId: savingsPlanId, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: benefitUtilizationSummariesRequestSerializer(benefitUtilizationSummariesRequest), + }); +} + +export async function _generateBySavingsPlanIdDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = armErrorResponseDeserializer(result.body); + } + + throw error; + } + + return benefitUtilizationSummariesOperationStatusDeserializer(result.body); +} + +/** Triggers generation of a benefit utilization summaries report for the provided savings plan. */ +export function generateBySavingsPlanId( + context: Client, + savingsPlanOrderId: string, + savingsPlanId: string, + benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, + options: GenerateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdOptionalParams = { + requestOptions: {}, + }, +): PollerLike< + OperationState, + BenefitUtilizationSummariesOperationStatus +> { + return getLongRunningPoller(context, _generateBySavingsPlanIdDeserialize, ["200", "202", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _generateBySavingsPlanIdSend( + context, + savingsPlanOrderId, + savingsPlanId, + benefitUtilizationSummariesRequest, + options, + ), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2025-03-01", + }) as PollerLike< + OperationState, + BenefitUtilizationSummariesOperationStatus + >; +} + +export function _generateBySavingsPlanOrderIdSend( + context: Client, + savingsPlanOrderId: string, + benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, + options: GenerateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport{?api%2Dversion}", + { + savingsPlanOrderId: savingsPlanOrderId, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: benefitUtilizationSummariesRequestSerializer(benefitUtilizationSummariesRequest), + }); +} + +export async function _generateBySavingsPlanOrderIdDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = armErrorResponseDeserializer(result.body); + } + + throw error; + } + + return benefitUtilizationSummariesOperationStatusDeserializer(result.body); +} + +/** Triggers generation of a benefit utilization summaries report for the provided savings plan order. */ +export function generateBySavingsPlanOrderId( + context: Client, + savingsPlanOrderId: string, + benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, + options: GenerateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdOptionalParams = { + requestOptions: {}, + }, +): PollerLike< + OperationState, + BenefitUtilizationSummariesOperationStatus +> { + return getLongRunningPoller( + context, + _generateBySavingsPlanOrderIdDeserialize, + ["200", "202", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _generateBySavingsPlanOrderIdSend( + context, + savingsPlanOrderId, + benefitUtilizationSummariesRequest, + options, + ), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2025-03-01", + }, + ) as PollerLike< + OperationState, + BenefitUtilizationSummariesOperationStatus + >; +} + +export function _generateByReservationIdSend( + context: Client, + reservationOrderId: string, + reservationId: string, + benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, + options: GenerateBenefitUtilizationSummariesReportGenerateByReservationIdOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport{?api%2Dversion}", + { + reservationOrderId: reservationOrderId, + reservationId: reservationId, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: benefitUtilizationSummariesRequestSerializer(benefitUtilizationSummariesRequest), + }); +} + +export async function _generateByReservationIdDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = armErrorResponseDeserializer(result.body); + } + + throw error; + } + + return benefitUtilizationSummariesOperationStatusDeserializer(result.body); +} + +/** Triggers generation of a benefit utilization summaries report for the provided reservation. */ +export function generateByReservationId( + context: Client, + reservationOrderId: string, + reservationId: string, + benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, + options: GenerateBenefitUtilizationSummariesReportGenerateByReservationIdOptionalParams = { + requestOptions: {}, + }, +): PollerLike< + OperationState, + BenefitUtilizationSummariesOperationStatus +> { + return getLongRunningPoller(context, _generateByReservationIdDeserialize, ["200", "202", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _generateByReservationIdSend( + context, + reservationOrderId, + reservationId, + benefitUtilizationSummariesRequest, + options, + ), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2025-03-01", + }) as PollerLike< + OperationState, + BenefitUtilizationSummariesOperationStatus + >; +} + +export function _generateByReservationOrderIdSend( + context: Client, + reservationOrderId: string, + benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, + options: GenerateBenefitUtilizationSummariesReportGenerateByReservationOrderIdOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport{?api%2Dversion}", + { + reservationOrderId: reservationOrderId, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: benefitUtilizationSummariesRequestSerializer(benefitUtilizationSummariesRequest), + }); +} + +export async function _generateByReservationOrderIdDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = armErrorResponseDeserializer(result.body); + } + + throw error; + } + + return benefitUtilizationSummariesOperationStatusDeserializer(result.body); +} + +/** Triggers generation of a benefit utilization summaries report for the provided reservation order. */ +export function generateByReservationOrderId( + context: Client, + reservationOrderId: string, + benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, + options: GenerateBenefitUtilizationSummariesReportGenerateByReservationOrderIdOptionalParams = { + requestOptions: {}, + }, +): PollerLike< + OperationState, + BenefitUtilizationSummariesOperationStatus +> { + return getLongRunningPoller( + context, + _generateByReservationOrderIdDeserialize, + ["200", "202", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _generateByReservationOrderIdSend( + context, + reservationOrderId, + benefitUtilizationSummariesRequest, + options, + ), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2025-03-01", + }, + ) as PollerLike< + OperationState, + BenefitUtilizationSummariesOperationStatus + >; +} + +export function _generateByBillingProfileSend( + context: Client, + billingAccountId: string, + billingProfileId: string, + benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, + options: GenerateBenefitUtilizationSummariesReportGenerateByBillingProfileOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport{?api%2Dversion}", + { + billingAccountId: billingAccountId, + billingProfileId: billingProfileId, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: benefitUtilizationSummariesRequestSerializer(benefitUtilizationSummariesRequest), + }); +} + +export async function _generateByBillingProfileDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = armErrorResponseDeserializer(result.body); + } + + throw error; + } + + return benefitUtilizationSummariesOperationStatusDeserializer(result.body); +} + +/** Triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. */ +export function generateByBillingProfile( + context: Client, + billingAccountId: string, + billingProfileId: string, + benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, + options: GenerateBenefitUtilizationSummariesReportGenerateByBillingProfileOptionalParams = { + requestOptions: {}, + }, +): PollerLike< + OperationState, + BenefitUtilizationSummariesOperationStatus +> { + return getLongRunningPoller( + context, + _generateByBillingProfileDeserialize, + ["200", "202", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _generateByBillingProfileSend( + context, + billingAccountId, + billingProfileId, + benefitUtilizationSummariesRequest, + options, + ), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2025-03-01", + }, + ) as PollerLike< + OperationState, + BenefitUtilizationSummariesOperationStatus + >; +} + +export function _generateByBillingAccountSend( + context: Client, + billingAccountId: string, + benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, + options: GenerateBenefitUtilizationSummariesReportGenerateByBillingAccountOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport{?api%2Dversion}", + { + billingAccountId: billingAccountId, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: benefitUtilizationSummariesRequestSerializer(benefitUtilizationSummariesRequest), + }); +} + +export async function _generateByBillingAccountDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = armErrorResponseDeserializer(result.body); + } + + throw error; + } + + return benefitUtilizationSummariesOperationStatusDeserializer(result.body); +} + +/** Triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. */ +export function generateByBillingAccount( + context: Client, + billingAccountId: string, + benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, + options: GenerateBenefitUtilizationSummariesReportGenerateByBillingAccountOptionalParams = { + requestOptions: {}, + }, +): PollerLike< + OperationState, + BenefitUtilizationSummariesOperationStatus +> { + return getLongRunningPoller( + context, + _generateByBillingAccountDeserialize, + ["200", "202", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _generateByBillingAccountSend( + context, + billingAccountId, + benefitUtilizationSummariesRequest, + options, + ), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2025-03-01", + }, + ) as PollerLike< + OperationState, + BenefitUtilizationSummariesOperationStatus + >; +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/generateBenefitUtilizationSummariesReport/options.ts b/sdk/cost-management/arm-costmanagement/src/api/generateBenefitUtilizationSummariesReport/options.ts new file mode 100644 index 000000000000..cfcf08942904 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/generateBenefitUtilizationSummariesReport/options.ts @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface GenerateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface GenerateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface GenerateBenefitUtilizationSummariesReportGenerateByReservationIdOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface GenerateBenefitUtilizationSummariesReportGenerateByReservationOrderIdOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface GenerateBenefitUtilizationSummariesReportGenerateByBillingProfileOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface GenerateBenefitUtilizationSummariesReportGenerateByBillingAccountOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/generateCostDetailsReport/index.ts b/sdk/cost-management/arm-costmanagement/src/api/generateCostDetailsReport/index.ts new file mode 100644 index 000000000000..f5da97564f04 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/generateCostDetailsReport/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { createOperation, getOperationResults } from "./operations.js"; +export type { + GenerateCostDetailsReportCreateOperationOptionalParams, + GenerateCostDetailsReportGetOperationResultsOptionalParams, +} from "./options.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/api/generateCostDetailsReport/operations.ts b/sdk/cost-management/arm-costmanagement/src/api/generateCostDetailsReport/operations.ts new file mode 100644 index 000000000000..5c2de25908b8 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/generateCostDetailsReport/operations.ts @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext as Client } from "../index.js"; +import type { + CostDetailsOperationResults, + GenerateCostDetailsReportRequestDefinition, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + costDetailsOperationResultsDeserializer, + generateCostDetailsReportRequestDefinitionSerializer, + generateCostDetailsReportErrorResponseDeserializer, +} from "../../models/models.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + GenerateCostDetailsReportCreateOperationOptionalParams, + GenerateCostDetailsReportGetOperationResultsOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _createOperationSend( + context: Client, + scope: string, + parameters: GenerateCostDetailsReportRequestDefinition, + options: GenerateCostDetailsReportCreateOperationOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{+scope}/providers/Microsoft.CostManagement/generateCostDetailsReport{?api%2Dversion}", + { + scope: scope, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: generateCostDetailsReportRequestDefinitionSerializer(parameters), + }); +} + +export async function _createOperationDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "204", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = generateCostDetailsReportErrorResponseDeserializer(result.body); + } + + throw error; + } + + return costDetailsOperationResultsDeserializer(result.body); +} + +/** This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields */ +export function createOperation( + context: Client, + scope: string, + parameters: GenerateCostDetailsReportRequestDefinition, + options: GenerateCostDetailsReportCreateOperationOptionalParams = { requestOptions: {} }, +): PollerLike, CostDetailsOperationResults> { + return getLongRunningPoller(context, _createOperationDeserialize, ["200", "202", "204", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => _createOperationSend(context, scope, parameters, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2025-03-01", + }) as PollerLike, CostDetailsOperationResults>; +} + +export function _getOperationResultsSend( + context: Client, + scope: string, + operationId: string, + options: GenerateCostDetailsReportGetOperationResultsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{+scope}/providers/Microsoft.CostManagement/costDetailsOperationResults/{operationId}{?api%2Dversion}", + { + scope: scope, + operationId: operationId, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getOperationResultsDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return costDetailsOperationResultsDeserializer(result.body); +} + +/** Get the result of the specified operation. This link is provided in the CostDetails creation request response Location header. */ +export function getOperationResults( + context: Client, + scope: string, + operationId: string, + options: GenerateCostDetailsReportGetOperationResultsOptionalParams = { requestOptions: {} }, +): PollerLike, CostDetailsOperationResults> { + return getLongRunningPoller(context, _getOperationResultsDeserialize, ["200", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => _getOperationResultsSend(context, scope, operationId, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2025-03-01", + }) as PollerLike, CostDetailsOperationResults>; +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/generateCostDetailsReport/options.ts b/sdk/cost-management/arm-costmanagement/src/api/generateCostDetailsReport/options.ts new file mode 100644 index 000000000000..80fe039f1339 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/generateCostDetailsReport/options.ts @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface GenerateCostDetailsReportCreateOperationOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface GenerateCostDetailsReportGetOperationResultsOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReport/index.ts b/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReport/index.ts new file mode 100644 index 000000000000..420611a8e135 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReport/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { createOperation } from "./operations.js"; +export type { GenerateDetailedCostReportCreateOperationOptionalParams } from "./options.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReport/operations.ts b/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReport/operations.ts new file mode 100644 index 000000000000..d75a3098c724 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReport/operations.ts @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext as Client } from "../index.js"; +import type { + GenerateDetailedCostReportOperationResult, + GenerateDetailedCostReportDefinition, +} from "../../models/models.js"; +import { + generateDetailedCostReportOperationResultDeserializer, + generateDetailedCostReportDefinitionSerializer, + generateDetailedCostReportErrorResponseDeserializer, +} from "../../models/models.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { GenerateDetailedCostReportCreateOperationOptionalParams } from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _createOperationSend( + context: Client, + scope: string, + parameters: GenerateDetailedCostReportDefinition, + options: GenerateDetailedCostReportCreateOperationOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{+scope}/providers/Microsoft.CostManagement/generateDetailedCostReport{?api%2Dversion}", + { + scope: scope, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: generateDetailedCostReportDefinitionSerializer(parameters), + }); +} + +export async function _createOperationDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = generateDetailedCostReportErrorResponseDeserializer(result.body); + } + + throw error; + } + + return generateDetailedCostReportOperationResultDeserializer(result.body); +} + +/** 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. */ +export function createOperation( + context: Client, + scope: string, + parameters: GenerateDetailedCostReportDefinition, + options: GenerateDetailedCostReportCreateOperationOptionalParams = { requestOptions: {} }, +): PollerLike< + OperationState, + GenerateDetailedCostReportOperationResult +> { + return getLongRunningPoller(context, _createOperationDeserialize, ["200", "202", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => _createOperationSend(context, scope, parameters, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2025-03-01", + }) as PollerLike< + OperationState, + GenerateDetailedCostReportOperationResult + >; +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReport/options.ts b/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReport/options.ts new file mode 100644 index 000000000000..3c086b4a51bb --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReport/options.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface GenerateDetailedCostReportCreateOperationOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReportOperationResults/index.ts b/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReportOperationResults/index.ts new file mode 100644 index 000000000000..436de12f8456 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReportOperationResults/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { get } from "./operations.js"; +export type { GenerateDetailedCostReportOperationResultsGetOptionalParams } from "./options.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReportOperationResults/operations.ts b/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReportOperationResults/operations.ts new file mode 100644 index 000000000000..9de6080ffd26 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReportOperationResults/operations.ts @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext as Client } from "../index.js"; +import type { GenerateDetailedCostReportOperationResult } from "../../models/models.js"; +import { + errorResponseDeserializer, + generateDetailedCostReportOperationResultDeserializer, +} from "../../models/models.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { GenerateDetailedCostReportOperationResultsGetOptionalParams } from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _getSend( + context: Client, + operationId: string, + scope: string, + options: GenerateDetailedCostReportOperationResultsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{+scope}/providers/Microsoft.CostManagement/operationResults/{operationId}{?api%2Dversion}", + { + scope: scope, + operationId: operationId, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return generateDetailedCostReportOperationResultDeserializer(result.body); +} + +/** Gets the result of the specified operation. The link with this operationId is provided as a response header of the initial request. */ +export function get( + context: Client, + operationId: string, + scope: string, + options: GenerateDetailedCostReportOperationResultsGetOptionalParams = { requestOptions: {} }, +): PollerLike< + OperationState, + GenerateDetailedCostReportOperationResult +> { + return getLongRunningPoller(context, _getDeserialize, ["200", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => _getSend(context, operationId, scope, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2025-03-01", + }) as PollerLike< + OperationState, + GenerateDetailedCostReportOperationResult + >; +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReportOperationResults/options.ts b/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReportOperationResults/options.ts new file mode 100644 index 000000000000..78f57ce18b28 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReportOperationResults/options.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface GenerateDetailedCostReportOperationResultsGetOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReportOperationStatus/index.ts b/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReportOperationStatus/index.ts new file mode 100644 index 000000000000..6c77a47df461 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReportOperationStatus/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { get } from "./operations.js"; +export type { GenerateDetailedCostReportOperationStatusGetOptionalParams } from "./options.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReportOperationStatus/operations.ts b/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReportOperationStatus/operations.ts new file mode 100644 index 000000000000..eb3f48f0e2b4 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReportOperationStatus/operations.ts @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext as Client } from "../index.js"; +import type { GenerateDetailedCostReportOperationStatuses } from "../../models/models.js"; +import { + generateDetailedCostReportOperationStatusesDeserializer, + errorResponseDeserializer, +} from "../../models/models.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { GenerateDetailedCostReportOperationStatusGetOptionalParams } from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _getSend( + context: Client, + operationId: string, + scope: string, + options: GenerateDetailedCostReportOperationStatusGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{+scope}/providers/Microsoft.CostManagement/operationStatus/{operationId}{?api%2Dversion}", + { + scope: scope, + operationId: operationId, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return generateDetailedCostReportOperationStatusesDeserializer(result.body); +} + +/** Get the status of the specified operation. This link is provided in the GenerateDetailedCostReport creation request response header. */ +export async function get( + context: Client, + operationId: string, + scope: string, + options: GenerateDetailedCostReportOperationStatusGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, operationId, scope, options); + return _getDeserialize(result); +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReportOperationStatus/options.ts b/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReportOperationStatus/options.ts new file mode 100644 index 000000000000..f924eda14637 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/generateDetailedCostReportOperationStatus/options.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface GenerateDetailedCostReportOperationStatusGetOptionalParams extends OperationOptions {} diff --git a/sdk/cost-management/arm-costmanagement/src/api/generateReservationDetailsReport/index.ts b/sdk/cost-management/arm-costmanagement/src/api/generateReservationDetailsReport/index.ts new file mode 100644 index 000000000000..1fc06d7c12b4 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/generateReservationDetailsReport/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { byBillingProfileId, byBillingAccountId } from "./operations.js"; +export type { + GenerateReservationDetailsReportByBillingProfileIdOptionalParams, + GenerateReservationDetailsReportByBillingAccountIdOptionalParams, +} from "./options.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/api/generateReservationDetailsReport/operations.ts b/sdk/cost-management/arm-costmanagement/src/api/generateReservationDetailsReport/operations.ts new file mode 100644 index 000000000000..e0cb77f07617 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/generateReservationDetailsReport/operations.ts @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext as Client } from "../index.js"; +import type { OperationStatus } from "../../models/models.js"; +import { errorResponseDeserializer, operationStatusDeserializer } from "../../models/models.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + GenerateReservationDetailsReportByBillingProfileIdOptionalParams, + GenerateReservationDetailsReportByBillingAccountIdOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _byBillingProfileIdSend( + context: Client, + billingAccountId: string, + billingProfileId: string, + startDate: string, + endDate: string, + options: GenerateReservationDetailsReportByBillingProfileIdOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport{?api%2Dversion,startDate,endDate}", + { + billingAccountId: billingAccountId, + billingProfileId: billingProfileId, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + startDate: startDate, + endDate: endDate, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _byBillingProfileIdDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return operationStatusDeserializer(result.body); +} + +/** 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 */ +export function byBillingProfileId( + context: Client, + billingAccountId: string, + billingProfileId: string, + startDate: string, + endDate: string, + options: GenerateReservationDetailsReportByBillingProfileIdOptionalParams = { + requestOptions: {}, + }, +): PollerLike, OperationStatus> { + return getLongRunningPoller(context, _byBillingProfileIdDeserialize, ["200", "202", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _byBillingProfileIdSend( + context, + billingAccountId, + billingProfileId, + startDate, + endDate, + options, + ), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2025-03-01", + }) as PollerLike, OperationStatus>; +} + +export function _byBillingAccountIdSend( + context: Client, + billingAccountId: string, + startDate: string, + endDate: string, + options: GenerateReservationDetailsReportByBillingAccountIdOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport{?api%2Dversion,startDate,endDate}", + { + billingAccountId: billingAccountId, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + startDate: startDate, + endDate: endDate, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _byBillingAccountIdDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return operationStatusDeserializer(result.body); +} + +/** 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 */ +export function byBillingAccountId( + context: Client, + billingAccountId: string, + startDate: string, + endDate: string, + options: GenerateReservationDetailsReportByBillingAccountIdOptionalParams = { + requestOptions: {}, + }, +): PollerLike, OperationStatus> { + return getLongRunningPoller(context, _byBillingAccountIdDeserialize, ["200", "202", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _byBillingAccountIdSend(context, billingAccountId, startDate, endDate, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2025-03-01", + }) as PollerLike, OperationStatus>; +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/generateReservationDetailsReport/options.ts b/sdk/cost-management/arm-costmanagement/src/api/generateReservationDetailsReport/options.ts new file mode 100644 index 000000000000..6907e0528359 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/generateReservationDetailsReport/options.ts @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface GenerateReservationDetailsReportByBillingProfileIdOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface GenerateReservationDetailsReportByBillingAccountIdOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/index.ts b/sdk/cost-management/arm-costmanagement/src/api/index.ts new file mode 100644 index 000000000000..db594011c9ae --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export type { + CostManagementContext, + CostManagementClientOptionalParams, +} from "./costManagementContext.js"; +export { createCostManagement } from "./costManagementContext.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/api/operations/index.ts b/sdk/cost-management/arm-costmanagement/src/api/operations/index.ts new file mode 100644 index 000000000000..de883c05d2f1 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/operations/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list } from "./operations.js"; +export type { OperationsListOptionalParams } from "./options.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/api/operations/operations.ts b/sdk/cost-management/arm-costmanagement/src/api/operations/operations.ts new file mode 100644 index 000000000000..ad4369c3f35f --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/operations/operations.ts @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext as Client } from "../index.js"; +import type { _OperationListResult, CostManagementOperation } from "../../models/models.js"; +import { + errorResponseDeserializer, + _operationListResultDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { OperationsListOptionalParams } from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _listSend( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.CostManagement/operations{?api%2Dversion}", + { + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_OperationListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return _operationListResultDeserializer(result.body); +} + +/** List the operations for the provider */ +export function list( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, options), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink", apiVersion: context.apiVersion ?? "2025-03-01" }, + ); +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/operations/options.ts b/sdk/cost-management/arm-costmanagement/src/api/operations/options.ts new file mode 100644 index 000000000000..b9a3fd9758a3 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/operations/options.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface OperationsListOptionalParams extends OperationOptions {} diff --git a/sdk/cost-management/arm-costmanagement/src/api/priceSheet/index.ts b/sdk/cost-management/arm-costmanagement/src/api/priceSheet/index.ts new file mode 100644 index 000000000000..0adeb74a5878 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/priceSheet/index.ts @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + downloadByBillingAccount, + downloadByBillingProfile, + downloadByInvoice, +} from "./operations.js"; +export type { + PriceSheetDownloadByBillingAccountOptionalParams, + PriceSheetDownloadByBillingProfileOptionalParams, + PriceSheetDownloadByInvoiceOptionalParams, +} from "./options.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/api/priceSheet/operations.ts b/sdk/cost-management/arm-costmanagement/src/api/priceSheet/operations.ts new file mode 100644 index 000000000000..8714dd788589 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/priceSheet/operations.ts @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext as Client } from "../index.js"; +import type { + DownloadURL, + OperationStatus, + PricesheetDownloadProperties, +} from "../../models/models.js"; +import { + downloadURLDeserializer, + errorResponseDeserializer, + armErrorResponseDeserializer, + operationStatusDeserializer, + pricesheetDownloadPropertiesDeserializer, +} from "../../models/models.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + PriceSheetDownloadByBillingAccountOptionalParams, + PriceSheetDownloadByBillingProfileOptionalParams, + PriceSheetDownloadByInvoiceOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _downloadByBillingAccountSend( + context: Client, + billingAccountId: string, + billingPeriodName: string, + options: PriceSheetDownloadByBillingAccountOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.CostManagement/pricesheets/default/download{?api%2Dversion}", + { + billingAccountId: billingAccountId, + billingPeriodName: billingPeriodName, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _downloadByBillingAccountDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = armErrorResponseDeserializer(result.body); + } + + throw error; + } + + return operationStatusDeserializer(result.body); +} + +/** + * Generates the pricesheet for the provided billing period asynchronously based on the Enrollment ID. This is for Enterprise Agreement customers. + * + * **Migrate to version 2025-03-01** + * + * You can use the 2025-03-01 API version with the new URI: + * + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.CostManagement/pricesheets/default/download' + * + * With a new schema detailed below, the new version of the price sheet provides additional information and includes prices for Azure Reserved Instances (RI) for the current billing period. We recommend downloading an Azure Price Sheet for when entering a new billing period if you would maintain an ongoing record of past Azure Reserved Instance (RI) pricing. + * + * The EA Azure price sheet is available for billing periods in the past 13 months. To request a price sheet for a billing period older than 13 months, please contact support. + * + * The Azure price sheet download experience has been updated from a single .csv file to a zip file containing multiple .csv files, each with max size of 75MB. The 2023-11-01 version has been upgraded to use http POST method; details can be found below. + * + * All versions of the Microsoft.Consumption Azure Price Sheet - Download by Billing Account (including 2022-06-01, 2021-10-01, 2020-01-01-preview, 2019-10-01, 2019-05-01) are scheduled to be retired on 01 June 2026 and will no longer be supported after this date. + */ +export function downloadByBillingAccount( + context: Client, + billingAccountId: string, + billingPeriodName: string, + options: PriceSheetDownloadByBillingAccountOptionalParams = { requestOptions: {} }, +): PollerLike, OperationStatus> { + return getLongRunningPoller( + context, + _downloadByBillingAccountDeserialize, + ["200", "202", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _downloadByBillingAccountSend(context, billingAccountId, billingPeriodName, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2025-03-01", + }, + ) as PollerLike, OperationStatus>; +} + +export function _downloadByBillingProfileSend( + context: Client, + billingAccountName: string, + billingProfileName: string, + options: PriceSheetDownloadByBillingProfileOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download{?api%2Dversion}", + { + billingAccountName: billingAccountName, + billingProfileName: billingProfileName, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _downloadByBillingProfileDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return pricesheetDownloadPropertiesDeserializer(result.body); +} + +/** + * 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. + * + * You can use the new 2023-09-01 API version for billing periods January 2023 onwards. Azure Reserved Instance (RI) pricing is only available through the new version of the API. + * + * Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv/json file to a Zip file containing multiple csv/json files, each with max size of 75MB. + */ +export function downloadByBillingProfile( + context: Client, + billingAccountName: string, + billingProfileName: string, + options: PriceSheetDownloadByBillingProfileOptionalParams = { requestOptions: {} }, +): PollerLike, PricesheetDownloadProperties> { + return getLongRunningPoller( + context, + _downloadByBillingProfileDeserialize, + ["200", "202", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _downloadByBillingProfileSend(context, billingAccountName, billingProfileName, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2025-03-01", + }, + ) as PollerLike, PricesheetDownloadProperties>; +} + +export function _downloadByInvoiceSend( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceName: string, + options: PriceSheetDownloadByInvoiceOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download{?api%2Dversion}", + { + billingAccountName: billingAccountName, + billingProfileName: billingProfileName, + invoiceName: invoiceName, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _downloadByInvoiceDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return downloadURLDeserializer(result.body); +} + +/** 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. */ +export function downloadByInvoice( + context: Client, + billingAccountName: string, + billingProfileName: string, + invoiceName: string, + options: PriceSheetDownloadByInvoiceOptionalParams = { requestOptions: {} }, +): PollerLike, DownloadURL> { + return getLongRunningPoller(context, _downloadByInvoiceDeserialize, ["200", "202", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _downloadByInvoiceSend(context, billingAccountName, billingProfileName, invoiceName, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2025-03-01", + }) as PollerLike, DownloadURL>; +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/priceSheet/options.ts b/sdk/cost-management/arm-costmanagement/src/api/priceSheet/options.ts new file mode 100644 index 000000000000..53f75a6fd6e1 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/priceSheet/options.ts @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface PriceSheetDownloadByBillingAccountOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface PriceSheetDownloadByBillingProfileOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface PriceSheetDownloadByInvoiceOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/query/index.ts b/sdk/cost-management/arm-costmanagement/src/api/query/index.ts new file mode 100644 index 000000000000..312b6ffadeb5 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/query/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { usageByExternalCloudProviderType, usage } from "./operations.js"; +export type { + QueryUsageByExternalCloudProviderTypeOptionalParams, + QueryUsageOptionalParams, +} from "./options.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/api/query/operations.ts b/sdk/cost-management/arm-costmanagement/src/api/query/operations.ts new file mode 100644 index 000000000000..04e7ede55230 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/query/operations.ts @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext as Client } from "../index.js"; +import type { + QueryDefinition, + QueryResult, + ExternalCloudProviderType, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + queryDefinitionSerializer, + queryResultDeserializer, +} from "../../models/models.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + QueryUsageByExternalCloudProviderTypeOptionalParams, + QueryUsageOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _usageByExternalCloudProviderTypeSend( + context: Client, + externalCloudProviderType: ExternalCloudProviderType, + externalCloudProviderId: string, + parameters: QueryDefinition, + options: QueryUsageByExternalCloudProviderTypeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query{?api%2Dversion}", + { + externalCloudProviderType: externalCloudProviderType, + externalCloudProviderId: externalCloudProviderId, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: queryDefinitionSerializer(parameters), + }); +} + +export async function _usageByExternalCloudProviderTypeDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return queryResultDeserializer(result.body); +} + +/** Query the usage data for external cloud provider type defined. */ +export async function usageByExternalCloudProviderType( + context: Client, + externalCloudProviderType: ExternalCloudProviderType, + externalCloudProviderId: string, + parameters: QueryDefinition, + options: QueryUsageByExternalCloudProviderTypeOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _usageByExternalCloudProviderTypeSend( + context, + externalCloudProviderType, + externalCloudProviderId, + parameters, + options, + ); + return _usageByExternalCloudProviderTypeDeserialize(result); +} + +export function _usageSend( + context: Client, + scope: string, + parameters: QueryDefinition, + options: QueryUsageOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{+scope}/providers/Microsoft.CostManagement/query{?api%2Dversion}", + { + scope: scope, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: queryDefinitionSerializer(parameters), + }); +} + +export async function _usageDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return result.body ? queryResultDeserializer(result.body) : undefined; +} + +/** Query the usage data for scope defined. */ +export async function usage( + context: Client, + scope: string, + parameters: QueryDefinition, + options: QueryUsageOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _usageSend(context, scope, parameters, options); + return _usageDeserialize(result); +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/query/options.ts b/sdk/cost-management/arm-costmanagement/src/api/query/options.ts new file mode 100644 index 000000000000..56a633ee4b3c --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/query/options.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface QueryUsageByExternalCloudProviderTypeOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface QueryUsageOptionalParams extends OperationOptions {} diff --git a/sdk/cost-management/arm-costmanagement/src/api/scheduledActions/index.ts b/sdk/cost-management/arm-costmanagement/src/api/scheduledActions/index.ts new file mode 100644 index 000000000000..5ed3a8a95865 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/scheduledActions/index.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + checkNameAvailabilityByScope, + checkNameAvailability, + runByScope, + listByScope, + deleteByScope, + createOrUpdateByScope, + getByScope, + run, + list, + $delete, + createOrUpdate, + get, +} from "./operations.js"; +export type { + ScheduledActionsCheckNameAvailabilityByScopeOptionalParams, + ScheduledActionsCheckNameAvailabilityOptionalParams, + ScheduledActionsRunByScopeOptionalParams, + ScheduledActionsListByScopeOptionalParams, + ScheduledActionsDeleteByScopeOptionalParams, + ScheduledActionsCreateOrUpdateByScopeOptionalParams, + ScheduledActionsGetByScopeOptionalParams, + ScheduledActionsRunOptionalParams, + ScheduledActionsListOptionalParams, + ScheduledActionsDeleteOptionalParams, + ScheduledActionsCreateOrUpdateOptionalParams, + ScheduledActionsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/api/scheduledActions/operations.ts b/sdk/cost-management/arm-costmanagement/src/api/scheduledActions/operations.ts new file mode 100644 index 000000000000..25020e6bf547 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/scheduledActions/operations.ts @@ -0,0 +1,626 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext as Client } from "../index.js"; +import type { + ScheduledAction, + _ScheduledActionListResult, + CheckNameAvailabilityRequest, + CheckNameAvailabilityResponse, +} from "../../models/models.js"; +import { + scheduledActionSerializer, + scheduledActionDeserializer, + errorResponseWithNestedDetailsDeserializer, + _scheduledActionListResultDeserializer, + checkNameAvailabilityRequestSerializer, + checkNameAvailabilityResponseDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + ScheduledActionsCheckNameAvailabilityByScopeOptionalParams, + ScheduledActionsCheckNameAvailabilityOptionalParams, + ScheduledActionsRunByScopeOptionalParams, + ScheduledActionsListByScopeOptionalParams, + ScheduledActionsDeleteByScopeOptionalParams, + ScheduledActionsCreateOrUpdateByScopeOptionalParams, + ScheduledActionsGetByScopeOptionalParams, + ScheduledActionsRunOptionalParams, + ScheduledActionsListOptionalParams, + ScheduledActionsDeleteOptionalParams, + ScheduledActionsCreateOrUpdateOptionalParams, + ScheduledActionsGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _checkNameAvailabilityByScopeSend( + context: Client, + scope: string, + checkNameAvailabilityRequest: CheckNameAvailabilityRequest, + options: ScheduledActionsCheckNameAvailabilityByScopeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{scope}/providers/Microsoft.CostManagement/checkNameAvailability{?api%2Dversion}", + { + scope: scope, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: checkNameAvailabilityRequestSerializer(checkNameAvailabilityRequest), + }); +} + +export async function _checkNameAvailabilityByScopeDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseWithNestedDetailsDeserializer(result.body); + } + + throw error; + } + + return checkNameAvailabilityResponseDeserializer(result.body); +} + +/** Checks availability and correctness of the name for a scheduled action within the given scope. */ +export async function checkNameAvailabilityByScope( + context: Client, + scope: string, + checkNameAvailabilityRequest: CheckNameAvailabilityRequest, + options: ScheduledActionsCheckNameAvailabilityByScopeOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _checkNameAvailabilityByScopeSend( + context, + scope, + checkNameAvailabilityRequest, + options, + ); + return _checkNameAvailabilityByScopeDeserialize(result); +} + +export function _checkNameAvailabilitySend( + context: Client, + checkNameAvailabilityRequest: CheckNameAvailabilityRequest, + options: ScheduledActionsCheckNameAvailabilityOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.CostManagement/checkNameAvailability{?api%2Dversion}", + { + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: checkNameAvailabilityRequestSerializer(checkNameAvailabilityRequest), + }); +} + +export async function _checkNameAvailabilityDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseWithNestedDetailsDeserializer(result.body); + } + + throw error; + } + + return checkNameAvailabilityResponseDeserializer(result.body); +} + +/** Checks availability and correctness of the name for a scheduled action. */ +export async function checkNameAvailability( + context: Client, + checkNameAvailabilityRequest: CheckNameAvailabilityRequest, + options: ScheduledActionsCheckNameAvailabilityOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _checkNameAvailabilitySend(context, checkNameAvailabilityRequest, options); + return _checkNameAvailabilityDeserialize(result); +} + +export function _runByScopeSend( + context: Client, + scope: string, + name: string, + options: ScheduledActionsRunByScopeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}/execute{?api%2Dversion}", + { + scope: scope, + name: name, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _runByScopeDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseWithNestedDetailsDeserializer(result.body); + } + + throw error; + } + + return; +} + +/** Runs a shared scheduled action within the given scope. */ +export async function runByScope( + context: Client, + scope: string, + name: string, + options: ScheduledActionsRunByScopeOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _runByScopeSend(context, scope, name, options); + return _runByScopeDeserialize(result); +} + +export function _listByScopeSend( + context: Client, + scope: string, + options: ScheduledActionsListByScopeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{scope}/providers/Microsoft.CostManagement/scheduledActions{?api%2Dversion,%24filter}", + { + scope: scope, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + "%24filter": options?.filter, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listByScopeDeserialize( + result: PathUncheckedResponse, +): Promise<_ScheduledActionListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseWithNestedDetailsDeserializer(result.body); + } + + throw error; + } + + return _scheduledActionListResultDeserializer(result.body); +} + +/** List all shared scheduled actions within the given scope. */ +export function listByScope( + context: Client, + scope: string, + options: ScheduledActionsListByScopeOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByScopeSend(context, scope, options), + _listByScopeDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink", apiVersion: context.apiVersion ?? "2025-03-01" }, + ); +} + +export function _deleteByScopeSend( + context: Client, + scope: string, + name: string, + options: ScheduledActionsDeleteByScopeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}{?api%2Dversion}", + { + scope: scope, + name: name, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _deleteByScopeDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseWithNestedDetailsDeserializer(result.body); + } + + throw error; + } + + return; +} + +/** Delete a scheduled action within the given scope. */ +export async function deleteByScope( + context: Client, + scope: string, + name: string, + options: ScheduledActionsDeleteByScopeOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deleteByScopeSend(context, scope, name, options); + return _deleteByScopeDeserialize(result); +} + +export function _createOrUpdateByScopeSend( + context: Client, + scope: string, + name: string, + scheduledAction: ScheduledAction, + options: ScheduledActionsCreateOrUpdateByScopeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}{?api%2Dversion}", + { + scope: scope, + name: name, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + ...(options?.ifMatch !== undefined ? { "if-match": options?.ifMatch } : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: scheduledActionSerializer(scheduledAction), + }); +} + +export async function _createOrUpdateByScopeDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseWithNestedDetailsDeserializer(result.body); + } + + throw error; + } + + return scheduledActionDeserializer(result.body); +} + +/** Create or update a shared scheduled action within the given scope. */ +export async function createOrUpdateByScope( + context: Client, + scope: string, + name: string, + scheduledAction: ScheduledAction, + options: ScheduledActionsCreateOrUpdateByScopeOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createOrUpdateByScopeSend(context, scope, name, scheduledAction, options); + return _createOrUpdateByScopeDeserialize(result); +} + +export function _getByScopeSend( + context: Client, + scope: string, + name: string, + options: ScheduledActionsGetByScopeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}{?api%2Dversion}", + { + scope: scope, + name: name, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getByScopeDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseWithNestedDetailsDeserializer(result.body); + } + + throw error; + } + + return scheduledActionDeserializer(result.body); +} + +/** Get the shared scheduled action from the given scope by name. */ +export async function getByScope( + context: Client, + scope: string, + name: string, + options: ScheduledActionsGetByScopeOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getByScopeSend(context, scope, name, options); + return _getByScopeDeserialize(result); +} + +export function _runSend( + context: Client, + name: string, + options: ScheduledActionsRunOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.CostManagement/scheduledActions/{name}/execute{?api%2Dversion}", + { + name: name, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _runDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseWithNestedDetailsDeserializer(result.body); + } + + throw error; + } + + return; +} + +/** Processes a private scheduled action. */ +export async function run( + context: Client, + name: string, + options: ScheduledActionsRunOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _runSend(context, name, options); + return _runDeserialize(result); +} + +export function _listSend( + context: Client, + options: ScheduledActionsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.CostManagement/scheduledActions{?api%2Dversion,%24filter}", + { + "api%2Dversion": context.apiVersion ?? "2025-03-01", + "%24filter": options?.filter, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_ScheduledActionListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseWithNestedDetailsDeserializer(result.body); + } + + throw error; + } + + return _scheduledActionListResultDeserializer(result.body); +} + +/** List all private scheduled actions. */ +export function list( + context: Client, + options: ScheduledActionsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, options), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink", apiVersion: context.apiVersion ?? "2025-03-01" }, + ); +} + +export function _$deleteSend( + context: Client, + name: string, + options: ScheduledActionsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.CostManagement/scheduledActions/{name}{?api%2Dversion}", + { + name: name, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseWithNestedDetailsDeserializer(result.body); + } + + throw error; + } + + return; +} + +/** Delete a private scheduled action. */ +export async function $delete( + context: Client, + name: string, + options: ScheduledActionsDeleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _$deleteSend(context, name, options); + return _$deleteDeserialize(result); +} + +export function _createOrUpdateSend( + context: Client, + name: string, + scheduledAction: ScheduledAction, + options: ScheduledActionsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.CostManagement/scheduledActions/{name}{?api%2Dversion}", + { + name: name, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + ...(options?.ifMatch !== undefined ? { "if-match": options?.ifMatch } : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: scheduledActionSerializer(scheduledAction), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseWithNestedDetailsDeserializer(result.body); + } + + throw error; + } + + return scheduledActionDeserializer(result.body); +} + +/** Create or update a private scheduled action. */ +export async function createOrUpdate( + context: Client, + name: string, + scheduledAction: ScheduledAction, + options: ScheduledActionsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createOrUpdateSend(context, name, scheduledAction, options); + return _createOrUpdateDeserialize(result); +} + +export function _getSend( + context: Client, + name: string, + options: ScheduledActionsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.CostManagement/scheduledActions/{name}{?api%2Dversion}", + { + name: name, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseWithNestedDetailsDeserializer(result.body); + } + + throw error; + } + + return scheduledActionDeserializer(result.body); +} + +/** Get the private scheduled action by name. */ +export async function get( + context: Client, + name: string, + options: ScheduledActionsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, name, options); + return _getDeserialize(result); +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/scheduledActions/options.ts b/sdk/cost-management/arm-costmanagement/src/api/scheduledActions/options.ts new file mode 100644 index 000000000000..f5efa429098c --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/scheduledActions/options.ts @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface ScheduledActionsCheckNameAvailabilityByScopeOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ScheduledActionsCheckNameAvailabilityOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ScheduledActionsRunByScopeOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ScheduledActionsListByScopeOptionalParams extends OperationOptions { + /** May be used to filter scheduled actions by properties/viewId. Supported operator is 'eq'. */ + filter?: string; +} + +/** Optional parameters. */ +export interface ScheduledActionsDeleteByScopeOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ScheduledActionsCreateOrUpdateByScopeOptionalParams extends OperationOptions { + /** ETag of the Entity. Not required when creating an entity. Optional when updating an entity and can be specified to achieve optimistic concurrency. */ + ifMatch?: string; +} + +/** Optional parameters. */ +export interface ScheduledActionsGetByScopeOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ScheduledActionsRunOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ScheduledActionsListOptionalParams extends OperationOptions { + /** May be used to filter scheduled actions by properties/viewId. Supported operator is 'eq'. */ + filter?: string; +} + +/** Optional parameters. */ +export interface ScheduledActionsDeleteOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ScheduledActionsCreateOrUpdateOptionalParams extends OperationOptions { + /** ETag of the Entity. Not required when creating an entity. Optional when updating an entity and can be specified to achieve optimistic concurrency. */ + ifMatch?: string; +} + +/** Optional parameters. */ +export interface ScheduledActionsGetOptionalParams extends OperationOptions {} diff --git a/sdk/cost-management/arm-costmanagement/src/api/settings/index.ts b/sdk/cost-management/arm-costmanagement/src/api/settings/index.ts new file mode 100644 index 000000000000..dd1726a9dc27 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/settings/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list, deleteByScope, createOrUpdateByScope, getByScope } from "./operations.js"; +export type { + SettingsListOptionalParams, + SettingsDeleteByScopeOptionalParams, + SettingsCreateOrUpdateByScopeOptionalParams, + SettingsGetByScopeOptionalParams, +} from "./options.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/api/settings/operations.ts b/sdk/cost-management/arm-costmanagement/src/api/settings/operations.ts new file mode 100644 index 000000000000..2b37a6d37ae7 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/settings/operations.ts @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext as Client } from "../index.js"; +import type { SettingUnion, SettingType, SettingsListResult } from "../../models/models.js"; +import { + errorResponseDeserializer, + settingUnionSerializer, + settingUnionDeserializer, + settingsListResultDeserializer, +} from "../../models/models.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + SettingsListOptionalParams, + SettingsDeleteByScopeOptionalParams, + SettingsCreateOrUpdateByScopeOptionalParams, + SettingsGetByScopeOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _listSend( + context: Client, + scope: string, + options: SettingsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{scope}/providers/Microsoft.CostManagement/settings{?api%2Dversion}", + { + scope: scope, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return settingsListResultDeserializer(result.body); +} + +/** List all cost management settings in the requested scope. */ +export async function list( + context: Client, + scope: string, + options: SettingsListOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listSend(context, scope, options); + return _listDeserialize(result); +} + +export function _deleteByScopeSend( + context: Client, + scope: string, + typeParam: SettingType, + options: SettingsDeleteByScopeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{scope}/providers/Microsoft.CostManagement/settings/{type}{?api%2Dversion}", + { + scope: scope, + type: typeParam, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _deleteByScopeDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return; +} + +/** Delete a setting within the given scope. */ +export async function deleteByScope( + context: Client, + scope: string, + typeParam: SettingType, + options: SettingsDeleteByScopeOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deleteByScopeSend(context, scope, typeParam, options); + return _deleteByScopeDeserialize(result); +} + +export function _createOrUpdateByScopeSend( + context: Client, + scope: string, + typeParam: SettingType, + setting: SettingUnion, + options: SettingsCreateOrUpdateByScopeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{scope}/providers/Microsoft.CostManagement/settings/{type}{?api%2Dversion}", + { + scope: scope, + type: typeParam, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: settingUnionSerializer(setting), + }); +} + +export async function _createOrUpdateByScopeDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return settingUnionDeserializer(result.body); +} + +/** Create or update a setting within the given scope. */ +export async function createOrUpdateByScope( + context: Client, + scope: string, + typeParam: SettingType, + setting: SettingUnion, + options: SettingsCreateOrUpdateByScopeOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createOrUpdateByScopeSend(context, scope, typeParam, setting, options); + return _createOrUpdateByScopeDeserialize(result); +} + +export function _getByScopeSend( + context: Client, + scope: string, + typeParam: SettingType, + options: SettingsGetByScopeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{scope}/providers/Microsoft.CostManagement/settings/{type}{?api%2Dversion}", + { + scope: scope, + type: typeParam, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getByScopeDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return settingUnionDeserializer(result.body); +} + +/** Get the setting from the given scope by name. */ +export async function getByScope( + context: Client, + scope: string, + typeParam: SettingType, + options: SettingsGetByScopeOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getByScopeSend(context, scope, typeParam, options); + return _getByScopeDeserialize(result); +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/settings/options.ts b/sdk/cost-management/arm-costmanagement/src/api/settings/options.ts new file mode 100644 index 000000000000..55db3304168c --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/settings/options.ts @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface SettingsListOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface SettingsDeleteByScopeOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface SettingsCreateOrUpdateByScopeOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface SettingsGetByScopeOptionalParams extends OperationOptions {} diff --git a/sdk/cost-management/arm-costmanagement/src/api/views/index.ts b/sdk/cost-management/arm-costmanagement/src/api/views/index.ts new file mode 100644 index 000000000000..6411aed1b831 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/views/index.ts @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + listByScope, + deleteByScope, + createOrUpdateByScope, + getByScope, + list, + $delete, + createOrUpdate, + get, +} from "./operations.js"; +export type { + ViewsListByScopeOptionalParams, + ViewsDeleteByScopeOptionalParams, + ViewsCreateOrUpdateByScopeOptionalParams, + ViewsGetByScopeOptionalParams, + ViewsListOptionalParams, + ViewsDeleteOptionalParams, + ViewsCreateOrUpdateOptionalParams, + ViewsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/api/views/operations.ts b/sdk/cost-management/arm-costmanagement/src/api/views/operations.ts new file mode 100644 index 000000000000..5c9b10e40ff3 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/views/operations.ts @@ -0,0 +1,408 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext as Client } from "../index.js"; +import type { View, _ViewListResult } from "../../models/models.js"; +import { + errorResponseDeserializer, + viewSerializer, + viewDeserializer, + _viewListResultDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + ViewsListByScopeOptionalParams, + ViewsDeleteByScopeOptionalParams, + ViewsCreateOrUpdateByScopeOptionalParams, + ViewsGetByScopeOptionalParams, + ViewsListOptionalParams, + ViewsDeleteOptionalParams, + ViewsCreateOrUpdateOptionalParams, + ViewsGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _listByScopeSend( + context: Client, + scope: string, + options: ViewsListByScopeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{scope}/providers/Microsoft.CostManagement/views{?api%2Dversion}", + { + scope: scope, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listByScopeDeserialize( + result: PathUncheckedResponse, +): Promise<_ViewListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return _viewListResultDeserializer(result.body); +} + +/** Lists all views at the given scope. */ +export function listByScope( + context: Client, + scope: string, + options: ViewsListByScopeOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByScopeSend(context, scope, options), + _listByScopeDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink", apiVersion: context.apiVersion ?? "2025-03-01" }, + ); +} + +export function _deleteByScopeSend( + context: Client, + scope: string, + viewName: string, + options: ViewsDeleteByScopeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{scope}/providers/Microsoft.CostManagement/views/{viewName}{?api%2Dversion}", + { + scope: scope, + viewName: viewName, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _deleteByScopeDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return; +} + +/** The operation to delete a view. */ +export async function deleteByScope( + context: Client, + scope: string, + viewName: string, + options: ViewsDeleteByScopeOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deleteByScopeSend(context, scope, viewName, options); + return _deleteByScopeDeserialize(result); +} + +export function _createOrUpdateByScopeSend( + context: Client, + scope: string, + viewName: string, + parameters: View, + options: ViewsCreateOrUpdateByScopeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{scope}/providers/Microsoft.CostManagement/views/{viewName}{?api%2Dversion}", + { + scope: scope, + viewName: viewName, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: viewSerializer(parameters), + }); +} + +export async function _createOrUpdateByScopeDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return viewDeserializer(result.body); +} + +/** 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. */ +export async function createOrUpdateByScope( + context: Client, + scope: string, + viewName: string, + parameters: View, + options: ViewsCreateOrUpdateByScopeOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createOrUpdateByScopeSend(context, scope, viewName, parameters, options); + return _createOrUpdateByScopeDeserialize(result); +} + +export function _getByScopeSend( + context: Client, + scope: string, + viewName: string, + options: ViewsGetByScopeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/{scope}/providers/Microsoft.CostManagement/views/{viewName}{?api%2Dversion}", + { + scope: scope, + viewName: viewName, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getByScopeDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return viewDeserializer(result.body); +} + +/** Gets the view for the defined scope by view name. */ +export async function getByScope( + context: Client, + scope: string, + viewName: string, + options: ViewsGetByScopeOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getByScopeSend(context, scope, viewName, options); + return _getByScopeDeserialize(result); +} + +export function _listSend( + context: Client, + options: ViewsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.CostManagement/views{?api%2Dversion}", + { + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize(result: PathUncheckedResponse): Promise<_ViewListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return _viewListResultDeserializer(result.body); +} + +/** Lists all views by tenant and object. */ +export function list( + context: Client, + options: ViewsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, options), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink", apiVersion: context.apiVersion ?? "2025-03-01" }, + ); +} + +export function _$deleteSend( + context: Client, + viewName: string, + options: ViewsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.CostManagement/views/{viewName}{?api%2Dversion}", + { + viewName: viewName, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return; +} + +/** The operation to delete a view. */ +export async function $delete( + context: Client, + viewName: string, + options: ViewsDeleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _$deleteSend(context, viewName, options); + return _$deleteDeserialize(result); +} + +export function _createOrUpdateSend( + context: Client, + viewName: string, + parameters: View, + options: ViewsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.CostManagement/views/{viewName}{?api%2Dversion}", + { + viewName: viewName, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: viewSerializer(parameters), + }); +} + +export async function _createOrUpdateDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return viewDeserializer(result.body); +} + +/** 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. */ +export async function createOrUpdate( + context: Client, + viewName: string, + parameters: View, + options: ViewsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createOrUpdateSend(context, viewName, parameters, options); + return _createOrUpdateDeserialize(result); +} + +export function _getSend( + context: Client, + viewName: string, + options: ViewsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.CostManagement/views/{viewName}{?api%2Dversion}", + { + viewName: viewName, + "api%2Dversion": context.apiVersion ?? "2025-03-01", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorResponseDeserializer(result.body); + } + + throw error; + } + + return viewDeserializer(result.body); +} + +/** Gets the view by view name. */ +export async function get( + context: Client, + viewName: string, + options: ViewsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, viewName, options); + return _getDeserialize(result); +} diff --git a/sdk/cost-management/arm-costmanagement/src/api/views/options.ts b/sdk/cost-management/arm-costmanagement/src/api/views/options.ts new file mode 100644 index 000000000000..6b403f2126af --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/api/views/options.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface ViewsListByScopeOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ViewsDeleteByScopeOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ViewsCreateOrUpdateByScopeOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ViewsGetByScopeOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ViewsListOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ViewsDeleteOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ViewsCreateOrUpdateOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ViewsGetOptionalParams extends OperationOptions {} diff --git a/sdk/cost-management/arm-costmanagement/src/classic/alerts/index.ts b/sdk/cost-management/arm-costmanagement/src/classic/alerts/index.ts new file mode 100644 index 000000000000..b31e36522aad --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/classic/alerts/index.ts @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext } from "../../api/costManagementContext.js"; +import { listExternal, list, dismiss, get } from "../../api/alerts/operations.js"; +import type { + AlertsListExternalOptionalParams, + AlertsListOptionalParams, + AlertsDismissOptionalParams, + AlertsGetOptionalParams, +} from "../../api/alerts/options.js"; +import type { + Alert, + DismissAlertPayload, + AlertsResult, + ExternalCloudProviderType, +} from "../../models/models.js"; + +/** Interface representing a Alerts operations. */ +export interface AlertsOperations { + /** Lists the Alerts for external cloud provider type defined. */ + listExternal: ( + externalCloudProviderType: ExternalCloudProviderType, + externalCloudProviderId: string, + options?: AlertsListExternalOptionalParams, + ) => Promise; + /** Lists the alerts for scope defined. */ + list: (scope: string, options?: AlertsListOptionalParams) => Promise; + /** Dismisses the specified alert */ + dismiss: ( + scope: string, + alertId: string, + parameters: DismissAlertPayload, + options?: AlertsDismissOptionalParams, + ) => Promise; + /** Gets the alert for the scope by alert ID. */ + get: (scope: string, alertId: string, options?: AlertsGetOptionalParams) => Promise; +} + +function _getAlerts(context: CostManagementContext) { + return { + listExternal: ( + externalCloudProviderType: ExternalCloudProviderType, + externalCloudProviderId: string, + options?: AlertsListExternalOptionalParams, + ) => listExternal(context, externalCloudProviderType, externalCloudProviderId, options), + list: (scope: string, options?: AlertsListOptionalParams) => list(context, scope, options), + dismiss: ( + scope: string, + alertId: string, + parameters: DismissAlertPayload, + options?: AlertsDismissOptionalParams, + ) => dismiss(context, scope, alertId, parameters, options), + get: (scope: string, alertId: string, options?: AlertsGetOptionalParams) => + get(context, scope, alertId, options), + }; +} + +export function _getAlertsOperations(context: CostManagementContext): AlertsOperations { + return { + ..._getAlerts(context), + }; +} diff --git a/sdk/cost-management/arm-costmanagement/src/classic/benefitRecommendations/index.ts b/sdk/cost-management/arm-costmanagement/src/classic/benefitRecommendations/index.ts new file mode 100644 index 000000000000..3978c0828ddd --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/classic/benefitRecommendations/index.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext } from "../../api/costManagementContext.js"; +import { list } from "../../api/benefitRecommendations/operations.js"; +import type { BenefitRecommendationsListOptionalParams } from "../../api/benefitRecommendations/options.js"; +import type { BenefitRecommendationModel } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a BenefitRecommendations operations. */ +export interface BenefitRecommendationsOperations { + /** List of recommendations for purchasing savings plan. */ + list: ( + billingScope: string, + options?: BenefitRecommendationsListOptionalParams, + ) => PagedAsyncIterableIterator; +} + +function _getBenefitRecommendations(context: CostManagementContext) { + return { + list: (billingScope: string, options?: BenefitRecommendationsListOptionalParams) => + list(context, billingScope, options), + }; +} + +export function _getBenefitRecommendationsOperations( + context: CostManagementContext, +): BenefitRecommendationsOperations { + return { + ..._getBenefitRecommendations(context), + }; +} diff --git a/sdk/cost-management/arm-costmanagement/src/classic/benefitUtilizationSummaries/index.ts b/sdk/cost-management/arm-costmanagement/src/classic/benefitUtilizationSummaries/index.ts new file mode 100644 index 000000000000..f6913d3394f6 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/classic/benefitUtilizationSummaries/index.ts @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext } from "../../api/costManagementContext.js"; +import { + listBySavingsPlanId, + listBySavingsPlanOrder, + listByBillingProfileId, + listByBillingAccountId, +} from "../../api/benefitUtilizationSummaries/operations.js"; +import type { + BenefitUtilizationSummariesListBySavingsPlanIdOptionalParams, + BenefitUtilizationSummariesListBySavingsPlanOrderOptionalParams, + BenefitUtilizationSummariesListByBillingProfileIdOptionalParams, + BenefitUtilizationSummariesListByBillingAccountIdOptionalParams, +} from "../../api/benefitUtilizationSummaries/options.js"; +import type { BenefitUtilizationSummaryUnion } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a BenefitUtilizationSummaries operations. */ +export interface BenefitUtilizationSummariesOperations { + /** Lists the savings plan utilization summaries for daily or monthly grain. */ + listBySavingsPlanId: ( + savingsPlanOrderId: string, + savingsPlanId: string, + options?: BenefitUtilizationSummariesListBySavingsPlanIdOptionalParams, + ) => PagedAsyncIterableIterator; + /** Lists the savings plan utilization summaries for daily or monthly grain. */ + listBySavingsPlanOrder: ( + savingsPlanOrderId: string, + options?: BenefitUtilizationSummariesListBySavingsPlanOrderOptionalParams, + ) => PagedAsyncIterableIterator; + /** Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. */ + listByBillingProfileId: ( + billingAccountId: string, + billingProfileId: string, + options?: BenefitUtilizationSummariesListByBillingProfileIdOptionalParams, + ) => PagedAsyncIterableIterator; + /** Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. */ + listByBillingAccountId: ( + billingAccountId: string, + options?: BenefitUtilizationSummariesListByBillingAccountIdOptionalParams, + ) => PagedAsyncIterableIterator; +} + +function _getBenefitUtilizationSummaries(context: CostManagementContext) { + return { + listBySavingsPlanId: ( + savingsPlanOrderId: string, + savingsPlanId: string, + options?: BenefitUtilizationSummariesListBySavingsPlanIdOptionalParams, + ) => listBySavingsPlanId(context, savingsPlanOrderId, savingsPlanId, options), + listBySavingsPlanOrder: ( + savingsPlanOrderId: string, + options?: BenefitUtilizationSummariesListBySavingsPlanOrderOptionalParams, + ) => listBySavingsPlanOrder(context, savingsPlanOrderId, options), + listByBillingProfileId: ( + billingAccountId: string, + billingProfileId: string, + options?: BenefitUtilizationSummariesListByBillingProfileIdOptionalParams, + ) => listByBillingProfileId(context, billingAccountId, billingProfileId, options), + listByBillingAccountId: ( + billingAccountId: string, + options?: BenefitUtilizationSummariesListByBillingAccountIdOptionalParams, + ) => listByBillingAccountId(context, billingAccountId, options), + }; +} + +export function _getBenefitUtilizationSummariesOperations( + context: CostManagementContext, +): BenefitUtilizationSummariesOperations { + return { + ..._getBenefitUtilizationSummaries(context), + }; +} diff --git a/sdk/cost-management/arm-costmanagement/src/classic/budgets/index.ts b/sdk/cost-management/arm-costmanagement/src/classic/budgets/index.ts new file mode 100644 index 000000000000..d20a3ef40adc --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/classic/budgets/index.ts @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext } from "../../api/costManagementContext.js"; +import { list, $delete, createOrUpdate, get } from "../../api/budgets/operations.js"; +import type { + BudgetsListOptionalParams, + BudgetsDeleteOptionalParams, + BudgetsCreateOrUpdateOptionalParams, + BudgetsGetOptionalParams, +} from "../../api/budgets/options.js"; +import type { Budget } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Budgets operations. */ +export interface BudgetsOperations { + /** Lists all budgets for the defined scope. */ + list: (scope: string, options?: BudgetsListOptionalParams) => PagedAsyncIterableIterator; + /** The operation to delete a budget. */ + delete: ( + scope: string, + budgetName: string, + options?: BudgetsDeleteOptionalParams, + ) => Promise; + /** The operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. */ + createOrUpdate: ( + scope: string, + budgetName: string, + parameters: Budget, + options?: BudgetsCreateOrUpdateOptionalParams, + ) => Promise; + /** Gets the budget for the scope by budget name. */ + get: (scope: string, budgetName: string, options?: BudgetsGetOptionalParams) => Promise; +} + +function _getBudgets(context: CostManagementContext) { + return { + list: (scope: string, options?: BudgetsListOptionalParams) => list(context, scope, options), + delete: (scope: string, budgetName: string, options?: BudgetsDeleteOptionalParams) => + $delete(context, scope, budgetName, options), + createOrUpdate: ( + scope: string, + budgetName: string, + parameters: Budget, + options?: BudgetsCreateOrUpdateOptionalParams, + ) => createOrUpdate(context, scope, budgetName, parameters, options), + get: (scope: string, budgetName: string, options?: BudgetsGetOptionalParams) => + get(context, scope, budgetName, options), + }; +} + +export function _getBudgetsOperations(context: CostManagementContext): BudgetsOperations { + return { + ..._getBudgets(context), + }; +} diff --git a/sdk/cost-management/arm-costmanagement/src/classic/costAllocationRules/index.ts b/sdk/cost-management/arm-costmanagement/src/classic/costAllocationRules/index.ts new file mode 100644 index 000000000000..2e385ce980a2 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/classic/costAllocationRules/index.ts @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext } from "../../api/costManagementContext.js"; +import { + checkNameAvailability, + list, + $delete, + createOrUpdate, + get, +} from "../../api/costAllocationRules/operations.js"; +import type { + CostAllocationRulesCheckNameAvailabilityOptionalParams, + CostAllocationRulesListOptionalParams, + CostAllocationRulesDeleteOptionalParams, + CostAllocationRulesCreateOrUpdateOptionalParams, + CostAllocationRulesGetOptionalParams, +} from "../../api/costAllocationRules/options.js"; +import type { + CostAllocationRuleDefinition, + CostAllocationRuleCheckNameAvailabilityRequest, + CostAllocationRuleCheckNameAvailabilityResponse, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a CostAllocationRules operations. */ +export interface CostAllocationRulesOperations { + /** Checks availability and correctness of a name for a cost allocation rule */ + checkNameAvailability: ( + billingAccountId: string, + costAllocationRuleCheckNameAvailabilityRequest: CostAllocationRuleCheckNameAvailabilityRequest, + options?: CostAllocationRulesCheckNameAvailabilityOptionalParams, + ) => Promise; + /** Get the list of all cost allocation rules for a billing account or enterprise enrollment. */ + list: ( + billingAccountId: string, + options?: CostAllocationRulesListOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete cost allocation rule for billing account or enterprise enrollment. */ + delete: ( + billingAccountId: string, + ruleName: string, + options?: CostAllocationRulesDeleteOptionalParams, + ) => Promise; + /** Create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment. */ + createOrUpdate: ( + billingAccountId: string, + ruleName: string, + costAllocationRule: CostAllocationRuleDefinition, + options?: CostAllocationRulesCreateOrUpdateOptionalParams, + ) => Promise; + /** Get a cost allocation rule by rule name and billing account or enterprise enrollment. */ + get: ( + billingAccountId: string, + ruleName: string, + options?: CostAllocationRulesGetOptionalParams, + ) => Promise; +} + +function _getCostAllocationRules(context: CostManagementContext) { + return { + checkNameAvailability: ( + billingAccountId: string, + costAllocationRuleCheckNameAvailabilityRequest: CostAllocationRuleCheckNameAvailabilityRequest, + options?: CostAllocationRulesCheckNameAvailabilityOptionalParams, + ) => + checkNameAvailability( + context, + billingAccountId, + costAllocationRuleCheckNameAvailabilityRequest, + options, + ), + list: (billingAccountId: string, options?: CostAllocationRulesListOptionalParams) => + list(context, billingAccountId, options), + delete: ( + billingAccountId: string, + ruleName: string, + options?: CostAllocationRulesDeleteOptionalParams, + ) => $delete(context, billingAccountId, ruleName, options), + createOrUpdate: ( + billingAccountId: string, + ruleName: string, + costAllocationRule: CostAllocationRuleDefinition, + options?: CostAllocationRulesCreateOrUpdateOptionalParams, + ) => createOrUpdate(context, billingAccountId, ruleName, costAllocationRule, options), + get: ( + billingAccountId: string, + ruleName: string, + options?: CostAllocationRulesGetOptionalParams, + ) => get(context, billingAccountId, ruleName, options), + }; +} + +export function _getCostAllocationRulesOperations( + context: CostManagementContext, +): CostAllocationRulesOperations { + return { + ..._getCostAllocationRules(context), + }; +} diff --git a/sdk/cost-management/arm-costmanagement/src/classic/dimensions/index.ts b/sdk/cost-management/arm-costmanagement/src/classic/dimensions/index.ts new file mode 100644 index 000000000000..cd8abb234607 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/classic/dimensions/index.ts @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext } from "../../api/costManagementContext.js"; +import { listByExternalCloudProviderType, list } from "../../api/dimensions/operations.js"; +import type { + DimensionsListByExternalCloudProviderTypeOptionalParams, + DimensionsListOptionalParams, +} from "../../api/dimensions/options.js"; +import type { Dimension, ExternalCloudProviderType } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Dimensions operations. */ +export interface DimensionsOperations { + /** Lists the dimensions by the external cloud provider type. */ + listByExternalCloudProviderType: ( + externalCloudProviderType: ExternalCloudProviderType, + externalCloudProviderId: string, + options?: DimensionsListByExternalCloudProviderTypeOptionalParams, + ) => PagedAsyncIterableIterator; + /** Lists the dimensions by the defined scope. */ + list: ( + scope: string, + options?: DimensionsListOptionalParams, + ) => PagedAsyncIterableIterator; +} + +function _getDimensions(context: CostManagementContext) { + return { + listByExternalCloudProviderType: ( + externalCloudProviderType: ExternalCloudProviderType, + externalCloudProviderId: string, + options?: DimensionsListByExternalCloudProviderTypeOptionalParams, + ) => + listByExternalCloudProviderType( + context, + externalCloudProviderType, + externalCloudProviderId, + options, + ), + list: (scope: string, options?: DimensionsListOptionalParams) => list(context, scope, options), + }; +} + +export function _getDimensionsOperations(context: CostManagementContext): DimensionsOperations { + return { + ..._getDimensions(context), + }; +} diff --git a/sdk/cost-management/arm-costmanagement/src/classic/exports/index.ts b/sdk/cost-management/arm-costmanagement/src/classic/exports/index.ts new file mode 100644 index 000000000000..a27461066fab --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/classic/exports/index.ts @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext } from "../../api/costManagementContext.js"; +import { + getExecutionHistory, + execute, + list, + $delete, + createOrUpdate, + get, +} from "../../api/exports/operations.js"; +import type { + ExportsGetExecutionHistoryOptionalParams, + ExportsExecuteOptionalParams, + ExportsListOptionalParams, + ExportsDeleteOptionalParams, + ExportsCreateOrUpdateOptionalParams, + ExportsGetOptionalParams, +} from "../../api/exports/options.js"; +import type { Export, ExportExecutionListResult, ExportListResult } from "../../models/models.js"; + +/** Interface representing a Exports operations. */ +export interface ExportsOperations { + /** The operation to get the run history of an export for the defined scope and export name. */ + getExecutionHistory: ( + scope: string, + exportName: string, + options?: ExportsGetExecutionHistoryOptionalParams, + ) => Promise; + /** The operation to run an export. */ + execute: ( + scope: string, + exportName: string, + options?: ExportsExecuteOptionalParams, + ) => Promise; + /** The operation to list all exports at the given scope. */ + list: (scope: string, options?: ExportsListOptionalParams) => Promise; + /** The operation to delete a export. */ + delete: ( + scope: string, + exportName: string, + options?: ExportsDeleteOptionalParams, + ) => Promise; + /** 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. */ + createOrUpdate: ( + scope: string, + exportName: string, + parameters: Export, + options?: ExportsCreateOrUpdateOptionalParams, + ) => Promise; + /** The operation to get the export for the defined scope by export name. */ + get: (scope: string, exportName: string, options?: ExportsGetOptionalParams) => Promise; +} + +function _getExports(context: CostManagementContext) { + return { + getExecutionHistory: ( + scope: string, + exportName: string, + options?: ExportsGetExecutionHistoryOptionalParams, + ) => getExecutionHistory(context, scope, exportName, options), + execute: (scope: string, exportName: string, options?: ExportsExecuteOptionalParams) => + execute(context, scope, exportName, options), + list: (scope: string, options?: ExportsListOptionalParams) => list(context, scope, options), + delete: (scope: string, exportName: string, options?: ExportsDeleteOptionalParams) => + $delete(context, scope, exportName, options), + createOrUpdate: ( + scope: string, + exportName: string, + parameters: Export, + options?: ExportsCreateOrUpdateOptionalParams, + ) => createOrUpdate(context, scope, exportName, parameters, options), + get: (scope: string, exportName: string, options?: ExportsGetOptionalParams) => + get(context, scope, exportName, options), + }; +} + +export function _getExportsOperations(context: CostManagementContext): ExportsOperations { + return { + ..._getExports(context), + }; +} diff --git a/sdk/cost-management/arm-costmanagement/src/classic/forecast/index.ts b/sdk/cost-management/arm-costmanagement/src/classic/forecast/index.ts new file mode 100644 index 000000000000..2d5934aac71a --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/classic/forecast/index.ts @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext } from "../../api/costManagementContext.js"; +import { externalCloudProviderUsage, usage } from "../../api/forecast/operations.js"; +import type { + ForecastExternalCloudProviderUsageOptionalParams, + ForecastUsageOptionalParams, +} from "../../api/forecast/options.js"; +import type { + ForecastDefinition, + ForecastResult, + ExternalCloudProviderType, +} from "../../models/models.js"; + +/** Interface representing a Forecast operations. */ +export interface ForecastOperations { + /** Lists the forecast charges for external cloud provider type defined. */ + externalCloudProviderUsage: ( + externalCloudProviderType: ExternalCloudProviderType, + externalCloudProviderId: string, + parameters: ForecastDefinition, + options?: ForecastExternalCloudProviderUsageOptionalParams, + ) => Promise; + /** Lists the forecast charges for scope defined. */ + usage: ( + scope: string, + parameters: ForecastDefinition, + options?: ForecastUsageOptionalParams, + ) => Promise; +} + +function _getForecast(context: CostManagementContext) { + return { + externalCloudProviderUsage: ( + externalCloudProviderType: ExternalCloudProviderType, + externalCloudProviderId: string, + parameters: ForecastDefinition, + options?: ForecastExternalCloudProviderUsageOptionalParams, + ) => + externalCloudProviderUsage( + context, + externalCloudProviderType, + externalCloudProviderId, + parameters, + options, + ), + usage: (scope: string, parameters: ForecastDefinition, options?: ForecastUsageOptionalParams) => + usage(context, scope, parameters, options), + }; +} + +export function _getForecastOperations(context: CostManagementContext): ForecastOperations { + return { + ..._getForecast(context), + }; +} diff --git a/sdk/cost-management/arm-costmanagement/src/classic/generateBenefitUtilizationSummariesReport/index.ts b/sdk/cost-management/arm-costmanagement/src/classic/generateBenefitUtilizationSummariesReport/index.ts new file mode 100644 index 000000000000..892292552e12 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/classic/generateBenefitUtilizationSummariesReport/index.ts @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext } from "../../api/costManagementContext.js"; +import { + generateBySavingsPlanId, + generateBySavingsPlanOrderId, + generateByReservationId, + generateByReservationOrderId, + generateByBillingProfile, + generateByBillingAccount, +} from "../../api/generateBenefitUtilizationSummariesReport/operations.js"; +import type { + GenerateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdOptionalParams, + GenerateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdOptionalParams, + GenerateBenefitUtilizationSummariesReportGenerateByReservationIdOptionalParams, + GenerateBenefitUtilizationSummariesReportGenerateByReservationOrderIdOptionalParams, + GenerateBenefitUtilizationSummariesReportGenerateByBillingProfileOptionalParams, + GenerateBenefitUtilizationSummariesReportGenerateByBillingAccountOptionalParams, +} from "../../api/generateBenefitUtilizationSummariesReport/options.js"; +import type { + BenefitUtilizationSummariesRequest, + BenefitUtilizationSummariesOperationStatus, +} from "../../models/models.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a GenerateBenefitUtilizationSummariesReport operations. */ +export interface GenerateBenefitUtilizationSummariesReportOperations { + /** Triggers generation of a benefit utilization summaries report for the provided savings plan. */ + generateBySavingsPlanId: ( + savingsPlanOrderId: string, + savingsPlanId: string, + benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, + options?: GenerateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdOptionalParams, + ) => PollerLike< + OperationState, + BenefitUtilizationSummariesOperationStatus + >; + /** Triggers generation of a benefit utilization summaries report for the provided savings plan order. */ + generateBySavingsPlanOrderId: ( + savingsPlanOrderId: string, + benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, + options?: GenerateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdOptionalParams, + ) => PollerLike< + OperationState, + BenefitUtilizationSummariesOperationStatus + >; + /** Triggers generation of a benefit utilization summaries report for the provided reservation. */ + generateByReservationId: ( + reservationOrderId: string, + reservationId: string, + benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, + options?: GenerateBenefitUtilizationSummariesReportGenerateByReservationIdOptionalParams, + ) => PollerLike< + OperationState, + BenefitUtilizationSummariesOperationStatus + >; + /** Triggers generation of a benefit utilization summaries report for the provided reservation order. */ + generateByReservationOrderId: ( + reservationOrderId: string, + benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, + options?: GenerateBenefitUtilizationSummariesReportGenerateByReservationOrderIdOptionalParams, + ) => PollerLike< + OperationState, + BenefitUtilizationSummariesOperationStatus + >; + /** Triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. */ + generateByBillingProfile: ( + billingAccountId: string, + billingProfileId: string, + benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, + options?: GenerateBenefitUtilizationSummariesReportGenerateByBillingProfileOptionalParams, + ) => PollerLike< + OperationState, + BenefitUtilizationSummariesOperationStatus + >; + /** Triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. */ + generateByBillingAccount: ( + billingAccountId: string, + benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, + options?: GenerateBenefitUtilizationSummariesReportGenerateByBillingAccountOptionalParams, + ) => PollerLike< + OperationState, + BenefitUtilizationSummariesOperationStatus + >; +} + +function _getGenerateBenefitUtilizationSummariesReport(context: CostManagementContext) { + return { + generateBySavingsPlanId: ( + savingsPlanOrderId: string, + savingsPlanId: string, + benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, + options?: GenerateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdOptionalParams, + ) => + generateBySavingsPlanId( + context, + savingsPlanOrderId, + savingsPlanId, + benefitUtilizationSummariesRequest, + options, + ), + generateBySavingsPlanOrderId: ( + savingsPlanOrderId: string, + benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, + options?: GenerateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdOptionalParams, + ) => + generateBySavingsPlanOrderId( + context, + savingsPlanOrderId, + benefitUtilizationSummariesRequest, + options, + ), + generateByReservationId: ( + reservationOrderId: string, + reservationId: string, + benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, + options?: GenerateBenefitUtilizationSummariesReportGenerateByReservationIdOptionalParams, + ) => + generateByReservationId( + context, + reservationOrderId, + reservationId, + benefitUtilizationSummariesRequest, + options, + ), + generateByReservationOrderId: ( + reservationOrderId: string, + benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, + options?: GenerateBenefitUtilizationSummariesReportGenerateByReservationOrderIdOptionalParams, + ) => + generateByReservationOrderId( + context, + reservationOrderId, + benefitUtilizationSummariesRequest, + options, + ), + generateByBillingProfile: ( + billingAccountId: string, + billingProfileId: string, + benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, + options?: GenerateBenefitUtilizationSummariesReportGenerateByBillingProfileOptionalParams, + ) => + generateByBillingProfile( + context, + billingAccountId, + billingProfileId, + benefitUtilizationSummariesRequest, + options, + ), + generateByBillingAccount: ( + billingAccountId: string, + benefitUtilizationSummariesRequest: BenefitUtilizationSummariesRequest, + options?: GenerateBenefitUtilizationSummariesReportGenerateByBillingAccountOptionalParams, + ) => + generateByBillingAccount( + context, + billingAccountId, + benefitUtilizationSummariesRequest, + options, + ), + }; +} + +export function _getGenerateBenefitUtilizationSummariesReportOperations( + context: CostManagementContext, +): GenerateBenefitUtilizationSummariesReportOperations { + return { + ..._getGenerateBenefitUtilizationSummariesReport(context), + }; +} diff --git a/sdk/cost-management/arm-costmanagement/src/classic/generateCostDetailsReport/index.ts b/sdk/cost-management/arm-costmanagement/src/classic/generateCostDetailsReport/index.ts new file mode 100644 index 000000000000..8e813a41a6c5 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/classic/generateCostDetailsReport/index.ts @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext } from "../../api/costManagementContext.js"; +import { + createOperation, + getOperationResults, +} from "../../api/generateCostDetailsReport/operations.js"; +import type { + GenerateCostDetailsReportCreateOperationOptionalParams, + GenerateCostDetailsReportGetOperationResultsOptionalParams, +} from "../../api/generateCostDetailsReport/options.js"; +import type { + CostDetailsOperationResults, + GenerateCostDetailsReportRequestDefinition, +} from "../../models/models.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a GenerateCostDetailsReport operations. */ +export interface GenerateCostDetailsReportOperations { + /** This API is the replacement for all previously release Usage Details APIs. Request to generate a cost details report for the provided date range, billing period (Only enterprise customers) or Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll to get the result of the report generation. The 'Retry-After' provides the duration to wait before polling for the generated report. A call to poll the report operation will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details on the file(s) available for download will be available in the polling response body. To Understand cost details (formerly known as usage details) fields found in files ,see https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields */ + createOperation: ( + scope: string, + parameters: GenerateCostDetailsReportRequestDefinition, + options?: GenerateCostDetailsReportCreateOperationOptionalParams, + ) => PollerLike, CostDetailsOperationResults>; + /** Get the result of the specified operation. This link is provided in the CostDetails creation request response Location header. */ + getOperationResults: ( + scope: string, + operationId: string, + options?: GenerateCostDetailsReportGetOperationResultsOptionalParams, + ) => PollerLike, CostDetailsOperationResults>; +} + +function _getGenerateCostDetailsReport(context: CostManagementContext) { + return { + createOperation: ( + scope: string, + parameters: GenerateCostDetailsReportRequestDefinition, + options?: GenerateCostDetailsReportCreateOperationOptionalParams, + ) => createOperation(context, scope, parameters, options), + getOperationResults: ( + scope: string, + operationId: string, + options?: GenerateCostDetailsReportGetOperationResultsOptionalParams, + ) => getOperationResults(context, scope, operationId, options), + }; +} + +export function _getGenerateCostDetailsReportOperations( + context: CostManagementContext, +): GenerateCostDetailsReportOperations { + return { + ..._getGenerateCostDetailsReport(context), + }; +} diff --git a/sdk/cost-management/arm-costmanagement/src/classic/generateDetailedCostReport/index.ts b/sdk/cost-management/arm-costmanagement/src/classic/generateDetailedCostReport/index.ts new file mode 100644 index 000000000000..f66b2fa47d95 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/classic/generateDetailedCostReport/index.ts @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext } from "../../api/costManagementContext.js"; +import { createOperation } from "../../api/generateDetailedCostReport/operations.js"; +import type { GenerateDetailedCostReportCreateOperationOptionalParams } from "../../api/generateDetailedCostReport/options.js"; +import type { + GenerateDetailedCostReportOperationResult, + GenerateDetailedCostReportDefinition, +} from "../../models/models.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a GenerateDetailedCostReport operations. */ +export interface GenerateDetailedCostReportOperations { + /** 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. */ + createOperation: ( + scope: string, + parameters: GenerateDetailedCostReportDefinition, + options?: GenerateDetailedCostReportCreateOperationOptionalParams, + ) => PollerLike< + OperationState, + GenerateDetailedCostReportOperationResult + >; +} + +function _getGenerateDetailedCostReport(context: CostManagementContext) { + return { + createOperation: ( + scope: string, + parameters: GenerateDetailedCostReportDefinition, + options?: GenerateDetailedCostReportCreateOperationOptionalParams, + ) => createOperation(context, scope, parameters, options), + }; +} + +export function _getGenerateDetailedCostReportOperations( + context: CostManagementContext, +): GenerateDetailedCostReportOperations { + return { + ..._getGenerateDetailedCostReport(context), + }; +} diff --git a/sdk/cost-management/arm-costmanagement/src/classic/generateDetailedCostReportOperationResults/index.ts b/sdk/cost-management/arm-costmanagement/src/classic/generateDetailedCostReportOperationResults/index.ts new file mode 100644 index 000000000000..f112b9c1fed9 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/classic/generateDetailedCostReportOperationResults/index.ts @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext } from "../../api/costManagementContext.js"; +import { get } from "../../api/generateDetailedCostReportOperationResults/operations.js"; +import type { GenerateDetailedCostReportOperationResultsGetOptionalParams } from "../../api/generateDetailedCostReportOperationResults/options.js"; +import type { GenerateDetailedCostReportOperationResult } from "../../models/models.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a GenerateDetailedCostReportOperationResults operations. */ +export interface GenerateDetailedCostReportOperationResultsOperations { + /** Gets the result of the specified operation. The link with this operationId is provided as a response header of the initial request. */ + get: ( + operationId: string, + scope: string, + options?: GenerateDetailedCostReportOperationResultsGetOptionalParams, + ) => PollerLike< + OperationState, + GenerateDetailedCostReportOperationResult + >; +} + +function _getGenerateDetailedCostReportOperationResults(context: CostManagementContext) { + return { + get: ( + operationId: string, + scope: string, + options?: GenerateDetailedCostReportOperationResultsGetOptionalParams, + ) => get(context, operationId, scope, options), + }; +} + +export function _getGenerateDetailedCostReportOperationResultsOperations( + context: CostManagementContext, +): GenerateDetailedCostReportOperationResultsOperations { + return { + ..._getGenerateDetailedCostReportOperationResults(context), + }; +} diff --git a/sdk/cost-management/arm-costmanagement/src/classic/generateDetailedCostReportOperationStatus/index.ts b/sdk/cost-management/arm-costmanagement/src/classic/generateDetailedCostReportOperationStatus/index.ts new file mode 100644 index 000000000000..2a08fb7dffcb --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/classic/generateDetailedCostReportOperationStatus/index.ts @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext } from "../../api/costManagementContext.js"; +import { get } from "../../api/generateDetailedCostReportOperationStatus/operations.js"; +import type { GenerateDetailedCostReportOperationStatusGetOptionalParams } from "../../api/generateDetailedCostReportOperationStatus/options.js"; +import type { GenerateDetailedCostReportOperationStatuses } from "../../models/models.js"; + +/** Interface representing a GenerateDetailedCostReportOperationStatus operations. */ +export interface GenerateDetailedCostReportOperationStatusOperations { + /** Get the status of the specified operation. This link is provided in the GenerateDetailedCostReport creation request response header. */ + get: ( + operationId: string, + scope: string, + options?: GenerateDetailedCostReportOperationStatusGetOptionalParams, + ) => Promise; +} + +function _getGenerateDetailedCostReportOperationStatus(context: CostManagementContext) { + return { + get: ( + operationId: string, + scope: string, + options?: GenerateDetailedCostReportOperationStatusGetOptionalParams, + ) => get(context, operationId, scope, options), + }; +} + +export function _getGenerateDetailedCostReportOperationStatusOperations( + context: CostManagementContext, +): GenerateDetailedCostReportOperationStatusOperations { + return { + ..._getGenerateDetailedCostReportOperationStatus(context), + }; +} diff --git a/sdk/cost-management/arm-costmanagement/src/classic/generateReservationDetailsReport/index.ts b/sdk/cost-management/arm-costmanagement/src/classic/generateReservationDetailsReport/index.ts new file mode 100644 index 000000000000..a6f8b7d049cb --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/classic/generateReservationDetailsReport/index.ts @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext } from "../../api/costManagementContext.js"; +import { + byBillingProfileId, + byBillingAccountId, +} from "../../api/generateReservationDetailsReport/operations.js"; +import type { + GenerateReservationDetailsReportByBillingProfileIdOptionalParams, + GenerateReservationDetailsReportByBillingAccountIdOptionalParams, +} from "../../api/generateReservationDetailsReport/options.js"; +import type { OperationStatus } from "../../models/models.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a GenerateReservationDetailsReport operations. */ +export interface GenerateReservationDetailsReportOperations { + /** 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 */ + byBillingProfileId: ( + billingAccountId: string, + billingProfileId: string, + startDate: string, + endDate: string, + options?: GenerateReservationDetailsReportByBillingProfileIdOptionalParams, + ) => PollerLike, OperationStatus>; + /** 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 */ + byBillingAccountId: ( + billingAccountId: string, + startDate: string, + endDate: string, + options?: GenerateReservationDetailsReportByBillingAccountIdOptionalParams, + ) => PollerLike, OperationStatus>; +} + +function _getGenerateReservationDetailsReport(context: CostManagementContext) { + return { + byBillingProfileId: ( + billingAccountId: string, + billingProfileId: string, + startDate: string, + endDate: string, + options?: GenerateReservationDetailsReportByBillingProfileIdOptionalParams, + ) => + byBillingProfileId(context, billingAccountId, billingProfileId, startDate, endDate, options), + byBillingAccountId: ( + billingAccountId: string, + startDate: string, + endDate: string, + options?: GenerateReservationDetailsReportByBillingAccountIdOptionalParams, + ) => byBillingAccountId(context, billingAccountId, startDate, endDate, options), + }; +} + +export function _getGenerateReservationDetailsReportOperations( + context: CostManagementContext, +): GenerateReservationDetailsReportOperations { + return { + ..._getGenerateReservationDetailsReport(context), + }; +} diff --git a/sdk/cost-management/arm-costmanagement/src/classic/index.ts b/sdk/cost-management/arm-costmanagement/src/classic/index.ts new file mode 100644 index 000000000000..6f13324c53f3 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/classic/index.ts @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export type { AlertsOperations } from "./alerts/index.js"; +export type { BenefitRecommendationsOperations } from "./benefitRecommendations/index.js"; +export type { BenefitUtilizationSummariesOperations } from "./benefitUtilizationSummaries/index.js"; +export type { BudgetsOperations } from "./budgets/index.js"; +export type { CostAllocationRulesOperations } from "./costAllocationRules/index.js"; +export type { DimensionsOperations } from "./dimensions/index.js"; +export type { ExportsOperations } from "./exports/index.js"; +export type { ForecastOperations } from "./forecast/index.js"; +export type { GenerateBenefitUtilizationSummariesReportOperations } from "./generateBenefitUtilizationSummariesReport/index.js"; +export type { GenerateCostDetailsReportOperations } from "./generateCostDetailsReport/index.js"; +export type { GenerateDetailedCostReportOperations } from "./generateDetailedCostReport/index.js"; +export type { GenerateDetailedCostReportOperationResultsOperations } from "./generateDetailedCostReportOperationResults/index.js"; +export type { GenerateDetailedCostReportOperationStatusOperations } from "./generateDetailedCostReportOperationStatus/index.js"; +export type { GenerateReservationDetailsReportOperations } from "./generateReservationDetailsReport/index.js"; +export type { OperationsOperations } from "./operations/index.js"; +export type { PriceSheetOperations } from "./priceSheet/index.js"; +export type { QueryOperations } from "./query/index.js"; +export type { ScheduledActionsOperations } from "./scheduledActions/index.js"; +export type { SettingsOperations } from "./settings/index.js"; +export type { ViewsOperations } from "./views/index.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/classic/operations/index.ts b/sdk/cost-management/arm-costmanagement/src/classic/operations/index.ts new file mode 100644 index 000000000000..af4f30ebb0f3 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/classic/operations/index.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext } from "../../api/costManagementContext.js"; +import { list } from "../../api/operations/operations.js"; +import type { OperationsListOptionalParams } from "../../api/operations/options.js"; +import type { CostManagementOperation } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Operations operations. */ +export interface OperationsOperations { + /** List the operations for the provider */ + list: ( + options?: OperationsListOptionalParams, + ) => PagedAsyncIterableIterator; +} + +function _getOperations(context: CostManagementContext) { + return { + list: (options?: OperationsListOptionalParams) => list(context, options), + }; +} + +export function _getOperationsOperations(context: CostManagementContext): OperationsOperations { + return { + ..._getOperations(context), + }; +} diff --git a/sdk/cost-management/arm-costmanagement/src/classic/priceSheet/index.ts b/sdk/cost-management/arm-costmanagement/src/classic/priceSheet/index.ts new file mode 100644 index 000000000000..77def60b1407 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/classic/priceSheet/index.ts @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext } from "../../api/costManagementContext.js"; +import { + downloadByBillingAccount, + downloadByBillingProfile, + downloadByInvoice, +} from "../../api/priceSheet/operations.js"; +import type { + PriceSheetDownloadByBillingAccountOptionalParams, + PriceSheetDownloadByBillingProfileOptionalParams, + PriceSheetDownloadByInvoiceOptionalParams, +} from "../../api/priceSheet/options.js"; +import type { + DownloadURL, + OperationStatus, + PricesheetDownloadProperties, +} from "../../models/models.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a PriceSheet operations. */ +export interface PriceSheetOperations { + /** + * Generates the pricesheet for the provided billing period asynchronously based on the Enrollment ID. This is for Enterprise Agreement customers. + * + * **Migrate to version 2025-03-01** + * + * You can use the 2025-03-01 API version with the new URI: + * + * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.CostManagement/pricesheets/default/download' + * + * With a new schema detailed below, the new version of the price sheet provides additional information and includes prices for Azure Reserved Instances (RI) for the current billing period. We recommend downloading an Azure Price Sheet for when entering a new billing period if you would maintain an ongoing record of past Azure Reserved Instance (RI) pricing. + * + * The EA Azure price sheet is available for billing periods in the past 13 months. To request a price sheet for a billing period older than 13 months, please contact support. + * + * The Azure price sheet download experience has been updated from a single .csv file to a zip file containing multiple .csv files, each with max size of 75MB. The 2023-11-01 version has been upgraded to use http POST method; details can be found below. + * + * All versions of the Microsoft.Consumption Azure Price Sheet - Download by Billing Account (including 2022-06-01, 2021-10-01, 2020-01-01-preview, 2019-10-01, 2019-05-01) are scheduled to be retired on 01 June 2026 and will no longer be supported after this date. + */ + downloadByBillingAccount: ( + billingAccountId: string, + billingPeriodName: string, + options?: PriceSheetDownloadByBillingAccountOptionalParams, + ) => PollerLike, OperationStatus>; + /** + * 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. + * + * You can use the new 2023-09-01 API version for billing periods January 2023 onwards. Azure Reserved Instance (RI) pricing is only available through the new version of the API. + * + * Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv/json file to a Zip file containing multiple csv/json files, each with max size of 75MB. + */ + downloadByBillingProfile: ( + billingAccountName: string, + billingProfileName: string, + options?: PriceSheetDownloadByBillingProfileOptionalParams, + ) => PollerLike, PricesheetDownloadProperties>; + /** 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. */ + downloadByInvoice: ( + billingAccountName: string, + billingProfileName: string, + invoiceName: string, + options?: PriceSheetDownloadByInvoiceOptionalParams, + ) => PollerLike, DownloadURL>; +} + +function _getPriceSheet(context: CostManagementContext) { + return { + downloadByBillingAccount: ( + billingAccountId: string, + billingPeriodName: string, + options?: PriceSheetDownloadByBillingAccountOptionalParams, + ) => downloadByBillingAccount(context, billingAccountId, billingPeriodName, options), + downloadByBillingProfile: ( + billingAccountName: string, + billingProfileName: string, + options?: PriceSheetDownloadByBillingProfileOptionalParams, + ) => downloadByBillingProfile(context, billingAccountName, billingProfileName, options), + downloadByInvoice: ( + billingAccountName: string, + billingProfileName: string, + invoiceName: string, + options?: PriceSheetDownloadByInvoiceOptionalParams, + ) => downloadByInvoice(context, billingAccountName, billingProfileName, invoiceName, options), + }; +} + +export function _getPriceSheetOperations(context: CostManagementContext): PriceSheetOperations { + return { + ..._getPriceSheet(context), + }; +} diff --git a/sdk/cost-management/arm-costmanagement/src/classic/query/index.ts b/sdk/cost-management/arm-costmanagement/src/classic/query/index.ts new file mode 100644 index 000000000000..617cb84d02cc --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/classic/query/index.ts @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext } from "../../api/costManagementContext.js"; +import { usageByExternalCloudProviderType, usage } from "../../api/query/operations.js"; +import type { + QueryUsageByExternalCloudProviderTypeOptionalParams, + QueryUsageOptionalParams, +} from "../../api/query/options.js"; +import type { + QueryDefinition, + QueryResult, + ExternalCloudProviderType, +} from "../../models/models.js"; + +/** Interface representing a Query operations. */ +export interface QueryOperations { + /** Query the usage data for external cloud provider type defined. */ + usageByExternalCloudProviderType: ( + externalCloudProviderType: ExternalCloudProviderType, + externalCloudProviderId: string, + parameters: QueryDefinition, + options?: QueryUsageByExternalCloudProviderTypeOptionalParams, + ) => Promise; + /** Query the usage data for scope defined. */ + usage: ( + scope: string, + parameters: QueryDefinition, + options?: QueryUsageOptionalParams, + ) => Promise; +} + +function _getQuery(context: CostManagementContext) { + return { + usageByExternalCloudProviderType: ( + externalCloudProviderType: ExternalCloudProviderType, + externalCloudProviderId: string, + parameters: QueryDefinition, + options?: QueryUsageByExternalCloudProviderTypeOptionalParams, + ) => + usageByExternalCloudProviderType( + context, + externalCloudProviderType, + externalCloudProviderId, + parameters, + options, + ), + usage: (scope: string, parameters: QueryDefinition, options?: QueryUsageOptionalParams) => + usage(context, scope, parameters, options), + }; +} + +export function _getQueryOperations(context: CostManagementContext): QueryOperations { + return { + ..._getQuery(context), + }; +} diff --git a/sdk/cost-management/arm-costmanagement/src/classic/scheduledActions/index.ts b/sdk/cost-management/arm-costmanagement/src/classic/scheduledActions/index.ts new file mode 100644 index 000000000000..a57df2d0f764 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/classic/scheduledActions/index.ts @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext } from "../../api/costManagementContext.js"; +import { + checkNameAvailabilityByScope, + checkNameAvailability, + runByScope, + listByScope, + deleteByScope, + createOrUpdateByScope, + getByScope, + run, + list, + $delete, + createOrUpdate, + get, +} from "../../api/scheduledActions/operations.js"; +import type { + ScheduledActionsCheckNameAvailabilityByScopeOptionalParams, + ScheduledActionsCheckNameAvailabilityOptionalParams, + ScheduledActionsRunByScopeOptionalParams, + ScheduledActionsListByScopeOptionalParams, + ScheduledActionsDeleteByScopeOptionalParams, + ScheduledActionsCreateOrUpdateByScopeOptionalParams, + ScheduledActionsGetByScopeOptionalParams, + ScheduledActionsRunOptionalParams, + ScheduledActionsListOptionalParams, + ScheduledActionsDeleteOptionalParams, + ScheduledActionsCreateOrUpdateOptionalParams, + ScheduledActionsGetOptionalParams, +} from "../../api/scheduledActions/options.js"; +import type { + ScheduledAction, + CheckNameAvailabilityRequest, + CheckNameAvailabilityResponse, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a ScheduledActions operations. */ +export interface ScheduledActionsOperations { + /** Checks availability and correctness of the name for a scheduled action within the given scope. */ + checkNameAvailabilityByScope: ( + scope: string, + checkNameAvailabilityRequest: CheckNameAvailabilityRequest, + options?: ScheduledActionsCheckNameAvailabilityByScopeOptionalParams, + ) => Promise; + /** Checks availability and correctness of the name for a scheduled action. */ + checkNameAvailability: ( + checkNameAvailabilityRequest: CheckNameAvailabilityRequest, + options?: ScheduledActionsCheckNameAvailabilityOptionalParams, + ) => Promise; + /** Runs a shared scheduled action within the given scope. */ + runByScope: ( + scope: string, + name: string, + options?: ScheduledActionsRunByScopeOptionalParams, + ) => Promise; + /** List all shared scheduled actions within the given scope. */ + listByScope: ( + scope: string, + options?: ScheduledActionsListByScopeOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete a scheduled action within the given scope. */ + deleteByScope: ( + scope: string, + name: string, + options?: ScheduledActionsDeleteByScopeOptionalParams, + ) => Promise; + /** Create or update a shared scheduled action within the given scope. */ + createOrUpdateByScope: ( + scope: string, + name: string, + scheduledAction: ScheduledAction, + options?: ScheduledActionsCreateOrUpdateByScopeOptionalParams, + ) => Promise; + /** Get the shared scheduled action from the given scope by name. */ + getByScope: ( + scope: string, + name: string, + options?: ScheduledActionsGetByScopeOptionalParams, + ) => Promise; + /** Processes a private scheduled action. */ + run: (name: string, options?: ScheduledActionsRunOptionalParams) => Promise; + /** List all private scheduled actions. */ + list: ( + options?: ScheduledActionsListOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete a private scheduled action. */ + delete: (name: string, options?: ScheduledActionsDeleteOptionalParams) => Promise; + /** Create or update a private scheduled action. */ + createOrUpdate: ( + name: string, + scheduledAction: ScheduledAction, + options?: ScheduledActionsCreateOrUpdateOptionalParams, + ) => Promise; + /** Get the private scheduled action by name. */ + get: (name: string, options?: ScheduledActionsGetOptionalParams) => Promise; +} + +function _getScheduledActions(context: CostManagementContext) { + return { + checkNameAvailabilityByScope: ( + scope: string, + checkNameAvailabilityRequest: CheckNameAvailabilityRequest, + options?: ScheduledActionsCheckNameAvailabilityByScopeOptionalParams, + ) => checkNameAvailabilityByScope(context, scope, checkNameAvailabilityRequest, options), + checkNameAvailability: ( + checkNameAvailabilityRequest: CheckNameAvailabilityRequest, + options?: ScheduledActionsCheckNameAvailabilityOptionalParams, + ) => checkNameAvailability(context, checkNameAvailabilityRequest, options), + runByScope: (scope: string, name: string, options?: ScheduledActionsRunByScopeOptionalParams) => + runByScope(context, scope, name, options), + listByScope: (scope: string, options?: ScheduledActionsListByScopeOptionalParams) => + listByScope(context, scope, options), + deleteByScope: ( + scope: string, + name: string, + options?: ScheduledActionsDeleteByScopeOptionalParams, + ) => deleteByScope(context, scope, name, options), + createOrUpdateByScope: ( + scope: string, + name: string, + scheduledAction: ScheduledAction, + options?: ScheduledActionsCreateOrUpdateByScopeOptionalParams, + ) => createOrUpdateByScope(context, scope, name, scheduledAction, options), + getByScope: (scope: string, name: string, options?: ScheduledActionsGetByScopeOptionalParams) => + getByScope(context, scope, name, options), + run: (name: string, options?: ScheduledActionsRunOptionalParams) => run(context, name, options), + list: (options?: ScheduledActionsListOptionalParams) => list(context, options), + delete: (name: string, options?: ScheduledActionsDeleteOptionalParams) => + $delete(context, name, options), + createOrUpdate: ( + name: string, + scheduledAction: ScheduledAction, + options?: ScheduledActionsCreateOrUpdateOptionalParams, + ) => createOrUpdate(context, name, scheduledAction, options), + get: (name: string, options?: ScheduledActionsGetOptionalParams) => get(context, name, options), + }; +} + +export function _getScheduledActionsOperations( + context: CostManagementContext, +): ScheduledActionsOperations { + return { + ..._getScheduledActions(context), + }; +} diff --git a/sdk/cost-management/arm-costmanagement/src/classic/settings/index.ts b/sdk/cost-management/arm-costmanagement/src/classic/settings/index.ts new file mode 100644 index 000000000000..330b98019948 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/classic/settings/index.ts @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext } from "../../api/costManagementContext.js"; +import { + list, + deleteByScope, + createOrUpdateByScope, + getByScope, +} from "../../api/settings/operations.js"; +import type { + SettingsListOptionalParams, + SettingsDeleteByScopeOptionalParams, + SettingsCreateOrUpdateByScopeOptionalParams, + SettingsGetByScopeOptionalParams, +} from "../../api/settings/options.js"; +import type { SettingUnion, SettingType, SettingsListResult } from "../../models/models.js"; + +/** Interface representing a Settings operations. */ +export interface SettingsOperations { + /** List all cost management settings in the requested scope. */ + list: (scope: string, options?: SettingsListOptionalParams) => Promise; + /** Delete a setting within the given scope. */ + deleteByScope: ( + scope: string, + typeParam: SettingType, + options?: SettingsDeleteByScopeOptionalParams, + ) => Promise; + /** Create or update a setting within the given scope. */ + createOrUpdateByScope: ( + scope: string, + typeParam: SettingType, + setting: SettingUnion, + options?: SettingsCreateOrUpdateByScopeOptionalParams, + ) => Promise; + /** Get the setting from the given scope by name. */ + getByScope: ( + scope: string, + typeParam: SettingType, + options?: SettingsGetByScopeOptionalParams, + ) => Promise; +} + +function _getSettings(context: CostManagementContext) { + return { + list: (scope: string, options?: SettingsListOptionalParams) => list(context, scope, options), + deleteByScope: ( + scope: string, + typeParam: SettingType, + options?: SettingsDeleteByScopeOptionalParams, + ) => deleteByScope(context, scope, typeParam, options), + createOrUpdateByScope: ( + scope: string, + typeParam: SettingType, + setting: SettingUnion, + options?: SettingsCreateOrUpdateByScopeOptionalParams, + ) => createOrUpdateByScope(context, scope, typeParam, setting, options), + getByScope: ( + scope: string, + typeParam: SettingType, + options?: SettingsGetByScopeOptionalParams, + ) => getByScope(context, scope, typeParam, options), + }; +} + +export function _getSettingsOperations(context: CostManagementContext): SettingsOperations { + return { + ..._getSettings(context), + }; +} diff --git a/sdk/cost-management/arm-costmanagement/src/classic/views/index.ts b/sdk/cost-management/arm-costmanagement/src/classic/views/index.ts new file mode 100644 index 000000000000..d94c68707e72 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/classic/views/index.ts @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementContext } from "../../api/costManagementContext.js"; +import { + listByScope, + deleteByScope, + createOrUpdateByScope, + getByScope, + list, + $delete, + createOrUpdate, + get, +} from "../../api/views/operations.js"; +import type { + ViewsListByScopeOptionalParams, + ViewsDeleteByScopeOptionalParams, + ViewsCreateOrUpdateByScopeOptionalParams, + ViewsGetByScopeOptionalParams, + ViewsListOptionalParams, + ViewsDeleteOptionalParams, + ViewsCreateOrUpdateOptionalParams, + ViewsGetOptionalParams, +} from "../../api/views/options.js"; +import type { View } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Views operations. */ +export interface ViewsOperations { + /** Lists all views at the given scope. */ + listByScope: ( + scope: string, + options?: ViewsListByScopeOptionalParams, + ) => PagedAsyncIterableIterator; + /** The operation to delete a view. */ + deleteByScope: ( + scope: string, + viewName: string, + options?: ViewsDeleteByScopeOptionalParams, + ) => Promise; + /** 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. */ + createOrUpdateByScope: ( + scope: string, + viewName: string, + parameters: View, + options?: ViewsCreateOrUpdateByScopeOptionalParams, + ) => Promise; + /** Gets the view for the defined scope by view name. */ + getByScope: ( + scope: string, + viewName: string, + options?: ViewsGetByScopeOptionalParams, + ) => Promise; + /** Lists all views by tenant and object. */ + list: (options?: ViewsListOptionalParams) => PagedAsyncIterableIterator; + /** The operation to delete a view. */ + delete: (viewName: string, options?: ViewsDeleteOptionalParams) => Promise; + /** 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. */ + createOrUpdate: ( + viewName: string, + parameters: View, + options?: ViewsCreateOrUpdateOptionalParams, + ) => Promise; + /** Gets the view by view name. */ + get: (viewName: string, options?: ViewsGetOptionalParams) => Promise; +} + +function _getViews(context: CostManagementContext) { + return { + listByScope: (scope: string, options?: ViewsListByScopeOptionalParams) => + listByScope(context, scope, options), + deleteByScope: (scope: string, viewName: string, options?: ViewsDeleteByScopeOptionalParams) => + deleteByScope(context, scope, viewName, options), + createOrUpdateByScope: ( + scope: string, + viewName: string, + parameters: View, + options?: ViewsCreateOrUpdateByScopeOptionalParams, + ) => createOrUpdateByScope(context, scope, viewName, parameters, options), + getByScope: (scope: string, viewName: string, options?: ViewsGetByScopeOptionalParams) => + getByScope(context, scope, viewName, options), + list: (options?: ViewsListOptionalParams) => list(context, options), + delete: (viewName: string, options?: ViewsDeleteOptionalParams) => + $delete(context, viewName, options), + createOrUpdate: ( + viewName: string, + parameters: View, + options?: ViewsCreateOrUpdateOptionalParams, + ) => createOrUpdate(context, viewName, parameters, options), + get: (viewName: string, options?: ViewsGetOptionalParams) => get(context, viewName, options), + }; +} + +export function _getViewsOperations(context: CostManagementContext): ViewsOperations { + return { + ..._getViews(context), + }; +} diff --git a/sdk/cost-management/arm-costmanagement/src/costManagementClient.ts b/sdk/cost-management/arm-costmanagement/src/costManagementClient.ts index b71af3fb0e81..c20e2426c554 100644 --- a/sdk/cost-management/arm-costmanagement/src/costManagementClient.ts +++ b/sdk/cost-management/arm-costmanagement/src/costManagementClient.ts @@ -1,204 +1,134 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. -import * as coreClient from "@azure/core-client"; -import * as coreRestPipeline from "@azure/core-rest-pipeline"; -import { - PipelineRequest, - PipelineResponse, - SendRequest -} from "@azure/core-rest-pipeline"; -import * as coreAuth from "@azure/core-auth"; -import { - OperationsImpl, - ViewsImpl, - AlertsImpl, - ForecastImpl, - DimensionsImpl, - QueryImpl, - GenerateReservationDetailsReportImpl, - ExportsImpl, - GenerateCostDetailsReportImpl, - GenerateDetailedCostReportImpl, - GenerateDetailedCostReportOperationResultsImpl, - GenerateDetailedCostReportOperationStatusImpl, - PriceSheetImpl, - ScheduledActionsImpl, - BenefitRecommendationsImpl, - BenefitUtilizationSummariesImpl -} from "./operations/index.js"; -import { - Operations, - Views, - Alerts, - Forecast, - Dimensions, - Query, - GenerateReservationDetailsReport, - Exports, - GenerateCostDetailsReport, - GenerateDetailedCostReport, - GenerateDetailedCostReportOperationResults, - GenerateDetailedCostReportOperationStatus, - PriceSheet, - ScheduledActions, - BenefitRecommendations, - BenefitUtilizationSummaries -} from "./operationsInterfaces/index.js"; -import { CostManagementClientOptionalParams } from "./models/index.js"; +import type { CostManagementContext, CostManagementClientOptionalParams } from "./api/index.js"; +import { createCostManagement } from "./api/index.js"; +import type { AlertsOperations } from "./classic/alerts/index.js"; +import { _getAlertsOperations } from "./classic/alerts/index.js"; +import type { BenefitRecommendationsOperations } from "./classic/benefitRecommendations/index.js"; +import { _getBenefitRecommendationsOperations } from "./classic/benefitRecommendations/index.js"; +import type { BenefitUtilizationSummariesOperations } from "./classic/benefitUtilizationSummaries/index.js"; +import { _getBenefitUtilizationSummariesOperations } from "./classic/benefitUtilizationSummaries/index.js"; +import type { BudgetsOperations } from "./classic/budgets/index.js"; +import { _getBudgetsOperations } from "./classic/budgets/index.js"; +import type { CostAllocationRulesOperations } from "./classic/costAllocationRules/index.js"; +import { _getCostAllocationRulesOperations } from "./classic/costAllocationRules/index.js"; +import type { DimensionsOperations } from "./classic/dimensions/index.js"; +import { _getDimensionsOperations } from "./classic/dimensions/index.js"; +import type { ExportsOperations } from "./classic/exports/index.js"; +import { _getExportsOperations } from "./classic/exports/index.js"; +import type { ForecastOperations } from "./classic/forecast/index.js"; +import { _getForecastOperations } from "./classic/forecast/index.js"; +import type { GenerateBenefitUtilizationSummariesReportOperations } from "./classic/generateBenefitUtilizationSummariesReport/index.js"; +import { _getGenerateBenefitUtilizationSummariesReportOperations } from "./classic/generateBenefitUtilizationSummariesReport/index.js"; +import type { GenerateCostDetailsReportOperations } from "./classic/generateCostDetailsReport/index.js"; +import { _getGenerateCostDetailsReportOperations } from "./classic/generateCostDetailsReport/index.js"; +import type { GenerateDetailedCostReportOperations } from "./classic/generateDetailedCostReport/index.js"; +import { _getGenerateDetailedCostReportOperations } from "./classic/generateDetailedCostReport/index.js"; +import type { GenerateDetailedCostReportOperationResultsOperations } from "./classic/generateDetailedCostReportOperationResults/index.js"; +import { _getGenerateDetailedCostReportOperationResultsOperations } from "./classic/generateDetailedCostReportOperationResults/index.js"; +import type { GenerateDetailedCostReportOperationStatusOperations } from "./classic/generateDetailedCostReportOperationStatus/index.js"; +import { _getGenerateDetailedCostReportOperationStatusOperations } from "./classic/generateDetailedCostReportOperationStatus/index.js"; +import type { GenerateReservationDetailsReportOperations } from "./classic/generateReservationDetailsReport/index.js"; +import { _getGenerateReservationDetailsReportOperations } from "./classic/generateReservationDetailsReport/index.js"; +import type { OperationsOperations } from "./classic/operations/index.js"; +import { _getOperationsOperations } from "./classic/operations/index.js"; +import type { PriceSheetOperations } from "./classic/priceSheet/index.js"; +import { _getPriceSheetOperations } from "./classic/priceSheet/index.js"; +import type { QueryOperations } from "./classic/query/index.js"; +import { _getQueryOperations } from "./classic/query/index.js"; +import type { ScheduledActionsOperations } from "./classic/scheduledActions/index.js"; +import { _getScheduledActionsOperations } from "./classic/scheduledActions/index.js"; +import type { SettingsOperations } from "./classic/settings/index.js"; +import { _getSettingsOperations } from "./classic/settings/index.js"; +import type { ViewsOperations } from "./classic/views/index.js"; +import { _getViewsOperations } from "./classic/views/index.js"; +import type { TokenCredential } from "@azure/core-auth"; +import type { Pipeline } from "@azure/core-rest-pipeline"; -export class CostManagementClient extends coreClient.ServiceClient { - $host: string; - apiVersion: string; +export type { CostManagementClientOptionalParams } from "./api/costManagementContext.js"; - /** - * Initializes a new instance of the CostManagementClient class. - * @param credentials Subscription credentials which uniquely identify client subscription. - * @param options The parameter options - */ - constructor( - credentials: coreAuth.TokenCredential, - options?: CostManagementClientOptionalParams - ) { - if (credentials === undefined) { - throw new Error("'credentials' cannot be null"); - } +export class CostManagementClient { + private _client: CostManagementContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; - // Initializing default values for options - if (!options) { - options = {}; - } - const defaults: CostManagementClientOptionalParams = { - requestContentType: "application/json; charset=utf-8", - credential: credentials - }; - - const packageDetails = `azsdk-js-arm-costmanagement/1.0.0-beta.3`; - const userAgentPrefix = - options.userAgentOptions && options.userAgentOptions.userAgentPrefix - ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` - : `${packageDetails}`; - - const optionsWithDefaults = { - ...defaults, + /** CostManagement management client provides access to CostManagement resources for Azure Enterprise Subscriptions. */ + constructor(credential: TokenCredential, options: CostManagementClientOptionalParams = {}) { + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : `azsdk-js-client`; + this._client = createCostManagement(credential, { ...options, - userAgentOptions: { - userAgentPrefix - }, - endpoint: - options.endpoint ?? options.baseUri ?? "https://management.azure.com" - }; - super(optionsWithDefaults); - - let bearerTokenAuthenticationPolicyFound: boolean = false; - if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { - const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); - bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( - (pipelinePolicy) => - pipelinePolicy.name === - coreRestPipeline.bearerTokenAuthenticationPolicyName - ); - } - if ( - !options || - !options.pipeline || - options.pipeline.getOrderedPolicies().length == 0 || - !bearerTokenAuthenticationPolicyFound - ) { - this.pipeline.removePolicy({ - name: coreRestPipeline.bearerTokenAuthenticationPolicyName - }); - this.pipeline.addPolicy( - coreRestPipeline.bearerTokenAuthenticationPolicy({ - credential: credentials, - scopes: - optionsWithDefaults.credentialScopes ?? - `${optionsWithDefaults.endpoint}/.default`, - challengeCallbacks: { - authorizeRequestOnChallenge: - coreClient.authorizeRequestOnClaimChallenge - } - }) - ); - } - - // Assigning values to Constant parameters - this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2022-10-01"; - this.operations = new OperationsImpl(this); - this.views = new ViewsImpl(this); - this.alerts = new AlertsImpl(this); - this.forecast = new ForecastImpl(this); - this.dimensions = new DimensionsImpl(this); - this.query = new QueryImpl(this); - this.generateReservationDetailsReport = new GenerateReservationDetailsReportImpl( - this - ); - this.exports = new ExportsImpl(this); - this.generateCostDetailsReport = new GenerateCostDetailsReportImpl(this); - this.generateDetailedCostReport = new GenerateDetailedCostReportImpl(this); - this.generateDetailedCostReportOperationResults = new GenerateDetailedCostReportOperationResultsImpl( - this + userAgentOptions: { userAgentPrefix }, + }); + this.pipeline = this._client.pipeline; + this.priceSheet = _getPriceSheetOperations(this._client); + this.generateReservationDetailsReport = _getGenerateReservationDetailsReportOperations( + this._client, ); - this.generateDetailedCostReportOperationStatus = new GenerateDetailedCostReportOperationStatusImpl( - this - ); - this.priceSheet = new PriceSheetImpl(this); - this.scheduledActions = new ScheduledActionsImpl(this); - this.benefitRecommendations = new BenefitRecommendationsImpl(this); - this.benefitUtilizationSummaries = new BenefitUtilizationSummariesImpl( - this - ); - this.addCustomApiVersionPolicy(options.apiVersion); - } - - /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ - private addCustomApiVersionPolicy(apiVersion?: string) { - if (!apiVersion) { - return; - } - const apiVersionPolicy = { - name: "CustomApiVersionPolicy", - async sendRequest( - request: PipelineRequest, - next: SendRequest - ): Promise { - const param = request.url.split("?"); - if (param.length > 1) { - const newParams = param[1].split("&").map((item) => { - if (item.indexOf("api-version") > -1) { - return "api-version=" + apiVersion; - } else { - return item; - } - }); - request.url = param[0] + "?" + newParams.join("&"); - } - return next(request); - } - }; - this.pipeline.addPolicy(apiVersionPolicy); + this.query = _getQueryOperations(this._client); + this.dimensions = _getDimensionsOperations(this._client); + this.forecast = _getForecastOperations(this._client); + this.generateDetailedCostReport = _getGenerateDetailedCostReportOperations(this._client); + this.generateBenefitUtilizationSummariesReport = + _getGenerateBenefitUtilizationSummariesReportOperations(this._client); + this.benefitUtilizationSummaries = _getBenefitUtilizationSummariesOperations(this._client); + this.benefitRecommendations = _getBenefitRecommendationsOperations(this._client); + this.costAllocationRules = _getCostAllocationRulesOperations(this._client); + this.generateCostDetailsReport = _getGenerateCostDetailsReportOperations(this._client); + this.settings = _getSettingsOperations(this._client); + this.scheduledActions = _getScheduledActionsOperations(this._client); + this.alerts = _getAlertsOperations(this._client); + this.views = _getViewsOperations(this._client); + this.generateDetailedCostReportOperationResults = + _getGenerateDetailedCostReportOperationResultsOperations(this._client); + this.exports = _getExportsOperations(this._client); + this.budgets = _getBudgetsOperations(this._client); + this.operations = _getOperationsOperations(this._client); + this.generateDetailedCostReportOperationStatus = + _getGenerateDetailedCostReportOperationStatusOperations(this._client); } - operations: Operations; - views: Views; - alerts: Alerts; - forecast: Forecast; - dimensions: Dimensions; - query: Query; - generateReservationDetailsReport: GenerateReservationDetailsReport; - exports: Exports; - generateCostDetailsReport: GenerateCostDetailsReport; - generateDetailedCostReport: GenerateDetailedCostReport; - generateDetailedCostReportOperationResults: GenerateDetailedCostReportOperationResults; - generateDetailedCostReportOperationStatus: GenerateDetailedCostReportOperationStatus; - priceSheet: PriceSheet; - scheduledActions: ScheduledActions; - benefitRecommendations: BenefitRecommendations; - benefitUtilizationSummaries: BenefitUtilizationSummaries; + /** The operation groups for priceSheet */ + public readonly priceSheet: PriceSheetOperations; + /** The operation groups for generateReservationDetailsReport */ + public readonly generateReservationDetailsReport: GenerateReservationDetailsReportOperations; + /** The operation groups for query */ + public readonly query: QueryOperations; + /** The operation groups for dimensions */ + public readonly dimensions: DimensionsOperations; + /** The operation groups for forecast */ + public readonly forecast: ForecastOperations; + /** The operation groups for generateDetailedCostReport */ + public readonly generateDetailedCostReport: GenerateDetailedCostReportOperations; + /** The operation groups for generateBenefitUtilizationSummariesReport */ + public readonly generateBenefitUtilizationSummariesReport: GenerateBenefitUtilizationSummariesReportOperations; + /** The operation groups for benefitUtilizationSummaries */ + public readonly benefitUtilizationSummaries: BenefitUtilizationSummariesOperations; + /** The operation groups for benefitRecommendations */ + public readonly benefitRecommendations: BenefitRecommendationsOperations; + /** The operation groups for costAllocationRules */ + public readonly costAllocationRules: CostAllocationRulesOperations; + /** The operation groups for generateCostDetailsReport */ + public readonly generateCostDetailsReport: GenerateCostDetailsReportOperations; + /** The operation groups for settings */ + public readonly settings: SettingsOperations; + /** The operation groups for scheduledActions */ + public readonly scheduledActions: ScheduledActionsOperations; + /** The operation groups for alerts */ + public readonly alerts: AlertsOperations; + /** The operation groups for views */ + public readonly views: ViewsOperations; + /** The operation groups for generateDetailedCostReportOperationResults */ + public readonly generateDetailedCostReportOperationResults: GenerateDetailedCostReportOperationResultsOperations; + /** The operation groups for exports */ + public readonly exports: ExportsOperations; + /** The operation groups for budgets */ + public readonly budgets: BudgetsOperations; + /** The operation groups for operations */ + public readonly operations: OperationsOperations; + /** The operation groups for generateDetailedCostReportOperationStatus */ + public readonly generateDetailedCostReportOperationStatus: GenerateDetailedCostReportOperationStatusOperations; } diff --git a/sdk/cost-management/arm-costmanagement/src/index.ts b/sdk/cost-management/arm-costmanagement/src/index.ts index ebc48ce3cc91..1f42146fe3d8 100644 --- a/sdk/cost-management/arm-costmanagement/src/index.ts +++ b/sdk/cost-management/arm-costmanagement/src/index.ts @@ -1,13 +1,441 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { AzureSupportedClouds } from "./static-helpers/cloudSettingHelpers.js"; +import { AzureClouds } from "./static-helpers/cloudSettingHelpers.js"; +import type { + PageSettings, + ContinuablePage, + PagedAsyncIterableIterator, +} from "./static-helpers/pagingHelpers.js"; -/// -export { getContinuationToken } from "./pagingHelper.js"; -export * from "./models/index.js"; export { CostManagementClient } from "./costManagementClient.js"; -export * from "./operationsInterfaces/index.js"; +export type { RestorePollerOptions } from "./restorePollerHelpers.js"; +export { restorePoller } from "./restorePollerHelpers.js"; +export type { + GenerateDetailedCostReportOperationStatuses, + DownloadURL, + Status, + ReportOperationStatusType, + ErrorDetails, + ExtensionResource, + Resource, + SystemData, + CreatedByType, + ErrorResponse, + CostManagementOperation, + Operation, + OperationDisplay, + Origin, + ActionType, + Budget, + BudgetProperties, + CategoryType, + TimeGrainType, + BudgetTimePeriod, + BudgetFilter, + BudgetFilterProperties, + BudgetComparisonExpression, + BudgetOperatorType, + CurrentSpend, + Notification, + BudgetNotificationOperatorType, + Frequency, + ThresholdType, + CultureCode, + ForecastSpend, + Export, + ExportProperties, + ExportSchedule, + StatusType, + RecurrenceType, + ExportRecurrencePeriod, + SystemAssignedServiceIdentity, + SystemAssignedServiceIdentityType, + CommonExportProperties, + FormatType, + ExportDeliveryInfo, + ExportDeliveryDestination, + DestinationType, + ExportDefinition, + ExportType, + TimeframeType, + ExportTimePeriod, + ExportDataset, + GranularityType, + ExportDatasetConfiguration, + FilterItems, + FilterItemNames, + ExportExecutionListResult, + ExportRun, + ExportRunProperties, + ExecutionType, + ExecutionStatus, + DataOverwriteBehaviorType, + CompressionModeType, + ExportSuspensionContext, + CostManagementProxyResource, + ExportListResult, + ExportRunRequest, + GenerateDetailedCostReportOperationResult, + View, + ViewProperties, + ReportConfigDefinition, + ReportType, + ReportTimeframeType, + ReportConfigTimePeriod, + ReportConfigDataset, + ReportGranularityType, + ReportConfigDatasetConfiguration, + ReportConfigAggregation, + FunctionType, + ReportConfigGrouping, + QueryColumnType, + ReportConfigSorting, + ReportConfigSortingType, + ReportConfigFilter, + ReportConfigComparisonExpression, + OperatorType, + ChartType, + AccumulatedType, + MetricType, + KpiProperties, + KpiType, + PivotProperties, + PivotType, + ProxyResource, + Alert, + AlertProperties, + AlertPropertiesDefinition, + AlertType, + AlertCategory, + AlertCriteria, + AlertSource, + AlertPropertiesDetails, + AlertTimeGrainType, + AlertOperator, + AlertStatus, + DismissAlertPayload, + AlertsResult, + ScheduledAction, + ScheduledActionProperties, + FileDestination, + FileFormat, + NotificationProperties, + ScheduleProperties, + ScheduleFrequency, + DaysOfWeek, + WeeksOfMonth, + ScheduledActionStatus, + ScheduledActionKind, + ErrorResponseWithNestedDetails, + ErrorDetailsWithNestedDetails, + CheckNameAvailabilityRequest, + CheckNameAvailabilityResponse, + CheckNameAvailabilityReason, + Setting, + SettingUnion, + SettingsKind, + SettingType, + TagInheritanceSetting, + TagInheritanceProperties, + SettingsListResult, + CostDetailsOperationResults, + CostDetailsStatusType, + ReportManifest, + CostDetailsDataFormat, + RequestContext, + GenerateCostDetailsReportRequestDefinition, + CostDetailsMetricType, + CostDetailsTimePeriod, + BlobInfo, + GenerateCostDetailsReportErrorResponse, + ErrorDetail, + ErrorAdditionalInfo, + CostAllocationRuleDefinition, + CostAllocationRuleProperties, + CostAllocationRuleDetails, + SourceCostAllocationResource, + TargetCostAllocationResource, + CostAllocationProportion, + CostAllocationPolicyType, + RuleStatus, + CostAllocationResource, + CostAllocationResourceType, + CostAllocationRuleCheckNameAvailabilityRequest, + CostAllocationRuleCheckNameAvailabilityResponse, + Reason, + BenefitRecommendationModel, + BenefitRecommendationProperties, + BenefitRecommendationPropertiesUnion, + LookBackPeriod, + RecommendationUsageDetails, + Grain, + Term, + AllSavingsBenefitDetails, + AllSavingsList, + Scope, + SingleScopeBenefitRecommendationProperties, + SharedScopeBenefitRecommendationProperties, + BenefitResource, + BenefitKind, + BenefitUtilizationSummary, + BenefitUtilizationSummaryUnion, + IncludedQuantityUtilizationSummary, + IncludedQuantityUtilizationSummaryProperties, + SavingsPlanUtilizationSummary, + SavingsPlanUtilizationSummaryProperties, + BenefitUtilizationSummaryProperties, + BenefitUtilizationSummariesRequest, + BenefitUtilizationSummariesOperationStatus, + OperationStatusType, + AsyncOperationStatusProperties, + BenefitUtilizationSummaryReportSchema, + ArmErrorResponse, + GenerateDetailedCostReportDefinition, + GenerateDetailedCostReportMetricType, + GenerateDetailedCostReportTimePeriod, + GenerateDetailedCostReportErrorResponse, + ForecastDefinition, + ForecastType, + ForecastTimeframe, + ForecastTimePeriod, + ForecastDataset, + ForecastDatasetConfiguration, + ForecastAggregation, + FunctionName, + ForecastFilter, + ForecastComparisonExpression, + ForecastOperatorType, + ForecastResult, + ForecastProperties, + ForecastColumn, + CostManagementResource, + Dimension, + DimensionProperties, + QueryDefinition, + QueryTimePeriod, + QueryDataset, + QueryDatasetConfiguration, + QueryAggregation, + QueryGrouping, + QueryFilter, + QueryComparisonExpression, + QueryOperatorType, + QueryResult, + QueryProperties, + QueryColumn, + OperationStatus, + ReportURL, + ReservationReportSchema, + PricesheetDownloadProperties, + MCAPriceSheetProperties, + ExternalCloudProviderType, + GrainParameter, +} from "./models/index.js"; +export { + KnownReportOperationStatusType, + KnownCreatedByType, + KnownOrigin, + KnownActionType, + KnownCategoryType, + KnownTimeGrainType, + KnownBudgetOperatorType, + KnownBudgetNotificationOperatorType, + KnownFrequency, + KnownThresholdType, + KnownCultureCode, + KnownStatusType, + KnownRecurrenceType, + KnownSystemAssignedServiceIdentityType, + KnownFormatType, + KnownDestinationType, + KnownExportType, + KnownTimeframeType, + KnownGranularityType, + KnownFilterItemNames, + KnownExecutionType, + KnownExecutionStatus, + KnownDataOverwriteBehaviorType, + KnownCompressionModeType, + KnownReportType, + KnownReportTimeframeType, + KnownReportGranularityType, + KnownFunctionType, + KnownQueryColumnType, + KnownReportConfigSortingType, + KnownOperatorType, + KnownChartType, + KnownAccumulatedType, + KnownMetricType, + KnownKpiType, + KnownPivotType, + KnownAlertType, + KnownAlertCategory, + KnownAlertCriteria, + KnownAlertSource, + KnownAlertTimeGrainType, + KnownAlertOperator, + KnownAlertStatus, + KnownFileFormat, + KnownScheduleFrequency, + KnownDaysOfWeek, + KnownWeeksOfMonth, + KnownScheduledActionStatus, + KnownScheduledActionKind, + KnownCheckNameAvailabilityReason, + KnownSettingsKind, + KnownSettingType, + KnownCostDetailsStatusType, + KnownCostDetailsDataFormat, + KnownCostDetailsMetricType, + KnownCostAllocationPolicyType, + KnownRuleStatus, + KnownCostAllocationResourceType, + KnownReason, + KnownLookBackPeriod, + KnownGrain, + KnownTerm, + KnownScope, + KnownBenefitKind, + KnownOperationStatusType, + KnownBenefitUtilizationSummaryReportSchema, + KnownGenerateDetailedCostReportMetricType, + KnownForecastType, + KnownForecastTimeframe, + KnownFunctionName, + KnownForecastOperatorType, + KnownQueryOperatorType, + KnownReservationReportSchema, + KnownExternalCloudProviderType, + KnownGrainParameter, + KnownVersions, +} from "./models/index.js"; +export type { CostManagementClientOptionalParams } from "./api/index.js"; +export type { + AlertsListExternalOptionalParams, + AlertsListOptionalParams, + AlertsDismissOptionalParams, + AlertsGetOptionalParams, +} from "./api/alerts/index.js"; +export type { BenefitRecommendationsListOptionalParams } from "./api/benefitRecommendations/index.js"; +export type { + BenefitUtilizationSummariesListBySavingsPlanIdOptionalParams, + BenefitUtilizationSummariesListBySavingsPlanOrderOptionalParams, + BenefitUtilizationSummariesListByBillingProfileIdOptionalParams, + BenefitUtilizationSummariesListByBillingAccountIdOptionalParams, +} from "./api/benefitUtilizationSummaries/index.js"; +export type { + BudgetsListOptionalParams, + BudgetsDeleteOptionalParams, + BudgetsCreateOrUpdateOptionalParams, + BudgetsGetOptionalParams, +} from "./api/budgets/index.js"; +export type { + CostAllocationRulesCheckNameAvailabilityOptionalParams, + CostAllocationRulesListOptionalParams, + CostAllocationRulesDeleteOptionalParams, + CostAllocationRulesCreateOrUpdateOptionalParams, + CostAllocationRulesGetOptionalParams, +} from "./api/costAllocationRules/index.js"; +export type { + DimensionsListByExternalCloudProviderTypeOptionalParams, + DimensionsListOptionalParams, +} from "./api/dimensions/index.js"; +export type { + ExportsGetExecutionHistoryOptionalParams, + ExportsExecuteOptionalParams, + ExportsListOptionalParams, + ExportsDeleteOptionalParams, + ExportsCreateOrUpdateOptionalParams, + ExportsGetOptionalParams, +} from "./api/exports/index.js"; +export type { + ForecastExternalCloudProviderUsageOptionalParams, + ForecastUsageOptionalParams, +} from "./api/forecast/index.js"; +export type { + GenerateBenefitUtilizationSummariesReportGenerateBySavingsPlanIdOptionalParams, + GenerateBenefitUtilizationSummariesReportGenerateBySavingsPlanOrderIdOptionalParams, + GenerateBenefitUtilizationSummariesReportGenerateByReservationIdOptionalParams, + GenerateBenefitUtilizationSummariesReportGenerateByReservationOrderIdOptionalParams, + GenerateBenefitUtilizationSummariesReportGenerateByBillingProfileOptionalParams, + GenerateBenefitUtilizationSummariesReportGenerateByBillingAccountOptionalParams, +} from "./api/generateBenefitUtilizationSummariesReport/index.js"; +export type { + GenerateCostDetailsReportCreateOperationOptionalParams, + GenerateCostDetailsReportGetOperationResultsOptionalParams, +} from "./api/generateCostDetailsReport/index.js"; +export type { GenerateDetailedCostReportCreateOperationOptionalParams } from "./api/generateDetailedCostReport/index.js"; +export type { GenerateDetailedCostReportOperationResultsGetOptionalParams } from "./api/generateDetailedCostReportOperationResults/index.js"; +export type { GenerateDetailedCostReportOperationStatusGetOptionalParams } from "./api/generateDetailedCostReportOperationStatus/index.js"; +export type { + GenerateReservationDetailsReportByBillingProfileIdOptionalParams, + GenerateReservationDetailsReportByBillingAccountIdOptionalParams, +} from "./api/generateReservationDetailsReport/index.js"; +export type { OperationsListOptionalParams } from "./api/operations/index.js"; +export type { + PriceSheetDownloadByBillingAccountOptionalParams, + PriceSheetDownloadByBillingProfileOptionalParams, + PriceSheetDownloadByInvoiceOptionalParams, +} from "./api/priceSheet/index.js"; +export type { + QueryUsageByExternalCloudProviderTypeOptionalParams, + QueryUsageOptionalParams, +} from "./api/query/index.js"; +export type { + ScheduledActionsCheckNameAvailabilityByScopeOptionalParams, + ScheduledActionsCheckNameAvailabilityOptionalParams, + ScheduledActionsRunByScopeOptionalParams, + ScheduledActionsListByScopeOptionalParams, + ScheduledActionsDeleteByScopeOptionalParams, + ScheduledActionsCreateOrUpdateByScopeOptionalParams, + ScheduledActionsGetByScopeOptionalParams, + ScheduledActionsRunOptionalParams, + ScheduledActionsListOptionalParams, + ScheduledActionsDeleteOptionalParams, + ScheduledActionsCreateOrUpdateOptionalParams, + ScheduledActionsGetOptionalParams, +} from "./api/scheduledActions/index.js"; +export type { + SettingsListOptionalParams, + SettingsDeleteByScopeOptionalParams, + SettingsCreateOrUpdateByScopeOptionalParams, + SettingsGetByScopeOptionalParams, +} from "./api/settings/index.js"; +export type { + ViewsListByScopeOptionalParams, + ViewsDeleteByScopeOptionalParams, + ViewsCreateOrUpdateByScopeOptionalParams, + ViewsGetByScopeOptionalParams, + ViewsListOptionalParams, + ViewsDeleteOptionalParams, + ViewsCreateOrUpdateOptionalParams, + ViewsGetOptionalParams, +} from "./api/views/index.js"; +export type { + AlertsOperations, + BenefitRecommendationsOperations, + BenefitUtilizationSummariesOperations, + BudgetsOperations, + CostAllocationRulesOperations, + DimensionsOperations, + ExportsOperations, + ForecastOperations, + GenerateBenefitUtilizationSummariesReportOperations, + GenerateCostDetailsReportOperations, + GenerateDetailedCostReportOperations, + GenerateDetailedCostReportOperationResultsOperations, + GenerateDetailedCostReportOperationStatusOperations, + GenerateReservationDetailsReportOperations, + OperationsOperations, + PriceSheetOperations, + QueryOperations, + ScheduledActionsOperations, + SettingsOperations, + ViewsOperations, +} from "./classic/index.js"; +export type { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; +export { AzureClouds }; +export type { AzureSupportedClouds }; +export { RestError, isRestError } from "@azure/core-rest-pipeline"; diff --git a/sdk/cost-management/arm-costmanagement/src/logger.ts b/sdk/cost-management/arm-costmanagement/src/logger.ts new file mode 100644 index 000000000000..d39baeb85b35 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/logger.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { createClientLogger } from "@azure/logger"; +export const logger = createClientLogger("arm-costmanagement"); diff --git a/sdk/cost-management/arm-costmanagement/src/lroImpl.ts b/sdk/cost-management/arm-costmanagement/src/lroImpl.ts deleted file mode 100644 index a1dab276a1b7..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/lroImpl.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { AbortSignalLike } from "@azure/abort-controller"; -import { LongRunningOperation, LroResponse } from "@azure/core-lro"; - -export function createLroSpec(inputs: { - sendOperationFn: (args: any, spec: any) => Promise>; - args: Record; - spec: { - readonly requestBody?: unknown; - readonly path?: string; - readonly httpMethod: string; - } & Record; -}): LongRunningOperation { - const { args, spec, sendOperationFn } = inputs; - return { - requestMethod: spec.httpMethod, - requestPath: spec.path!, - sendInitialRequest: () => sendOperationFn(args, spec), - sendPollRequest: ( - path: string, - options?: { abortSignal?: AbortSignalLike } - ) => { - const { requestBody, ...restSpec } = spec; - return sendOperationFn(args, { - ...restSpec, - httpMethod: "GET", - path, - abortSignal: options?.abortSignal - }); - } - }; -} diff --git a/sdk/cost-management/arm-costmanagement/src/models/index.ts b/sdk/cost-management/arm-costmanagement/src/models/index.ts index ab85a022b54c..82658641f1ce 100644 --- a/sdk/cost-management/arm-costmanagement/src/models/index.ts +++ b/sdk/cost-management/arm-costmanagement/src/models/index.ts @@ -1,3354 +1,302 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import * as coreClient from "@azure/core-client"; - -export type BenefitRecommendationPropertiesUnion = - | BenefitRecommendationProperties - | SingleScopeBenefitRecommendationProperties - | SharedScopeBenefitRecommendationProperties; -export type BenefitUtilizationSummaryUnion = - | BenefitUtilizationSummary - | IncludedQuantityUtilizationSummary - | SavingsPlanUtilizationSummary; - -/** Result of listing cost management operations. It contains a list of operations and a URL link to get the next set of results. */ -export interface OperationListResult { - /** - * List of cost management operations supported by the Microsoft.CostManagement resource provider. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: CostManagementOperation[]; - /** - * URL to get the next set of operation list results if there are any. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** Details of a REST API operation, returned from the Resource Provider Operations API */ -export interface Operation { - /** - * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly isDataAction?: boolean; - /** Localized display information for this particular operation. */ - display?: OperationDisplay; - /** - * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly origin?: Origin; - /** - * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly actionType?: ActionType; -} - -/** Localized display information for this particular operation. */ -export interface OperationDisplay { - /** - * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provider?: string; - /** - * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly resource?: string; - /** - * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly operation?: string; - /** - * The short, localized friendly description of the operation; suitable for tool tips and detailed views. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly description?: string; -} - -/** - * 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. - */ -export interface ErrorResponse { - /** The details of the error. */ - error?: ErrorDetails; -} - -/** The details of the error. */ -export interface ErrorDetails { - /** - * Error code. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly code?: string; - /** - * Error message indicating why the operation failed. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly message?: string; -} - -/** Result of listing views. It contains a list of available views. */ -export interface ViewListResult { - /** - * The list of views. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: View[]; - /** - * The link (url) to the next page of results. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** The start and end date for pulling data for the report. */ -export interface ReportConfigTimePeriod { - /** The start date to pull data from. */ - from: Date; - /** The end date to pull data to. */ - to: Date; -} - -/** The definition of data present in the report. */ -export interface ReportConfigDataset { - /** The granularity of rows in the report. */ - granularity?: ReportGranularityType; - /** Has configuration information for the data in the report. The configuration will be ignored if aggregation and grouping are provided. */ - configuration?: ReportConfigDatasetConfiguration; - /** 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?: { [propertyName: string]: ReportConfigAggregation }; - /** Array of group by expression to use in the report. Report can have up to 2 group by clauses. */ - grouping?: ReportConfigGrouping[]; - /** Array of order by expression to use in the report. */ - sorting?: ReportConfigSorting[]; - /** Has filter expression to use in the report. */ - filter?: ReportConfigFilter; -} - -/** The configuration of dataset in the report. */ -export interface ReportConfigDatasetConfiguration { - /** 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[]; -} - -/** The aggregation expression to be used in the report. */ -export interface ReportConfigAggregation { - /** The name of the column to aggregate. */ - name: string; - /** The name of the aggregation function to use. */ - function: FunctionType; -} - -/** The group by expression to be used in the report. */ -export interface ReportConfigGrouping { - /** Has type of the column to group. */ - type: QueryColumnType; - /** The name of the column to group. This version supports subscription lowest possible grain. */ - name: string; -} - -/** The order by expression to be used in the report. */ -export interface ReportConfigSorting { - /** Direction of sort. */ - direction?: ReportConfigSortingType; - /** The name of the column to sort. */ - name: string; -} - -/** The filter expression to be used in the report. */ -export interface ReportConfigFilter { - /** The logical "AND" expression. Must have at least 2 items. */ - and?: ReportConfigFilter[]; - /** The logical "OR" expression. Must have at least 2 items. */ - or?: ReportConfigFilter[]; - /** Has comparison expression for a dimension */ - dimensions?: ReportConfigComparisonExpression; - /** Has comparison expression for a tag */ - tags?: ReportConfigComparisonExpression; -} - -/** The comparison expression to be used in the report. */ -export interface ReportConfigComparisonExpression { - /** The name of the column to use in comparison. */ - name: string; - /** The operator to use for comparison. */ - operator: OperatorType; - /** Array of values to use for comparison */ - values: string[]; -} - -/** Each KPI must contain a 'type' and 'enabled' key. */ -export interface KpiProperties { - /** KPI type (Forecast, Budget). */ - type?: KpiType; - /** ID of resource related to metric (budget). */ - id?: string; - /** show the KPI in the UI? */ - enabled?: boolean; -} - -/** Each pivot must contain a 'type' and 'name'. */ -export interface PivotProperties { - /** Data type to show in view. */ - type?: PivotType; - /** Data field to show in view. */ - name?: string; -} - -/** The Resource model definition. */ -export interface CostManagementProxyResource { - /** - * Resource Id. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * Resource name. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * Resource type. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** 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; -} - -/** Result of alerts. */ -export interface AlertsResult { - /** - * List of alerts. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: Alert[]; - /** - * URL to get the next set of alerts results if there are any. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** defines the type of alert */ -export interface AlertPropertiesDefinition { - /** type of alert */ - type?: AlertType; - /** Alert category */ - category?: AlertCategory; - /** Criteria that triggered alert */ - criteria?: AlertCriteria; -} - -/** Alert details */ -export interface AlertPropertiesDetails { - /** Type of timegrain cadence */ - timeGrainType?: AlertTimeGrainType; - /** datetime of periodStartDate */ - periodStartDate?: string; - /** notificationId that triggered this alert */ - triggeredBy?: string; - /** array of resourceGroups to filter by */ - resourceGroupFilter?: any[]; - /** array of resources to filter by */ - resourceFilter?: any[]; - /** array of meters to filter by */ - meterFilter?: any[]; - /** tags to filter by */ - tagFilter?: Record; - /** notification threshold percentage as a decimal which activated this alert */ - threshold?: number; - /** operator used to compare currentSpend with amount */ - operator?: AlertOperator; - /** budget threshold amount */ - amount?: number; - /** unit of currency being used */ - unit?: string; - /** current spend */ - currentSpend?: number; - /** list of emails to contact */ - contactEmails?: string[]; - /** list of action groups to broadcast to */ - contactGroups?: string[]; - /** list of contact roles */ - contactRoles?: string[]; - /** overriding alert */ - overridingAlert?: string; - /** department name */ - departmentName?: string; - /** company name */ - companyName?: string; - /** enrollment number */ - enrollmentNumber?: string; - /** datetime of enrollmentStartDate */ - enrollmentStartDate?: string; - /** datetime of enrollmentEndDate */ - enrollmentEndDate?: string; - /** invoicing threshold */ - invoicingThreshold?: number; -} - -/** The request payload to update an alert */ -export interface DismissAlertPayload { - /** defines the type of alert */ - definition?: AlertPropertiesDefinition; - /** Alert description */ - description?: string; - /** Source of alert */ - source?: AlertSource; - /** Alert details */ - details?: AlertPropertiesDetails; - /** related budget */ - costEntityId?: string; - /** alert status */ - status?: AlertStatus; - /** dateTime in which alert was created */ - creationTime?: string; - /** dateTime in which alert was closed */ - closeTime?: string; - /** dateTime in which alert was last modified */ - modificationTime?: string; - /** User who last modified the alert */ - statusModificationUserName?: string; - /** dateTime in which the alert status was last modified */ - statusModificationTime?: string; -} - -/** The definition of a forecast. */ -export interface ForecastDefinition { - /** The type of the forecast. */ - type: ForecastType; - /** The time frame for pulling data for the forecast. If custom, then a specific time period must be provided. */ - timeframe: ForecastTimeframe; - /** Has time period for pulling data for the forecast. */ - timePeriod?: ForecastTimePeriod; - /** Has definition for data in this forecast. */ - dataset: ForecastDataset; - /** A boolean determining if actualCost will be included. */ - includeActualCost?: boolean; - /** A boolean determining if FreshPartialCost will be included. */ - includeFreshPartialCost?: boolean; -} - -/** Has time period for pulling data for the forecast. */ -export interface ForecastTimePeriod { - /** The start date to pull data from. */ - from: Date; - /** The end date to pull data to. */ - to: Date; -} - -/** The definition of data present in the forecast. */ -export interface ForecastDataset { - /** The granularity of rows in the forecast. */ - granularity?: GranularityType; - /** Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided. */ - configuration?: ForecastDatasetConfiguration; - /** 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: { [propertyName: string]: ForecastAggregation }; - /** Has filter expression to use in the forecast. */ - filter?: ForecastFilter; -} - -/** The configuration of dataset in the forecast. */ -export interface ForecastDatasetConfiguration { - /** Array of column names to be included in the forecast. Any valid forecast column name is allowed. If not provided, then forecast includes all columns. */ - columns?: string[]; -} - -/** The aggregation expression to be used in the forecast. */ -export interface ForecastAggregation { - /** The name of the column to aggregate. */ - name: FunctionName; - /** The name of the aggregation function to use. */ - function: FunctionType; -} - -/** The filter expression to be used in the export. */ -export interface ForecastFilter { - /** The logical "AND" expression. Must have at least 2 items. */ - and?: ForecastFilter[]; - /** The logical "OR" expression. Must have at least 2 items. */ - or?: ForecastFilter[]; - /** Has comparison expression for a dimension */ - dimensions?: ForecastComparisonExpression; - /** Has comparison expression for a tag */ - tags?: ForecastComparisonExpression; -} - -/** The comparison expression to be used in the forecast. */ -export interface ForecastComparisonExpression { - /** The name of the column to use in comparison. */ - name: string; - /** The operator to use for comparison. */ - operator: ForecastOperatorType; - /** Array of values to use for comparison */ - values: string[]; -} - -/** Forecast column properties */ -export interface ForecastColumn { - /** The name of column. */ - name?: string; - /** The type of column. */ - type?: string; -} - -/** The Resource model definition. */ -export interface CostManagementResource { - /** - * Resource Id. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * Resource name. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * Resource type. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** - * Location of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly location?: string; - /** - * SKU of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly sku?: string; - /** - * ETag of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly eTag?: string; - /** - * Resource tags. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly tags?: { [propertyName: string]: string }; -} - -/** Result of listing dimensions. It contains a list of available dimensions. */ -export interface DimensionsListResult { - /** - * The list of dimensions. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: Dimension[]; -} - -/** The definition of a query. */ -export interface QueryDefinition { - /** The type of the query. */ - type: ExportType; - /** The time frame for pulling data for the query. If custom, then a specific time period must be provided. */ - timeframe: TimeframeType; - /** Has time period for pulling data for the query. */ - timePeriod?: QueryTimePeriod; - /** Has definition for data in this query. */ - dataset: QueryDataset; -} - -/** The start and end date for pulling data for the query. */ -export interface QueryTimePeriod { - /** The start date to pull data from. */ - from: Date; - /** The end date to pull data to. */ - to: Date; -} - -/** The definition of data present in the query. */ -export interface QueryDataset { - /** The granularity of rows in the query. */ - granularity?: GranularityType; - /** Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided. */ - configuration?: QueryDatasetConfiguration; - /** 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?: { [propertyName: string]: QueryAggregation }; - /** Array of group by expression to use in the query. Query can have up to 2 group by clauses. */ - grouping?: QueryGrouping[]; - /** The filter expression to use in the query. Please reference our Query API REST documentation for how to properly format the filter. */ - filter?: QueryFilter; -} - -/** The configuration of dataset in the query. */ -export interface QueryDatasetConfiguration { - /** 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[]; -} - -/** The aggregation expression to be used in the query. */ -export interface QueryAggregation { - /** The name of the column to aggregate. */ - name: string; - /** The name of the aggregation function to use. */ - function: FunctionType; -} - -/** The group by expression to be used in the query. */ -export interface QueryGrouping { - /** Has type of the column to group. */ - type: QueryColumnType; - /** The name of the column to group. */ - name: string; -} - -/** The filter expression to be used in the export. */ -export interface QueryFilter { - /** The logical "AND" expression. Must have at least 2 items. */ - and?: QueryFilter[]; - /** The logical "OR" expression. Must have at least 2 items. */ - or?: QueryFilter[]; - /** Has comparison expression for a dimension */ - dimensions?: QueryComparisonExpression; - /** Has comparison expression for a tag */ - tags?: QueryComparisonExpression; -} - -/** The comparison expression to be used in the query. */ -export interface QueryComparisonExpression { - /** The name of the column to use in comparison. */ - name: string; - /** The operator to use for comparison. */ - operator: QueryOperatorType; - /** Array of values to use for comparison */ - values: string[]; -} - -/** QueryColumn properties */ -export interface QueryColumn { - /** The name of column. */ - name?: string; - /** The type of column. */ - type?: string; -} - -/** The status of the long running operation. */ -export interface OperationStatus { - /** The status of the long running operation. */ - status?: OperationStatusType; - /** The CSV file from the reportUrl blob link consists of reservation usage data with the following schema at daily granularity */ - reportUrl?: ReservationReportSchema; - /** The time at which report URL becomes invalid. */ - validUntil?: Date; -} - -/** Result of listing exports. It contains a list of available exports in the scope provided. */ -export interface ExportListResult { - /** - * The list of exports. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: Export[]; -} - -/** The schedule associated with the export. */ -export interface ExportSchedule { - /** The status of the export's schedule. If 'Inactive', the export's schedule is paused. */ - status?: StatusType; - /** The schedule recurrence. */ - recurrence?: RecurrenceType; - /** 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; -} - -/** The start and end date for recurrence schedule. */ -export interface ExportRecurrencePeriod { - /** The start date of recurrence. */ - from: Date; - /** The end date of recurrence. */ - to?: Date; -} - -/** The common properties of the export. */ -export interface CommonExportProperties { - /** The format of the export being delivered. Currently only 'Csv' is supported. */ - format?: FormatType; - /** Has delivery information for the export. */ - deliveryInfo: ExportDeliveryInfo; - /** Has the definition for the export. */ - definition: ExportDefinition; - /** If requested, has the most recent run history for the export. */ - runHistory?: ExportExecutionListResult; - /** If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. Note: this option is currently available only for Microsoft Customer Agreement commerce scopes. */ - partitionData?: boolean; - /** - * If the export has an active schedule, provides an estimate of the next run time. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextRunTimeEstimate?: Date; -} - -/** The delivery information associated with a export. */ -export interface ExportDeliveryInfo { - /** Has destination for the export being delivered. */ - destination: 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 ). */ -export interface ExportDeliveryDestination { - /** 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; - /** The name of the container where exports will be uploaded. If the container does not exist it will be created. */ - container: string; - /** The name of the directory where exports will be uploaded. */ - rootFolderPath?: string; - /** 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; - /** 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; -} - -/** The definition of an export. */ -export interface ExportDefinition { - /** 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; - /** The time frame for pulling data for the export. If custom, then a specific time period must be provided. */ - timeframe: TimeframeType; - /** Has time period for pulling data for the export. */ - timePeriod?: ExportTimePeriod; - /** The definition for data in the export. */ - dataSet?: ExportDataset; -} - -/** 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. */ -export interface ExportTimePeriod { - /** The start date for export data. */ - from: Date; - /** The end date for export data. */ - to: Date; -} - -/** The definition for data in the export. */ -export interface ExportDataset { - /** The granularity of rows in the export. Currently only 'Daily' is supported. */ - granularity?: GranularityType; - /** The export dataset configuration. */ - configuration?: ExportDatasetConfiguration; -} - -/** The export dataset configuration. Allows columns to be selected for the export. If not provided then the export will include all available columns. */ -export interface ExportDatasetConfiguration { - /** 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[]; -} - -/** Result of listing the run history of an export. */ -export interface ExportExecutionListResult { - /** - * A list of export runs. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: ExportRun[]; -} - -/** The definition of a cost detailed report. */ -export interface GenerateCostDetailsReportRequestDefinition { - /** The type of the detailed report. By default ActualCost is provided */ - metric?: CostDetailsMetricType; - /** The specific date range of cost details requested for the report. This parameter cannot be used alongside either the invoiceId or billingPeriod parameters. If a timePeriod, invoiceId or billingPeriod parameter is not provided in the request body the API will return the current month's cost. API only allows data to be pulled for 1 month or less and no older than 13 months. If no timePeriod or billingPeriod or invoiceId is provided the API defaults to the open month time period */ - timePeriod?: CostDetailsTimePeriod; - /** This parameter can be used only by Enterprise Agreement customers. Use the YearMonth(e.g. 202008) format. This parameter cannot be used alongside either the invoiceId or timePeriod parameters. If a timePeriod, invoiceId or billingPeriod parameter is not provided in the request body the API will return the current month's cost. */ - billingPeriod?: string; - /** This parameter can only be used by Microsoft Customer Agreement customers. Additionally, it can only be used at the Billing Profile or Customer scope. This parameter cannot be used alongside either the billingPeriod or timePeriod parameters. If a timePeriod, invoiceId or billingPeriod parameter is not provided in the request body the API will return the current month's cost. */ - invoiceId?: string; -} - -/** The 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. */ -export interface CostDetailsTimePeriod { - /** The start date to pull data from. example format 2020-03-15 */ - start: string; - /** The end date to pull data to. example format 2020-03-15 */ - end: string; -} - -/** The result of the long running operation for cost details Api. */ -export interface CostDetailsOperationResults { - /** The id of the long running operation. */ - id?: string; - /** The name of the long running operation. */ - name?: string; - /** The type of the long running operation. */ - type?: string; - /** The status of the cost details operation */ - status?: CostDetailsStatusType; - /** The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. */ - validTill?: Date; - /** The details of the error. */ - error?: ErrorDetails; - /** The Manifest version. */ - manifestVersion?: string; - /** The data format of the report */ - dataFormat?: CostDetailsDataFormat; - /** The total number of bytes in all blobs. */ - byteCount?: number; - /** The total number of blobs. */ - blobCount?: number; - /** Is the data in compressed format. */ - compressData?: boolean; - /** List of blob information generated by this operation. */ - blobs?: BlobInfo[]; - /** The request scope of the request. */ - requestScope?: string; - /** The request payload body provided in Cost Details call */ - requestBody?: GenerateCostDetailsReportRequestDefinition; -} - -/** The blob information generated by this operation. */ -export interface BlobInfo { - /** Link to the blob to download file. */ - blobLink?: string; - /** Bytes in the blob. */ - byteCount?: number; -} - -/** - * 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. - */ -export interface GenerateCostDetailsReportErrorResponse { - /** The details of the error. */ - error?: ErrorDetails; -} - -/** The definition of a cost detailed report. */ -export interface GenerateDetailedCostReportDefinition { - /** The type of the detailed report. By default ActualCost is provided */ - metric?: GenerateDetailedCostReportMetricType; - /** 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; - /** 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; - /** Invoice ID for Pay-as-you-go and Microsoft Customer Agreement scopes. Can only have one of either timePeriod or invoiceId or billingPeriod parameters. If none provided current month cost is provided. */ - invoiceId?: string; - /** Customer ID for Microsoft Customer Agreement scopes (Invoice Id is also required for this). */ - customerId?: string; -} - -/** The start and end date for pulling data for the cost detailed report. */ -export interface GenerateDetailedCostReportTimePeriod { - /** The start date to pull data from. example format 2020-03-15 */ - start: string; - /** The end date to pull data to. example format 2020-03-15 */ - end: string; -} - -/** The result of the long running operation for cost detailed report. */ -export interface GenerateDetailedCostReportOperationResult { - /** The ARM resource id of the long running operation. */ - id?: string; - /** The name of the long running operation. */ - name?: string; - /** The type of the long running operation. */ - type?: string; - /** - * The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly expiryTime?: Date; - /** The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. */ - validTill?: Date; - /** The URL to download the generated report. */ - downloadUrl?: string; -} - -/** The URL to download the generated report. */ -export interface DownloadURL { - /** - * The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly expiryTime?: Date; - /** The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. */ - validTill?: Date; - /** The URL to download the generated report. */ - downloadUrl?: string; -} - -/** - * 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. - */ -export interface GenerateDetailedCostReportErrorResponse { - /** The details of the error. */ - error?: ErrorDetails; -} - -/** The status of the long running operation for cost detailed report. */ -export interface GenerateDetailedCostReportOperationStatuses { - /** The ID of the long running operation. */ - id?: string; - /** The name of the long running operation. */ - name?: string; - /** The status of the long running operation. */ - status?: Status; - /** The startTime of the operation. */ - startTime?: string; - /** The endTime of the operation. */ - endTime?: string; - /** The type of the long running operation. */ - type?: string; - /** The details of the error. */ - error?: ErrorDetails; - /** - * The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly expiryTime?: Date; - /** The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. */ - validTill?: Date; - /** The URL to download the generated report. */ - downloadUrl?: string; -} - -/** The status of the long running operation. */ -export interface Status { - /** The status of the long running operation. */ - status?: ReportOperationStatusType; -} - -/** Scheduled actions list result. It contains a list of scheduled actions. */ -export interface ScheduledActionListResult { - /** - * The list of scheduled actions. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: ScheduledAction[]; - /** - * The link (url) to the next page of results. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** Destination of the view data. This is optional. Currently only CSV format is supported. */ -export interface FileDestination { - /** Destination of the view data. Currently only CSV format is supported. */ - fileFormats?: FileFormat[]; -} - -/** The properties of the scheduled action notification. */ -export interface NotificationProperties { - /** Array of email addresses. */ - to: string[]; - /** Locale of the email. */ - language?: string; - /** Optional message to be added in the email. Length is limited to 250 characters. */ - message?: string; - /** Regional format used for formatting date/time and currency values in the email. */ - regionalFormat?: string; - /** Subject of the email. Length is limited to 70 characters. */ - subject: string; -} - -/** The properties of the schedule. */ -export interface ScheduleProperties { - /** Frequency of the schedule. */ - frequency: ScheduleFrequency; - /** UTC time at which cost analysis data will be emailed. */ - hourOfDay?: number; - /** Day names in english on which cost analysis data will be emailed. This property is applicable when frequency is Weekly or Monthly. */ - daysOfWeek?: DaysOfWeek[]; - /** 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[]; - /** 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?: number; - /** The start date and time of the scheduled action (UTC). */ - startDate: Date; - /** The end date and time of the scheduled action (UTC). */ - endDate: Date; -} - -/** Metadata pertaining to creation and last modification of the resource. */ -export interface SystemData { - /** The identity that created the resource. */ - createdBy?: string; - /** The type of identity that created the resource. */ - createdByType?: CreatedByType; - /** The timestamp of resource creation (UTC). */ - createdAt?: Date; - /** The identity that last modified the resource. */ - lastModifiedBy?: string; - /** The type of identity that last modified the resource. */ - lastModifiedByType?: CreatedByType; - /** The timestamp of resource last modification (UTC) */ - lastModifiedAt?: Date; -} - -/** Common fields that are returned in the response for all Azure Resource Manager resources */ -export interface Resource { - /** - * Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * The name of the resource - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; -} - -/** - * 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. - */ -export interface ErrorResponseWithNestedDetails { - /** The details of the error. */ - error?: ErrorDetailsWithNestedDetails; -} - -/** The check availability request body. */ -export interface CheckNameAvailabilityRequest { - /** The name of the resource for which availability needs to be checked. */ - name?: string; - /** The resource type. */ - type?: string; -} - -/** The check availability result. */ -export interface CheckNameAvailabilityResponse { - /** Indicates if the resource name is available. */ - nameAvailable?: boolean; - /** The reason why the given name is not available. */ - reason?: CheckNameAvailabilityReason; - /** Detailed reason why the given name is available. */ - message?: string; -} - -/** Result of listing benefit recommendations. */ -export interface BenefitRecommendationsListResult { - /** - * The list of benefit recommendations. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: BenefitRecommendationModel[]; - /** - * The link (URL) to the next page of results. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** The properties of the benefit recommendations. */ -export interface BenefitRecommendationProperties { - /** Polymorphic discriminator, which specifies the different types this object can be */ - scope: "Single" | "Shared"; - /** - * The first usage date used for looking back for computing the recommendations. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly firstConsumptionDate?: Date; - /** - * The last usage date used for looking back for computing the recommendations. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly lastConsumptionDate?: Date; - /** The number of days of usage evaluated for computing the recommendations. */ - lookBackPeriod?: LookBackPeriod; - /** - * The total hours for which the cost is covered. Its equal to number of records in a property 'properties/usage/charges'. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly totalHours?: number; - /** On-demand charges between firstConsumptionDate and lastConsumptionDate that were used for computing benefit recommendations. */ - usage?: RecommendationUsageDetails; - /** - * ARM SKU name. 'Compute_Savings_Plan' for SavingsPlan. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly armSkuName?: string; - /** Term period of the benefit. For example, P1Y or P3Y. */ - term?: Term; - /** Grain of the proposed commitment amount. Supported values: 'Hourly' */ - commitmentGranularity?: Grain; - /** - * An ISO 4217 currency code identifier for the costs and savings amounts. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly currencyCode?: string; - /** - * The current cost without benefit, corresponds to 'totalHours' in the look-back period. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly costWithoutBenefit?: number; - /** The details of the proposed recommendation. */ - recommendationDetails?: AllSavingsBenefitDetails; - /** - * The list of all benefit recommendations with the recommendation details. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly allRecommendationDetails?: AllSavingsList; -} - -/** On-demand charges between firstConsumptionDate and lastConsumptionDate that were used for computing benefit recommendations. */ -export interface RecommendationUsageDetails { - /** The grain of the usage. Supported values: 'Hourly' */ - usageGrain?: Grain; - /** - * On-demand charges for each hour between firstConsumptionDate and lastConsumptionDate that were used for computing benefit recommendations. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly charges?: number[]; -} - -/** Benefit recommendation details. */ -export interface AllSavingsBenefitDetails { - /** - * The difference between total cost and benefit cost for the 'totalHours' in the look-back period. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly overageCost?: number; - /** - * The estimated cost with benefit for the 'totalHours' in the look-back period. It's equal to (commitmentAmount * totalHours) - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly benefitCost?: number; - /** - * Total cost, which is sum of benefit cost and overage cost. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly totalCost?: number; - /** - * The amount saved for the 'totalHours' in the look-back period, by purchasing the recommended quantity of the benefit. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly savingsAmount?: number; - /** - * The savings in percentage for the 'totalHours' in the look-back period, by purchasing the recommended quantity of benefit. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly savingsPercentage?: number; - /** - * Estimated benefit coverage percentage for the 'totalHours' in the look-back period, with this commitment. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly coveragePercentage?: number; - /** - * The commitment amount at the commitmentGranularity. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly commitmentAmount?: number; - /** - * Estimated average utilization percentage for the 'totalHours' in the look-back period, with this commitment. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly averageUtilizationPercentage?: number; - /** - * Estimated unused portion of the 'benefitCost'. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly wastageCost?: number; -} - -/** The list of all benefit recommendations with the recommendation details. */ -export interface AllSavingsList { - /** - * The list of benefit recommendations with the recommendation details.. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: AllSavingsBenefitDetails[]; - /** - * The link (URL) to the next page of results. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** List of benefit utilization summaries. */ -export interface BenefitUtilizationSummariesListResult { - /** - * The list of benefit utilization summaries. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: BenefitUtilizationSummaryUnion[]; - /** - * The link (URL) to the next page of results. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** The properties of a benefit utilization summary. */ -export interface BenefitUtilizationSummaryProperties { - /** - * ARM SKU name. For example, 'Compute_Savings_Plan' for savings plan. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly armSkuName?: string; - /** - * The benefit ID is the identifier of the benefit. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly benefitId?: string; - /** - * The benefit order ID is the identifier for a benefit purchase. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly benefitOrderId?: string; - /** The benefit type. Supported values: 'SavingsPlan'. */ - benefitType?: BenefitKind; - /** - * Date corresponding to the utilization summary record. If the grain of data is monthly, value for this field will be first day of the month. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly usageDate?: Date; -} - -/** A Cost management REST API operation. */ -export interface CostManagementOperation extends Operation { - /** - * Operation id: {provider}/{resource}/{operation}. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; -} - -/** The details of the error. */ -export interface ErrorDetailsWithNestedDetails extends ErrorDetails { - /** - * The additional details of the error. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly details?: ErrorDetailsWithNestedDetails[]; -} - -/** States and configurations of Cost Analysis. */ -export interface View extends CostManagementProxyResource { - /** User input name of the view. Required. */ - displayName?: string; - /** 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; - /** - * Date the user created this view. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly createdOn?: Date; - /** - * Date when the user last modified this view. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly modifiedOn?: Date; - /** - * Date range of the current view. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly dateRange?: string; - /** - * Currency of the current view. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly currency?: string; - /** Chart type of the main view in Cost Analysis. Required. */ - chart?: ChartType; - /** Show costs accumulated over time. */ - accumulated?: AccumulatedType; - /** Metric to use when displaying costs. */ - metric?: MetricType; - /** List of KPIs to show in Cost Analysis UI. */ - kpis?: KpiProperties[]; - /** Configuration of 3 sub-views in the Cost Analysis UI. */ - pivots?: PivotProperties[]; - /** 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. */ - typePropertiesQueryType?: ReportType; - /** The time frame for pulling data for the report. If custom, then a specific time period must be provided. */ - timeframe?: ReportTimeframeType; - /** Has time period for pulling data for the report. */ - timePeriod?: ReportConfigTimePeriod; - /** Has definition for data in this report config. */ - dataSet?: ReportConfigDataset; - /** If true, report includes monetary commitment. */ - includeMonetaryCommitment?: boolean; -} - -/** An individual alert. */ -export interface Alert extends CostManagementProxyResource { - /** defines the type of alert */ - definition?: AlertPropertiesDefinition; - /** Alert description */ - description?: string; - /** Source of alert */ - source?: AlertSource; - /** Alert details */ - details?: AlertPropertiesDetails; - /** related budget */ - costEntityId?: string; - /** alert status */ - status?: AlertStatus; - /** dateTime in which alert was created */ - creationTime?: string; - /** dateTime in which alert was closed */ - closeTime?: string; - /** dateTime in which alert was last modified */ - modificationTime?: string; - /** User who last modified the alert */ - statusModificationUserName?: string; - /** dateTime in which the alert status was last modified */ - statusModificationTime?: string; -} - -/** An export run. */ -export interface ExportRun extends CostManagementProxyResource { - /** The type of the export run. */ - executionType?: ExecutionType; - /** The last known status of the export run. */ - status?: ExecutionStatus; - /** The identifier for the entity that triggered the export. For on-demand runs it is the user email. For scheduled runs it is 'System'. */ - submittedBy?: string; - /** The time when export was queued to be run. */ - submittedTime?: Date; - /** The time when export was picked up to be run. */ - processingStartTime?: Date; - /** The time when the export run finished. */ - processingEndTime?: Date; - /** The name of the exported file. */ - fileName?: string; - /** The export settings that were in effect for this run. */ - runSettings?: CommonExportProperties; - /** The details of any error. */ - error?: ErrorDetails; -} - -/** An export resource. */ -export interface Export extends CostManagementProxyResource { - /** The format of the export being delivered. Currently only 'Csv' is supported. */ - format?: FormatType; - /** Has delivery information for the export. */ - deliveryInfo?: ExportDeliveryInfo; - /** Has the definition for the export. */ - definition?: ExportDefinition; - /** If requested, has the most recent run history for the export. */ - runHistory?: ExportExecutionListResult; - /** If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. Note: this option is currently available only for Microsoft Customer Agreement commerce scopes. */ - partitionData?: boolean; - /** - * If the export has an active schedule, provides an estimate of the next run time. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextRunTimeEstimate?: Date; - /** Has schedule information for the export. */ - schedule?: ExportSchedule; -} - -/** Result of forecast. It contains all columns listed under groupings and aggregation. */ -export interface ForecastResult extends CostManagementResource { - /** The link (url) to the next page of results. */ - nextLink?: string; - /** Array of columns */ - columns?: ForecastColumn[]; - /** Array of rows */ - rows?: any[][]; -} - -/** List of Dimension. */ -export interface Dimension extends CostManagementResource { - /** - * Dimension description. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly description?: string; - /** - * Filter enabled. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly filterEnabled?: boolean; - /** - * Grouping enabled. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly groupingEnabled?: boolean; - /** Dimension data. */ - data?: string[]; - /** - * Total number of data for the dimension. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly total?: number; - /** - * Dimension category. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly category?: string; - /** - * Usage start. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly usageStart?: Date; - /** - * Usage end. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly usageEnd?: Date; - /** - * The link (url) to the next page of results. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** Result of query. It contains all columns listed under groupings and aggregation. */ -export interface QueryResult extends CostManagementResource { - /** The link (url) to the next page of results. */ - nextLink?: string; - /** Array of columns */ - columns?: QueryColumn[]; - /** Array of rows */ - rows?: any[][]; -} - -/** The properties of the export. */ -export interface ExportProperties extends CommonExportProperties { - /** Has schedule information for the export. */ - schedule?: ExportSchedule; -} - -/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ -export interface ProxyResource extends Resource {} - -/** The benefit resource model definition. */ -export interface BenefitResource extends Resource { - /** Reservation or SavingsPlan. */ - kind?: BenefitKind; -} - -/** Benefit utilization summary resource. */ -export interface BenefitUtilizationSummary extends Resource { - /** Supported values: 'SavingsPlan'. */ - kind: BenefitKind; -} - -/** The properties of the benefit recommendations when scope is 'Single'. */ -export interface SingleScopeBenefitRecommendationProperties - extends BenefitRecommendationProperties { - /** Polymorphic discriminator, which specifies the different types this object can be */ - scope: "Single"; - /** - * The subscription ID that this single scope recommendation is for. Applicable only if recommendation is for 'Single' scope. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly subscriptionId?: string; - /** - * The resource group that this single scope recommendation is for. Applicable only if recommendation is for 'Single' scope and 'ResourceGroup' request scope. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly resourceGroup?: string; -} - -/** The properties of the benefit recommendation when scope is 'Shared'. */ -export interface SharedScopeBenefitRecommendationProperties - extends BenefitRecommendationProperties { - /** Polymorphic discriminator, which specifies the different types this object can be */ - scope: "Shared"; -} - -/** Included Quantity utilization summary properties. */ -export interface IncludedQuantityUtilizationSummaryProperties - extends BenefitUtilizationSummaryProperties { - /** - * This is the utilized percentage for the benefit ID. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly utilizationPercentage?: number; -} - -/** Savings plan utilization summary properties. */ -export interface SavingsPlanUtilizationSummaryProperties - extends BenefitUtilizationSummaryProperties { - /** - * This is the average hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2022-10-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the avgUtilizationPercentage value will be equal to the average of the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly avgUtilizationPercentage?: number; - /** - * This is the minimum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2022-10-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the minUtilizationPercentage value will be equal to the smallest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the lowest utilization percentage was 10% at hour 4, then the value for the minUtilizationPercentage in the response will be 10%. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly minUtilizationPercentage?: number; - /** - * This is the maximum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2022-10-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the maxUtilizationPercentage value will be equal to the largest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the largest utilization percentage was 90% at hour 5, then the value for the maxUtilizationPercentage in the response will be 90%. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly maxUtilizationPercentage?: number; -} - -/** The Resource model definition. */ -export interface ScheduledActionProxyResource extends ProxyResource { - /** - * Resource Etag. For update calls, eTag is optional and can be specified to achieve optimistic concurrency. Fetch the resource's eTag by doing a 'GET' call first and then including the latest eTag as part of the request body or 'If-Match' header while performing the update. For create calls, eTag is not required. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly eTag?: string; - /** Kind of the scheduled action. */ - kind?: ScheduledActionKind; - /** - * Kind of the scheduled action. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; -} - -/** benefit plan recommendation details. */ -export interface BenefitRecommendationModel extends BenefitResource { - /** The properties of the benefit recommendations. */ - properties?: BenefitRecommendationPropertiesUnion; -} - -/** Included Quantity utilization summary resource. */ -export interface IncludedQuantityUtilizationSummary - extends BenefitUtilizationSummary { - /** Polymorphic discriminator, which specifies the different types this object can be */ - kind: "IncludedQuantity"; - /** - * ARM SKU name. For example, 'Compute_Savings_Plan' for savings plan. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly armSkuName?: string; - /** - * The benefit ID is the identifier of the benefit. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly benefitId?: string; - /** - * The benefit order ID is the identifier for a benefit purchase. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly benefitOrderId?: string; - /** The benefit type. Supported values: 'SavingsPlan'. */ - benefitType?: BenefitKind; - /** - * Date corresponding to the utilization summary record. If the grain of data is monthly, value for this field will be first day of the month. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly usageDate?: Date; - /** - * This is the utilized percentage for the benefit ID. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly utilizationPercentage?: number; -} - -/** Savings plan utilization summary resource. */ -export interface SavingsPlanUtilizationSummary - extends BenefitUtilizationSummary { - /** Polymorphic discriminator, which specifies the different types this object can be */ - kind: "SavingsPlan"; - /** - * ARM SKU name. For example, 'Compute_Savings_Plan' for savings plan. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly armSkuName?: string; - /** - * The benefit ID is the identifier of the benefit. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly benefitId?: string; - /** - * The benefit order ID is the identifier for a benefit purchase. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly benefitOrderId?: string; - /** The benefit type. Supported values: 'SavingsPlan'. */ - benefitType?: BenefitKind; - /** - * Date corresponding to the utilization summary record. If the grain of data is monthly, value for this field will be first day of the month. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly usageDate?: Date; - /** - * This is the average hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2022-10-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the avgUtilizationPercentage value will be equal to the average of the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly avgUtilizationPercentage?: number; - /** - * This is the minimum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2022-10-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the minUtilizationPercentage value will be equal to the smallest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the lowest utilization percentage was 10% at hour 4, then the value for the minUtilizationPercentage in the response will be 10%. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly minUtilizationPercentage?: number; - /** - * This is the maximum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2022-10-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the maxUtilizationPercentage value will be equal to the largest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the largest utilization percentage was 90% at hour 5, then the value for the maxUtilizationPercentage in the response will be 90%. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly maxUtilizationPercentage?: number; -} - -/** Scheduled action definition. */ -export interface ScheduledAction extends ScheduledActionProxyResource { - /** Scheduled action name. */ - displayName?: string; - /** Destination format of the view data. This is optional. */ - fileDestination?: FileDestination; - /** Notification properties based on scheduled action kind. */ - notification?: NotificationProperties; - /** Email address of the point of contact that should get the unsubscribe requests and notification emails. */ - notificationEmail?: string; - /** Schedule of the scheduled action. */ - schedule?: ScheduleProperties; - /** 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; - /** Status of the scheduled action. */ - status?: ScheduledActionStatus; - /** Cost analysis viewId used for scheduled action. For example, '/providers/Microsoft.CostManagement/views/swaggerExample' */ - viewId?: string; -} - -/** Defines headers for GenerateReservationDetailsReport_byBillingAccountId operation. */ -export interface GenerateReservationDetailsReportByBillingAccountIdHeaders { - /** The URL to check the status of the asynchronous operation. */ - location?: string; - /** The amount of delay to use while the status of the operation is checked. The value is expressed in seconds. */ - retryAfter?: number; -} - -/** Defines headers for GenerateReservationDetailsReport_byBillingProfileId operation. */ -export interface GenerateReservationDetailsReportByBillingProfileIdHeaders { - /** The URL to check the status of the asynchronous operation. */ - location?: string; - /** The amount of delay to use while the status of the operation is checked. The value is expressed in seconds. */ - retryAfter?: number; -} - -/** Defines headers for GenerateCostDetailsReport_createOperation operation. */ -export interface GenerateCostDetailsReportCreateOperationHeaders { - /** The URL to check the result of the asynchronous operation. */ - location?: string; - /** The amount of delay to use while the status of the operation is checked. The value is expressed in seconds. */ - retryAfter?: number; -} - -/** Defines headers for GenerateDetailedCostReport_createOperation operation. */ -export interface GenerateDetailedCostReportCreateOperationHeaders { - /** The URL to check the result of the asynchronous operation. */ - location?: string; - /** The URL to check the status of the asynchronous operation. */ - azureConsumptionAsyncOperation?: string; - /** The URL to check the status of the asynchronous operation. */ - azureAsyncOperation?: string; - /** The amount of delay to use while the status of the operation is checked. The value is expressed in seconds. */ - retryAfter?: number; -} - -/** Defines headers for PriceSheet_download operation. */ -export interface PriceSheetDownloadHeaders { - /** GET this URL to retrieve the status of the asynchronous operation. */ - location?: string; - /** The amount of delay to use while the status of the operation is checked. The value is expressed in seconds. */ - retryAfter?: string; - /** The operation entity Id GUID. */ - oDataEntityId?: string; -} - -/** Defines headers for PriceSheet_downloadByBillingProfile operation. */ -export interface PriceSheetDownloadByBillingProfileHeaders { - /** GET this URL to retrieve the status of the asynchronous operation. */ - location?: string; - /** The amount of delay to use while the status of the operation is checked. The value is expressed in seconds. */ - retryAfter?: string; - /** The operation entity Id GUID. */ - oDataEntityId?: string; -} - -/** Known values of {@link Origin} that the service accepts. */ -export enum KnownOrigin { - /** User */ - User = "user", - /** System */ - System = "system", - /** UserSystem */ - UserSystem = "user,system" -} - -/** - * Defines values for Origin. \ - * {@link KnownOrigin} can be used interchangeably with Origin, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **user** \ - * **system** \ - * **user,system** - */ -export type Origin = string; - -/** Known values of {@link ActionType} that the service accepts. */ -export enum KnownActionType { - /** Internal */ - Internal = "Internal" -} - -/** - * Defines values for ActionType. \ - * {@link KnownActionType} can be used interchangeably with ActionType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Internal** - */ -export type ActionType = string; - -/** Known values of {@link ReportType} that the service accepts. */ -export enum KnownReportType { - /** Usage */ - Usage = "Usage" -} - -/** - * Defines values for ReportType. \ - * {@link KnownReportType} can be used interchangeably with ReportType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Usage** - */ -export type ReportType = string; - -/** Known values of {@link ReportTimeframeType} that the service accepts. */ -export enum KnownReportTimeframeType { - /** WeekToDate */ - WeekToDate = "WeekToDate", - /** MonthToDate */ - MonthToDate = "MonthToDate", - /** YearToDate */ - YearToDate = "YearToDate", - /** Custom */ - Custom = "Custom" -} - -/** - * Defines values for ReportTimeframeType. \ - * {@link KnownReportTimeframeType} can be used interchangeably with ReportTimeframeType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **WeekToDate** \ - * **MonthToDate** \ - * **YearToDate** \ - * **Custom** - */ -export type ReportTimeframeType = string; - -/** Known values of {@link ReportGranularityType} that the service accepts. */ -export enum KnownReportGranularityType { - /** Daily */ - Daily = "Daily", - /** Monthly */ - Monthly = "Monthly" -} - -/** - * Defines values for ReportGranularityType. \ - * {@link KnownReportGranularityType} can be used interchangeably with ReportGranularityType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Daily** \ - * **Monthly** - */ -export type ReportGranularityType = string; - -/** Known values of {@link FunctionType} that the service accepts. */ -export enum KnownFunctionType { - /** Sum */ - Sum = "Sum" -} - -/** - * Defines values for FunctionType. \ - * {@link KnownFunctionType} can be used interchangeably with FunctionType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Sum** - */ -export type FunctionType = string; - -/** Known values of {@link QueryColumnType} that the service accepts. */ -export enum KnownQueryColumnType { - /** The tag associated with the cost data. */ - TagKey = "TagKey", - /** The dimension of cost data. */ - Dimension = "Dimension" -} - -/** - * Defines values for QueryColumnType. \ - * {@link KnownQueryColumnType} can be used interchangeably with QueryColumnType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **TagKey**: The tag associated with the cost data. \ - * **Dimension**: The dimension of cost data. - */ -export type QueryColumnType = string; - -/** Known values of {@link ReportConfigSortingType} that the service accepts. */ -export enum KnownReportConfigSortingType { - /** Ascending */ - Ascending = "Ascending", - /** Descending */ - Descending = "Descending" -} - -/** - * Defines values for ReportConfigSortingType. \ - * {@link KnownReportConfigSortingType} can be used interchangeably with ReportConfigSortingType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Ascending** \ - * **Descending** - */ -export type ReportConfigSortingType = string; - -/** Known values of {@link OperatorType} that the service accepts. */ -export enum KnownOperatorType { - /** In */ - In = "In", - /** Contains */ - Contains = "Contains" -} - -/** - * Defines values for OperatorType. \ - * {@link KnownOperatorType} can be used interchangeably with OperatorType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **In** \ - * **Contains** - */ -export type OperatorType = string; - -/** Known values of {@link ChartType} that the service accepts. */ -export enum KnownChartType { - /** Area */ - Area = "Area", - /** Line */ - Line = "Line", - /** StackedColumn */ - StackedColumn = "StackedColumn", - /** GroupedColumn */ - GroupedColumn = "GroupedColumn", - /** Table */ - Table = "Table" -} - -/** - * Defines values for ChartType. \ - * {@link KnownChartType} can be used interchangeably with ChartType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Area** \ - * **Line** \ - * **StackedColumn** \ - * **GroupedColumn** \ - * **Table** - */ -export type ChartType = string; - -/** Known values of {@link AccumulatedType} that the service accepts. */ -export enum KnownAccumulatedType { - /** True */ - True = "true", - /** False */ - False = "false" -} - -/** - * Defines values for AccumulatedType. \ - * {@link KnownAccumulatedType} can be used interchangeably with AccumulatedType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **true** \ - * **false** - */ -export type AccumulatedType = string; - -/** Known values of {@link MetricType} that the service accepts. */ -export enum KnownMetricType { - /** ActualCost */ - ActualCost = "ActualCost", - /** AmortizedCost */ - AmortizedCost = "AmortizedCost", - /** Ahub */ - Ahub = "AHUB" -} - -/** - * Defines values for MetricType. \ - * {@link KnownMetricType} can be used interchangeably with MetricType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **ActualCost** \ - * **AmortizedCost** \ - * **AHUB** - */ -export type MetricType = string; - -/** Known values of {@link KpiType} that the service accepts. */ -export enum KnownKpiType { - /** Forecast */ - Forecast = "Forecast", - /** Budget */ - Budget = "Budget" -} - -/** - * Defines values for KpiType. \ - * {@link KnownKpiType} can be used interchangeably with KpiType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Forecast** \ - * **Budget** - */ -export type KpiType = string; - -/** Known values of {@link PivotType} that the service accepts. */ -export enum KnownPivotType { - /** Dimension */ - Dimension = "Dimension", - /** TagKey */ - TagKey = "TagKey" -} - -/** - * Defines values for PivotType. \ - * {@link KnownPivotType} can be used interchangeably with PivotType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Dimension** \ - * **TagKey** - */ -export type PivotType = string; - -/** Known values of {@link AlertType} that the service accepts. */ -export enum KnownAlertType { - /** Budget */ - Budget = "Budget", - /** Invoice */ - Invoice = "Invoice", - /** Credit */ - Credit = "Credit", - /** Quota */ - Quota = "Quota", - /** General */ - General = "General", - /** XCloud */ - XCloud = "xCloud", - /** BudgetForecast */ - BudgetForecast = "BudgetForecast" -} - -/** - * Defines values for AlertType. \ - * {@link KnownAlertType} can be used interchangeably with AlertType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Budget** \ - * **Invoice** \ - * **Credit** \ - * **Quota** \ - * **General** \ - * **xCloud** \ - * **BudgetForecast** - */ -export type AlertType = string; - -/** Known values of {@link AlertCategory} that the service accepts. */ -export enum KnownAlertCategory { - /** Cost */ - Cost = "Cost", - /** Usage */ - Usage = "Usage", - /** Billing */ - Billing = "Billing", - /** System */ - System = "System" -} - -/** - * Defines values for AlertCategory. \ - * {@link KnownAlertCategory} can be used interchangeably with AlertCategory, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Cost** \ - * **Usage** \ - * **Billing** \ - * **System** - */ -export type AlertCategory = string; - -/** Known values of {@link AlertCriteria} that the service accepts. */ -export enum KnownAlertCriteria { - /** CostThresholdExceeded */ - CostThresholdExceeded = "CostThresholdExceeded", - /** UsageThresholdExceeded */ - UsageThresholdExceeded = "UsageThresholdExceeded", - /** CreditThresholdApproaching */ - CreditThresholdApproaching = "CreditThresholdApproaching", - /** CreditThresholdReached */ - CreditThresholdReached = "CreditThresholdReached", - /** QuotaThresholdApproaching */ - QuotaThresholdApproaching = "QuotaThresholdApproaching", - /** QuotaThresholdReached */ - QuotaThresholdReached = "QuotaThresholdReached", - /** MultiCurrency */ - MultiCurrency = "MultiCurrency", - /** ForecastCostThresholdExceeded */ - ForecastCostThresholdExceeded = "ForecastCostThresholdExceeded", - /** ForecastUsageThresholdExceeded */ - ForecastUsageThresholdExceeded = "ForecastUsageThresholdExceeded", - /** InvoiceDueDateApproaching */ - InvoiceDueDateApproaching = "InvoiceDueDateApproaching", - /** InvoiceDueDateReached */ - InvoiceDueDateReached = "InvoiceDueDateReached", - /** CrossCloudNewDataAvailable */ - CrossCloudNewDataAvailable = "CrossCloudNewDataAvailable", - /** CrossCloudCollectionError */ - CrossCloudCollectionError = "CrossCloudCollectionError", - /** GeneralThresholdError */ - GeneralThresholdError = "GeneralThresholdError" -} - -/** - * Defines values for AlertCriteria. \ - * {@link KnownAlertCriteria} can be used interchangeably with AlertCriteria, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **CostThresholdExceeded** \ - * **UsageThresholdExceeded** \ - * **CreditThresholdApproaching** \ - * **CreditThresholdReached** \ - * **QuotaThresholdApproaching** \ - * **QuotaThresholdReached** \ - * **MultiCurrency** \ - * **ForecastCostThresholdExceeded** \ - * **ForecastUsageThresholdExceeded** \ - * **InvoiceDueDateApproaching** \ - * **InvoiceDueDateReached** \ - * **CrossCloudNewDataAvailable** \ - * **CrossCloudCollectionError** \ - * **GeneralThresholdError** - */ -export type AlertCriteria = string; - -/** Known values of {@link AlertSource} that the service accepts. */ -export enum KnownAlertSource { - /** Preset */ - Preset = "Preset", - /** User */ - User = "User" -} - -/** - * Defines values for AlertSource. \ - * {@link KnownAlertSource} can be used interchangeably with AlertSource, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Preset** \ - * **User** - */ -export type AlertSource = string; - -/** Known values of {@link AlertTimeGrainType} that the service accepts. */ -export enum KnownAlertTimeGrainType { - /** None */ - None = "None", - /** Monthly */ - Monthly = "Monthly", - /** Quarterly */ - Quarterly = "Quarterly", - /** Annually */ - Annually = "Annually", - /** BillingMonth */ - BillingMonth = "BillingMonth", - /** BillingQuarter */ - BillingQuarter = "BillingQuarter", - /** BillingAnnual */ - BillingAnnual = "BillingAnnual" -} - -/** - * Defines values for AlertTimeGrainType. \ - * {@link KnownAlertTimeGrainType} can be used interchangeably with AlertTimeGrainType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **None** \ - * **Monthly** \ - * **Quarterly** \ - * **Annually** \ - * **BillingMonth** \ - * **BillingQuarter** \ - * **BillingAnnual** - */ -export type AlertTimeGrainType = string; - -/** Known values of {@link AlertOperator} that the service accepts. */ -export enum KnownAlertOperator { - /** None */ - None = "None", - /** EqualTo */ - EqualTo = "EqualTo", - /** GreaterThan */ - GreaterThan = "GreaterThan", - /** GreaterThanOrEqualTo */ - GreaterThanOrEqualTo = "GreaterThanOrEqualTo", - /** LessThan */ - LessThan = "LessThan", - /** LessThanOrEqualTo */ - LessThanOrEqualTo = "LessThanOrEqualTo" -} - -/** - * Defines values for AlertOperator. \ - * {@link KnownAlertOperator} can be used interchangeably with AlertOperator, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **None** \ - * **EqualTo** \ - * **GreaterThan** \ - * **GreaterThanOrEqualTo** \ - * **LessThan** \ - * **LessThanOrEqualTo** - */ -export type AlertOperator = string; - -/** Known values of {@link AlertStatus} that the service accepts. */ -export enum KnownAlertStatus { - /** None */ - None = "None", - /** Active */ - Active = "Active", - /** Overridden */ - Overridden = "Overridden", - /** Resolved */ - Resolved = "Resolved", - /** Dismissed */ - Dismissed = "Dismissed" -} - -/** - * Defines values for AlertStatus. \ - * {@link KnownAlertStatus} can be used interchangeably with AlertStatus, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **None** \ - * **Active** \ - * **Overridden** \ - * **Resolved** \ - * **Dismissed** - */ -export type AlertStatus = string; - -/** Known values of {@link ExternalCloudProviderType} that the service accepts. */ -export enum KnownExternalCloudProviderType { - /** ExternalSubscriptions */ - ExternalSubscriptions = "externalSubscriptions", - /** ExternalBillingAccounts */ - ExternalBillingAccounts = "externalBillingAccounts" -} - -/** - * Defines values for ExternalCloudProviderType. \ - * {@link KnownExternalCloudProviderType} can be used interchangeably with ExternalCloudProviderType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **externalSubscriptions** \ - * **externalBillingAccounts** - */ -export type ExternalCloudProviderType = string; - -/** Known values of {@link ForecastType} that the service accepts. */ -export enum KnownForecastType { - /** Usage */ - Usage = "Usage", - /** ActualCost */ - ActualCost = "ActualCost", - /** AmortizedCost */ - AmortizedCost = "AmortizedCost" -} - -/** - * Defines values for ForecastType. \ - * {@link KnownForecastType} can be used interchangeably with ForecastType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Usage** \ - * **ActualCost** \ - * **AmortizedCost** - */ -export type ForecastType = string; - -/** Known values of {@link ForecastTimeframe} that the service accepts. */ -export enum KnownForecastTimeframe { - /** Custom */ - Custom = "Custom" -} - -/** - * Defines values for ForecastTimeframe. \ - * {@link KnownForecastTimeframe} can be used interchangeably with ForecastTimeframe, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Custom** - */ -export type ForecastTimeframe = string; - -/** Known values of {@link GranularityType} that the service accepts. */ -export enum KnownGranularityType { - /** Daily */ - Daily = "Daily" -} - -/** - * Defines values for GranularityType. \ - * {@link KnownGranularityType} can be used interchangeably with GranularityType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Daily** - */ -export type GranularityType = string; - -/** Known values of {@link FunctionName} that the service accepts. */ -export enum KnownFunctionName { - /** PreTaxCostUSD */ - PreTaxCostUSD = "PreTaxCostUSD", - /** Cost */ - Cost = "Cost", - /** CostUSD */ - CostUSD = "CostUSD", - /** PreTaxCost */ - PreTaxCost = "PreTaxCost" -} - -/** - * Defines values for FunctionName. \ - * {@link KnownFunctionName} can be used interchangeably with FunctionName, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **PreTaxCostUSD** \ - * **Cost** \ - * **CostUSD** \ - * **PreTaxCost** - */ -export type FunctionName = string; - -/** Known values of {@link ForecastOperatorType} that the service accepts. */ -export enum KnownForecastOperatorType { - /** In */ - In = "In" -} - -/** - * Defines values for ForecastOperatorType. \ - * {@link KnownForecastOperatorType} can be used interchangeably with ForecastOperatorType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **In** - */ -export type ForecastOperatorType = string; - -/** Known values of {@link ExportType} that the service accepts. */ -export enum KnownExportType { - /** Usage */ - Usage = "Usage", - /** ActualCost */ - ActualCost = "ActualCost", - /** AmortizedCost */ - AmortizedCost = "AmortizedCost" -} - -/** - * Defines values for ExportType. \ - * {@link KnownExportType} can be used interchangeably with ExportType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Usage** \ - * **ActualCost** \ - * **AmortizedCost** - */ -export type ExportType = string; - -/** Known values of {@link TimeframeType} that the service accepts. */ -export enum KnownTimeframeType { - /** MonthToDate */ - MonthToDate = "MonthToDate", - /** BillingMonthToDate */ - BillingMonthToDate = "BillingMonthToDate", - /** TheLastMonth */ - TheLastMonth = "TheLastMonth", - /** TheLastBillingMonth */ - TheLastBillingMonth = "TheLastBillingMonth", - /** WeekToDate */ - WeekToDate = "WeekToDate", - /** Custom */ - Custom = "Custom" -} - -/** - * Defines values for TimeframeType. \ - * {@link KnownTimeframeType} can be used interchangeably with TimeframeType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **MonthToDate** \ - * **BillingMonthToDate** \ - * **TheLastMonth** \ - * **TheLastBillingMonth** \ - * **WeekToDate** \ - * **Custom** - */ -export type TimeframeType = string; - -/** Known values of {@link QueryOperatorType} that the service accepts. */ -export enum KnownQueryOperatorType { - /** In */ - In = "In" -} - -/** - * Defines values for QueryOperatorType. \ - * {@link KnownQueryOperatorType} can be used interchangeably with QueryOperatorType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **In** - */ -export type QueryOperatorType = string; - -/** Known values of {@link OperationStatusType} that the service accepts. */ -export enum KnownOperationStatusType { - /** Running */ - Running = "Running", - /** Completed */ - Completed = "Completed", - /** Failed */ - Failed = "Failed" -} - -/** - * Defines values for OperationStatusType. \ - * {@link KnownOperationStatusType} can be used interchangeably with OperationStatusType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Running** \ - * **Completed** \ - * **Failed** - */ -export type OperationStatusType = string; - -/** Known values of {@link ReservationReportSchema} that the service accepts. */ -export enum KnownReservationReportSchema { - /** InstanceFlexibilityGroup */ - InstanceFlexibilityGroup = "InstanceFlexibilityGroup", - /** InstanceFlexibilityRatio */ - InstanceFlexibilityRatio = "InstanceFlexibilityRatio", - /** InstanceId */ - InstanceId = "InstanceId", - /** Kind */ - Kind = "Kind", - /** ReservationId */ - ReservationId = "ReservationId", - /** ReservationOrderId */ - ReservationOrderId = "ReservationOrderId", - /** ReservedHours */ - ReservedHours = "ReservedHours", - /** SkuName */ - SkuName = "SkuName", - /** TotalReservedQuantity */ - TotalReservedQuantity = "TotalReservedQuantity", - /** UsageDate */ - UsageDate = "UsageDate", - /** UsedHours */ - UsedHours = "UsedHours" -} - -/** - * Defines values for ReservationReportSchema. \ - * {@link KnownReservationReportSchema} can be used interchangeably with ReservationReportSchema, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **InstanceFlexibilityGroup** \ - * **InstanceFlexibilityRatio** \ - * **InstanceId** \ - * **Kind** \ - * **ReservationId** \ - * **ReservationOrderId** \ - * **ReservedHours** \ - * **SkuName** \ - * **TotalReservedQuantity** \ - * **UsageDate** \ - * **UsedHours** - */ -export type ReservationReportSchema = string; - -/** Known values of {@link StatusType} that the service accepts. */ -export enum KnownStatusType { - /** Active */ - Active = "Active", - /** Inactive */ - Inactive = "Inactive" -} - -/** - * Defines values for StatusType. \ - * {@link KnownStatusType} can be used interchangeably with StatusType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Active** \ - * **Inactive** - */ -export type StatusType = string; - -/** Known values of {@link RecurrenceType} that the service accepts. */ -export enum KnownRecurrenceType { - /** Daily */ - Daily = "Daily", - /** Weekly */ - Weekly = "Weekly", - /** Monthly */ - Monthly = "Monthly", - /** Annually */ - Annually = "Annually" -} - -/** - * Defines values for RecurrenceType. \ - * {@link KnownRecurrenceType} can be used interchangeably with RecurrenceType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Daily** \ - * **Weekly** \ - * **Monthly** \ - * **Annually** - */ -export type RecurrenceType = string; - -/** Known values of {@link FormatType} that the service accepts. */ -export enum KnownFormatType { - /** Csv */ - Csv = "Csv" -} - -/** - * Defines values for FormatType. \ - * {@link KnownFormatType} can be used interchangeably with FormatType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Csv** - */ -export type FormatType = string; - -/** Known values of {@link ExecutionType} that the service accepts. */ -export enum KnownExecutionType { - /** OnDemand */ - OnDemand = "OnDemand", - /** Scheduled */ - Scheduled = "Scheduled" -} - -/** - * Defines values for ExecutionType. \ - * {@link KnownExecutionType} can be used interchangeably with ExecutionType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **OnDemand** \ - * **Scheduled** - */ -export type ExecutionType = string; - -/** Known values of {@link ExecutionStatus} that the service accepts. */ -export enum KnownExecutionStatus { - /** Queued */ - Queued = "Queued", - /** InProgress */ - InProgress = "InProgress", - /** Completed */ - Completed = "Completed", - /** Failed */ - Failed = "Failed", - /** Timeout */ - Timeout = "Timeout", - /** NewDataNotAvailable */ - NewDataNotAvailable = "NewDataNotAvailable", - /** DataNotAvailable */ - DataNotAvailable = "DataNotAvailable" -} - -/** - * Defines values for ExecutionStatus. \ - * {@link KnownExecutionStatus} can be used interchangeably with ExecutionStatus, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Queued** \ - * **InProgress** \ - * **Completed** \ - * **Failed** \ - * **Timeout** \ - * **NewDataNotAvailable** \ - * **DataNotAvailable** - */ -export type ExecutionStatus = string; - -/** Known values of {@link CostDetailsMetricType} that the service accepts. */ -export enum KnownCostDetailsMetricType { - /** Actual cost data. */ - ActualCostCostDetailsMetricType = "ActualCost", - /** Amortized cost data. */ - AmortizedCostCostDetailsMetricType = "AmortizedCost" -} - -/** - * Defines values for CostDetailsMetricType. \ - * {@link KnownCostDetailsMetricType} can be used interchangeably with CostDetailsMetricType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **ActualCost**: Actual cost data. \ - * **AmortizedCost**: Amortized cost data. - */ -export type CostDetailsMetricType = string; - -/** Known values of {@link CostDetailsStatusType} that the service accepts. */ -export enum KnownCostDetailsStatusType { - /** Operation is Completed. */ - CompletedCostDetailsStatusType = "Completed", - /** Operation is Completed and no cost data found. */ - NoDataFoundCostDetailsStatusType = "NoDataFound", - /** Operation Failed. */ - FailedCostDetailsStatusType = "Failed" -} - -/** - * Defines values for CostDetailsStatusType. \ - * {@link KnownCostDetailsStatusType} can be used interchangeably with CostDetailsStatusType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Completed**: Operation is Completed. \ - * **NoDataFound**: Operation is Completed and no cost data found. \ - * **Failed**: Operation Failed. - */ -export type CostDetailsStatusType = string; - -/** Known values of {@link CostDetailsDataFormat} that the service accepts. */ -export enum KnownCostDetailsDataFormat { - /** Csv data format. */ - CsvCostDetailsDataFormat = "Csv" -} - -/** - * Defines values for CostDetailsDataFormat. \ - * {@link KnownCostDetailsDataFormat} can be used interchangeably with CostDetailsDataFormat, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Csv**: Csv data format. - */ -export type CostDetailsDataFormat = string; - -/** Known values of {@link GenerateDetailedCostReportMetricType} that the service accepts. */ -export enum KnownGenerateDetailedCostReportMetricType { - /** ActualCost */ - ActualCost = "ActualCost", - /** AmortizedCost */ - AmortizedCost = "AmortizedCost" -} - -/** - * Defines values for GenerateDetailedCostReportMetricType. \ - * {@link KnownGenerateDetailedCostReportMetricType} can be used interchangeably with GenerateDetailedCostReportMetricType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **ActualCost** \ - * **AmortizedCost** - */ -export type GenerateDetailedCostReportMetricType = string; - -/** Known values of {@link ReportOperationStatusType} that the service accepts. */ -export enum KnownReportOperationStatusType { - /** InProgress */ - InProgress = "InProgress", - /** Completed */ - Completed = "Completed", - /** Failed */ - Failed = "Failed", - /** Queued */ - Queued = "Queued", - /** NoDataFound */ - NoDataFound = "NoDataFound", - /** ReadyToDownload */ - ReadyToDownload = "ReadyToDownload", - /** TimedOut */ - TimedOut = "TimedOut" -} - -/** - * Defines values for ReportOperationStatusType. \ - * {@link KnownReportOperationStatusType} can be used interchangeably with ReportOperationStatusType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **InProgress** \ - * **Completed** \ - * **Failed** \ - * **Queued** \ - * **NoDataFound** \ - * **ReadyToDownload** \ - * **TimedOut** - */ -export type ReportOperationStatusType = string; - -/** Known values of {@link FileFormat} that the service accepts. */ -export enum KnownFileFormat { - /** Csv */ - Csv = "Csv" -} - -/** - * Defines values for FileFormat. \ - * {@link KnownFileFormat} can be used interchangeably with FileFormat, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Csv** - */ -export type FileFormat = string; - -/** Known values of {@link ScheduleFrequency} that the service accepts. */ -export enum KnownScheduleFrequency { - /** Cost analysis data will be emailed every day. */ - Daily = "Daily", - /** Cost analysis data will be emailed every week. */ - Weekly = "Weekly", - /** Cost analysis data will be emailed every month. */ - Monthly = "Monthly" -} - -/** - * Defines values for ScheduleFrequency. \ - * {@link KnownScheduleFrequency} can be used interchangeably with ScheduleFrequency, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Daily**: Cost analysis data will be emailed every day. \ - * **Weekly**: Cost analysis data will be emailed every week. \ - * **Monthly**: Cost analysis data will be emailed every month. - */ -export type ScheduleFrequency = string; - -/** Known values of {@link DaysOfWeek} that the service accepts. */ -export enum KnownDaysOfWeek { - /** Monday */ - Monday = "Monday", - /** Tuesday */ - Tuesday = "Tuesday", - /** Wednesday */ - Wednesday = "Wednesday", - /** Thursday */ - Thursday = "Thursday", - /** Friday */ - Friday = "Friday", - /** Saturday */ - Saturday = "Saturday", - /** Sunday */ - Sunday = "Sunday" -} - -/** - * Defines values for DaysOfWeek. \ - * {@link KnownDaysOfWeek} can be used interchangeably with DaysOfWeek, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Monday** \ - * **Tuesday** \ - * **Wednesday** \ - * **Thursday** \ - * **Friday** \ - * **Saturday** \ - * **Sunday** - */ -export type DaysOfWeek = string; - -/** Known values of {@link WeeksOfMonth} that the service accepts. */ -export enum KnownWeeksOfMonth { - /** First */ - First = "First", - /** Second */ - Second = "Second", - /** Third */ - Third = "Third", - /** Fourth */ - Fourth = "Fourth", - /** Last */ - Last = "Last" -} - -/** - * Defines values for WeeksOfMonth. \ - * {@link KnownWeeksOfMonth} can be used interchangeably with WeeksOfMonth, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **First** \ - * **Second** \ - * **Third** \ - * **Fourth** \ - * **Last** - */ -export type WeeksOfMonth = string; - -/** Known values of {@link ScheduledActionStatus} that the service accepts. */ -export enum KnownScheduledActionStatus { - /** Scheduled action is saved but will not be run. */ - Disabled = "Disabled", - /** Scheduled action is saved and will be run. */ - Enabled = "Enabled", - /** Scheduled action is expired. */ - Expired = "Expired" -} - -/** - * Defines values for ScheduledActionStatus. \ - * {@link KnownScheduledActionStatus} can be used interchangeably with ScheduledActionStatus, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Disabled**: Scheduled action is saved but will not be run. \ - * **Enabled**: Scheduled action is saved and will be run. \ - * **Expired**: Scheduled action is expired. - */ -export type ScheduledActionStatus = string; - -/** Known values of {@link ScheduledActionKind} that the service accepts. */ -export enum KnownScheduledActionKind { - /** Cost analysis data will be emailed. */ - Email = "Email", - /** 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. */ - InsightAlert = "InsightAlert" -} - -/** - * Defines values for ScheduledActionKind. \ - * {@link KnownScheduledActionKind} can be used interchangeably with ScheduledActionKind, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Email**: Cost analysis data will be emailed. \ - * **InsightAlert**: 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. - */ -export type ScheduledActionKind = string; - -/** Known values of {@link CreatedByType} that the service accepts. */ -export enum KnownCreatedByType { - /** User */ - User = "User", - /** Application */ - Application = "Application", - /** ManagedIdentity */ - ManagedIdentity = "ManagedIdentity", - /** Key */ - Key = "Key" -} - -/** - * Defines values for CreatedByType. \ - * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **User** \ - * **Application** \ - * **ManagedIdentity** \ - * **Key** - */ -export type CreatedByType = string; - -/** Known values of {@link CheckNameAvailabilityReason} that the service accepts. */ -export enum KnownCheckNameAvailabilityReason { - /** Invalid */ - Invalid = "Invalid", - /** AlreadyExists */ - AlreadyExists = "AlreadyExists" -} - -/** - * Defines values for CheckNameAvailabilityReason. \ - * {@link KnownCheckNameAvailabilityReason} can be used interchangeably with CheckNameAvailabilityReason, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Invalid** \ - * **AlreadyExists** - */ -export type CheckNameAvailabilityReason = string; - -/** Known values of {@link LookBackPeriod} that the service accepts. */ -export enum KnownLookBackPeriod { - /** 7 days used to look back. */ - Last7Days = "Last7Days", - /** 30 days used to look back. */ - Last30Days = "Last30Days", - /** 60 days used to look back. */ - Last60Days = "Last60Days" -} - -/** - * Defines values for LookBackPeriod. \ - * {@link KnownLookBackPeriod} can be used interchangeably with LookBackPeriod, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Last7Days**: 7 days used to look back. \ - * **Last30Days**: 30 days used to look back. \ - * **Last60Days**: 60 days used to look back. - */ -export type LookBackPeriod = string; - -/** Known values of {@link Grain} that the service accepts. */ -export enum KnownGrain { - /** Hourly grain corresponds to value per hour. */ - Hourly = "Hourly", - /** Hourly grain corresponds to value per day. */ - Daily = "Daily", - /** Hourly grain corresponds to value per month. */ - Monthly = "Monthly" -} - -/** - * Defines values for Grain. \ - * {@link KnownGrain} can be used interchangeably with Grain, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Hourly**: Hourly grain corresponds to value per hour. \ - * **Daily**: Hourly grain corresponds to value per day. \ - * **Monthly**: Hourly grain corresponds to value per month. - */ -export type Grain = string; - -/** Known values of {@link Term} that the service accepts. */ -export enum KnownTerm { - /** Benefit term is 1 year. */ - P1Y = "P1Y", - /** Benefit term is 3 years. */ - P3Y = "P3Y" -} - -/** - * Defines values for Term. \ - * {@link KnownTerm} can be used interchangeably with Term, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **P1Y**: Benefit term is 1 year. \ - * **P3Y**: Benefit term is 3 years. - */ -export type Term = string; - -/** Known values of {@link Scope} that the service accepts. */ -export enum KnownScope { - /** Single scope recommendation. */ - Single = "Single", - /** Shared scope recommendation. */ - Shared = "Shared" -} - -/** - * Defines values for Scope. \ - * {@link KnownScope} can be used interchangeably with Scope, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Single**: Single scope recommendation. \ - * **Shared**: Shared scope recommendation. - */ -export type Scope = string; - -/** Known values of {@link BenefitKind} that the service accepts. */ -export enum KnownBenefitKind { - /** Benefit is IncludedQuantity. */ - IncludedQuantity = "IncludedQuantity", - /** Benefit is Reservation. */ - Reservation = "Reservation", - /** Benefit is SavingsPlan. */ - SavingsPlan = "SavingsPlan" -} - -/** - * Defines values for BenefitKind. \ - * {@link KnownBenefitKind} can be used interchangeably with BenefitKind, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **IncludedQuantity**: Benefit is IncludedQuantity. \ - * **Reservation**: Benefit is Reservation. \ - * **SavingsPlan**: Benefit is SavingsPlan. - */ -export type BenefitKind = string; - -/** Known values of {@link GrainParameter} that the service accepts. */ -export enum KnownGrainParameter { - /** Hourly grain corresponds to value per hour. */ - Hourly = "Hourly", - /** Hourly grain corresponds to value per day. */ - Daily = "Daily", - /** Hourly grain corresponds to value per month. */ - Monthly = "Monthly" -} - -/** - * Defines values for GrainParameter. \ - * {@link KnownGrainParameter} can be used interchangeably with GrainParameter, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Hourly**: Hourly grain corresponds to value per hour. \ - * **Daily**: Hourly grain corresponds to value per day. \ - * **Monthly**: Hourly grain corresponds to value per month. - */ -export type GrainParameter = string; - -/** Optional parameters. */ -export interface OperationsListOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type OperationsListResponse = OperationListResult; - -/** Optional parameters. */ -export interface OperationsListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type OperationsListNextResponse = OperationListResult; - -/** Optional parameters. */ -export interface ViewsListOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type ViewsListResponse = ViewListResult; - -/** Optional parameters. */ -export interface ViewsListByScopeOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByScope operation. */ -export type ViewsListByScopeResponse = ViewListResult; - -/** Optional parameters. */ -export interface ViewsGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type ViewsGetResponse = View; - -/** Optional parameters. */ -export interface ViewsCreateOrUpdateOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the createOrUpdate operation. */ -export type ViewsCreateOrUpdateResponse = View; - -/** Optional parameters. */ -export interface ViewsDeleteOptionalParams - extends coreClient.OperationOptions {} - -/** Optional parameters. */ -export interface ViewsGetByScopeOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the getByScope operation. */ -export type ViewsGetByScopeResponse = View; - -/** Optional parameters. */ -export interface ViewsCreateOrUpdateByScopeOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the createOrUpdateByScope operation. */ -export type ViewsCreateOrUpdateByScopeResponse = View; - -/** Optional parameters. */ -export interface ViewsDeleteByScopeOptionalParams - extends coreClient.OperationOptions {} - -/** Optional parameters. */ -export interface ViewsListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type ViewsListNextResponse = ViewListResult; - -/** Optional parameters. */ -export interface ViewsListByScopeNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByScopeNext operation. */ -export type ViewsListByScopeNextResponse = ViewListResult; - -/** Optional parameters. */ -export interface AlertsListOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type AlertsListResponse = AlertsResult; - -/** Optional parameters. */ -export interface AlertsGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type AlertsGetResponse = Alert; - -/** Optional parameters. */ -export interface AlertsDismissOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the dismiss operation. */ -export type AlertsDismissResponse = Alert; - -/** Optional parameters. */ -export interface AlertsListExternalOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listExternal operation. */ -export type AlertsListExternalResponse = AlertsResult; - -/** Optional parameters. */ -export interface ForecastUsageOptionalParams - extends coreClient.OperationOptions { - /** 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; -} - -/** Contains response data for the usage operation. */ -export type ForecastUsageResponse = ForecastResult; - -/** Optional parameters. */ -export interface ForecastExternalCloudProviderUsageOptionalParams - extends coreClient.OperationOptions { - /** 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; -} - -/** Contains response data for the externalCloudProviderUsage operation. */ -export type ForecastExternalCloudProviderUsageResponse = ForecastResult; - -/** Optional parameters. */ -export interface DimensionsListOptionalParams - extends coreClient.OperationOptions { - /** May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'. */ - filter?: string; - /** May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions. */ - expand?: string; - /** Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. */ - skiptoken?: string; - /** May be used to limit the number of results to the most recent N dimension data. */ - top?: number; -} - -/** Contains response data for the list operation. */ -export type DimensionsListResponse = DimensionsListResult; - -/** Optional parameters. */ -export interface DimensionsByExternalCloudProviderTypeOptionalParams - extends coreClient.OperationOptions { - /** May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'. */ - filter?: string; - /** May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions. */ - expand?: string; - /** Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. */ - skiptoken?: string; - /** May be used to limit the number of results to the most recent N dimension data. */ - top?: number; -} - -/** Contains response data for the byExternalCloudProviderType operation. */ -export type DimensionsByExternalCloudProviderTypeResponse = DimensionsListResult; - -/** Optional parameters. */ -export interface QueryUsageOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the usage operation. */ -export type QueryUsageResponse = QueryResult; - -/** Optional parameters. */ -export interface QueryUsageByExternalCloudProviderTypeOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the usageByExternalCloudProviderType operation. */ -export type QueryUsageByExternalCloudProviderTypeResponse = QueryResult; - -/** Optional parameters. */ -export interface GenerateReservationDetailsReportByBillingAccountIdOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the byBillingAccountId operation. */ -export type GenerateReservationDetailsReportByBillingAccountIdResponse = OperationStatus; - -/** Optional parameters. */ -export interface GenerateReservationDetailsReportByBillingProfileIdOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the byBillingProfileId operation. */ -export type GenerateReservationDetailsReportByBillingProfileIdResponse = OperationStatus; - -/** Optional parameters. */ -export interface ExportsListOptionalParams extends coreClient.OperationOptions { - /** May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last run of each export. */ - expand?: string; -} - -/** Contains response data for the list operation. */ -export type ExportsListResponse = ExportListResult; - -/** Optional parameters. */ -export interface ExportsGetOptionalParams extends coreClient.OperationOptions { - /** May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last 10 runs of the export. */ - expand?: string; -} - -/** Contains response data for the get operation. */ -export type ExportsGetResponse = Export; - -/** Optional parameters. */ -export interface ExportsCreateOrUpdateOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the createOrUpdate operation. */ -export type ExportsCreateOrUpdateResponse = Export; - -/** Optional parameters. */ -export interface ExportsDeleteOptionalParams - extends coreClient.OperationOptions {} - -/** Optional parameters. */ -export interface ExportsExecuteOptionalParams - extends coreClient.OperationOptions {} - -/** Optional parameters. */ -export interface ExportsGetExecutionHistoryOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the getExecutionHistory operation. */ -export type ExportsGetExecutionHistoryResponse = ExportExecutionListResult; - -/** Optional parameters. */ -export interface GenerateCostDetailsReportCreateOperationOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the createOperation operation. */ -export type GenerateCostDetailsReportCreateOperationResponse = CostDetailsOperationResults; - -/** Optional parameters. */ -export interface GenerateCostDetailsReportGetOperationResultsOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the getOperationResults operation. */ -export type GenerateCostDetailsReportGetOperationResultsResponse = CostDetailsOperationResults; - -/** Optional parameters. */ -export interface GenerateDetailedCostReportCreateOperationOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the createOperation operation. */ -export type GenerateDetailedCostReportCreateOperationResponse = GenerateDetailedCostReportOperationResult; - -/** Optional parameters. */ -export interface GenerateDetailedCostReportOperationResultsGetOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the get operation. */ -export type GenerateDetailedCostReportOperationResultsGetResponse = GenerateDetailedCostReportOperationResult; - -/** Optional parameters. */ -export interface GenerateDetailedCostReportOperationStatusGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type GenerateDetailedCostReportOperationStatusGetResponse = GenerateDetailedCostReportOperationStatuses; - -/** Optional parameters. */ -export interface PriceSheetDownloadOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the download operation. */ -export type PriceSheetDownloadResponse = DownloadURL; - -/** Optional parameters. */ -export interface PriceSheetDownloadByBillingProfileOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the downloadByBillingProfile operation. */ -export type PriceSheetDownloadByBillingProfileResponse = DownloadURL; - -/** Optional parameters. */ -export interface ScheduledActionsListOptionalParams - extends coreClient.OperationOptions { - /** May be used to filter scheduled actions by properties/viewId. Supported operator is 'eq'. */ - filter?: string; -} - -/** Contains response data for the list operation. */ -export type ScheduledActionsListResponse = ScheduledActionListResult; - -/** Optional parameters. */ -export interface ScheduledActionsListByScopeOptionalParams - extends coreClient.OperationOptions { - /** May be used to filter scheduled actions by properties/viewId. Supported operator is 'eq'. */ - filter?: string; -} - -/** Contains response data for the listByScope operation. */ -export type ScheduledActionsListByScopeResponse = ScheduledActionListResult; - -/** Optional parameters. */ -export interface ScheduledActionsCreateOrUpdateOptionalParams - extends coreClient.OperationOptions { - /** ETag of the Entity. Not required when creating an entity. Optional when updating an entity and can be specified to achieve optimistic concurrency. */ - ifMatch?: string; -} - -/** Contains response data for the createOrUpdate operation. */ -export type ScheduledActionsCreateOrUpdateResponse = ScheduledAction; - -/** Optional parameters. */ -export interface ScheduledActionsGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type ScheduledActionsGetResponse = ScheduledAction; - -/** Optional parameters. */ -export interface ScheduledActionsDeleteOptionalParams - extends coreClient.OperationOptions {} - -/** Optional parameters. */ -export interface ScheduledActionsCreateOrUpdateByScopeOptionalParams - extends coreClient.OperationOptions { - /** ETag of the Entity. Not required when creating an entity. Optional when updating an entity and can be specified to achieve optimistic concurrency. */ - ifMatch?: string; -} - -/** Contains response data for the createOrUpdateByScope operation. */ -export type ScheduledActionsCreateOrUpdateByScopeResponse = ScheduledAction; - -/** Optional parameters. */ -export interface ScheduledActionsGetByScopeOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the getByScope operation. */ -export type ScheduledActionsGetByScopeResponse = ScheduledAction; - -/** Optional parameters. */ -export interface ScheduledActionsDeleteByScopeOptionalParams - extends coreClient.OperationOptions {} - -/** Optional parameters. */ -export interface ScheduledActionsRunOptionalParams - extends coreClient.OperationOptions {} - -/** Optional parameters. */ -export interface ScheduledActionsRunByScopeOptionalParams - extends coreClient.OperationOptions {} - -/** Optional parameters. */ -export interface ScheduledActionsCheckNameAvailabilityOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the checkNameAvailability operation. */ -export type ScheduledActionsCheckNameAvailabilityResponse = CheckNameAvailabilityResponse; - -/** Optional parameters. */ -export interface ScheduledActionsCheckNameAvailabilityByScopeOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the checkNameAvailabilityByScope operation. */ -export type ScheduledActionsCheckNameAvailabilityByScopeResponse = CheckNameAvailabilityResponse; - -/** Optional parameters. */ -export interface ScheduledActionsListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type ScheduledActionsListNextResponse = ScheduledActionListResult; - -/** Optional parameters. */ -export interface ScheduledActionsListByScopeNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByScopeNext operation. */ -export type ScheduledActionsListByScopeNextResponse = ScheduledActionListResult; - -/** Optional parameters. */ -export interface BenefitRecommendationsListOptionalParams - extends coreClient.OperationOptions { - /** Can be used to filter benefitRecommendations by: properties/scope with allowed values ['Single', 'Shared'] and default value 'Shared'; and properties/lookBackPeriod with allowed values ['Last7Days', 'Last30Days', 'Last60Days'] and default value 'Last60Days'; properties/term with allowed values ['P1Y', 'P3Y'] and default value 'P3Y'; properties/subscriptionId; properties/resourceGroup */ - filter?: string; - /** May be used to expand the properties by: properties/usage, properties/allRecommendationDetails */ - expand?: string; - /** May be used to order the recommendations by: properties/armSkuName. For the savings plan, the results are in order by default. There is no need to use this clause. */ - orderby?: string; -} - -/** Contains response data for the list operation. */ -export type BenefitRecommendationsListResponse = BenefitRecommendationsListResult; - -/** Optional parameters. */ -export interface BenefitRecommendationsListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type BenefitRecommendationsListNextResponse = BenefitRecommendationsListResult; - -/** Optional parameters. */ -export interface BenefitUtilizationSummariesListByBillingAccountIdOptionalParams - extends coreClient.OperationOptions { - /** Grain. */ - grainParameter?: GrainParameter; - /** Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. */ - filter?: string; -} - -/** Contains response data for the listByBillingAccountId operation. */ -export type BenefitUtilizationSummariesListByBillingAccountIdResponse = BenefitUtilizationSummariesListResult; - -/** Optional parameters. */ -export interface BenefitUtilizationSummariesListByBillingProfileIdOptionalParams - extends coreClient.OperationOptions { - /** Grain. */ - grainParameter?: GrainParameter; - /** Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. */ - filter?: string; -} - -/** Contains response data for the listByBillingProfileId operation. */ -export type BenefitUtilizationSummariesListByBillingProfileIdResponse = BenefitUtilizationSummariesListResult; - -/** Optional parameters. */ -export interface BenefitUtilizationSummariesListBySavingsPlanOrderOptionalParams - extends coreClient.OperationOptions { - /** Supports filtering by properties/usageDate. */ - filter?: string; - /** Grain. */ - grainParameter?: GrainParameter; -} - -/** Contains response data for the listBySavingsPlanOrder operation. */ -export type BenefitUtilizationSummariesListBySavingsPlanOrderResponse = BenefitUtilizationSummariesListResult; - -/** Optional parameters. */ -export interface BenefitUtilizationSummariesListBySavingsPlanIdOptionalParams - extends coreClient.OperationOptions { - /** Supports filtering by properties/usageDate. */ - filter?: string; - /** Grain. */ - grainParameter?: GrainParameter; -} - -/** Contains response data for the listBySavingsPlanId operation. */ -export type BenefitUtilizationSummariesListBySavingsPlanIdResponse = BenefitUtilizationSummariesListResult; - -/** Optional parameters. */ -export interface BenefitUtilizationSummariesListByBillingAccountIdNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByBillingAccountIdNext operation. */ -export type BenefitUtilizationSummariesListByBillingAccountIdNextResponse = BenefitUtilizationSummariesListResult; - -/** Optional parameters. */ -export interface BenefitUtilizationSummariesListByBillingProfileIdNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByBillingProfileIdNext operation. */ -export type BenefitUtilizationSummariesListByBillingProfileIdNextResponse = BenefitUtilizationSummariesListResult; - -/** Optional parameters. */ -export interface BenefitUtilizationSummariesListBySavingsPlanOrderNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listBySavingsPlanOrderNext operation. */ -export type BenefitUtilizationSummariesListBySavingsPlanOrderNextResponse = BenefitUtilizationSummariesListResult; - -/** Optional parameters. */ -export interface BenefitUtilizationSummariesListBySavingsPlanIdNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listBySavingsPlanIdNext operation. */ -export type BenefitUtilizationSummariesListBySavingsPlanIdNextResponse = BenefitUtilizationSummariesListResult; - -/** Optional parameters. */ -export interface CostManagementClientOptionalParams - extends coreClient.ServiceClientOptions { - /** server parameter */ - $host?: string; - /** Api Version */ - apiVersion?: string; - /** Overrides client endpoint. */ - endpoint?: string; -} +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export type { + GenerateDetailedCostReportOperationStatuses, + DownloadURL, + Status, + ReportOperationStatusType, + ErrorDetails, + ExtensionResource, + Resource, + SystemData, + CreatedByType, + ErrorResponse, + CostManagementOperation, + Operation, + OperationDisplay, + Origin, + ActionType, + Budget, + BudgetProperties, + CategoryType, + TimeGrainType, + BudgetTimePeriod, + BudgetFilter, + BudgetFilterProperties, + BudgetComparisonExpression, + BudgetOperatorType, + CurrentSpend, + Notification, + BudgetNotificationOperatorType, + Frequency, + ThresholdType, + CultureCode, + ForecastSpend, + Export, + ExportProperties, + ExportSchedule, + StatusType, + RecurrenceType, + ExportRecurrencePeriod, + SystemAssignedServiceIdentity, + SystemAssignedServiceIdentityType, + CommonExportProperties, + FormatType, + ExportDeliveryInfo, + ExportDeliveryDestination, + DestinationType, + ExportDefinition, + ExportType, + TimeframeType, + ExportTimePeriod, + ExportDataset, + GranularityType, + ExportDatasetConfiguration, + FilterItems, + FilterItemNames, + ExportExecutionListResult, + ExportRun, + ExportRunProperties, + ExecutionType, + ExecutionStatus, + DataOverwriteBehaviorType, + CompressionModeType, + ExportSuspensionContext, + CostManagementProxyResource, + ExportListResult, + ExportRunRequest, + GenerateDetailedCostReportOperationResult, + View, + ViewProperties, + ReportConfigDefinition, + ReportType, + ReportTimeframeType, + ReportConfigTimePeriod, + ReportConfigDataset, + ReportGranularityType, + ReportConfigDatasetConfiguration, + ReportConfigAggregation, + FunctionType, + ReportConfigGrouping, + QueryColumnType, + ReportConfigSorting, + ReportConfigSortingType, + ReportConfigFilter, + ReportConfigComparisonExpression, + OperatorType, + ChartType, + AccumulatedType, + MetricType, + KpiProperties, + KpiType, + PivotProperties, + PivotType, + ProxyResource, + Alert, + AlertProperties, + AlertPropertiesDefinition, + AlertType, + AlertCategory, + AlertCriteria, + AlertSource, + AlertPropertiesDetails, + AlertTimeGrainType, + AlertOperator, + AlertStatus, + DismissAlertPayload, + AlertsResult, + ScheduledAction, + ScheduledActionProperties, + FileDestination, + FileFormat, + NotificationProperties, + ScheduleProperties, + ScheduleFrequency, + DaysOfWeek, + WeeksOfMonth, + ScheduledActionStatus, + ScheduledActionKind, + ErrorResponseWithNestedDetails, + ErrorDetailsWithNestedDetails, + CheckNameAvailabilityRequest, + CheckNameAvailabilityResponse, + CheckNameAvailabilityReason, + Setting, + SettingUnion, + SettingsKind, + SettingType, + TagInheritanceSetting, + TagInheritanceProperties, + SettingsListResult, + CostDetailsOperationResults, + CostDetailsStatusType, + ReportManifest, + CostDetailsDataFormat, + RequestContext, + GenerateCostDetailsReportRequestDefinition, + CostDetailsMetricType, + CostDetailsTimePeriod, + BlobInfo, + GenerateCostDetailsReportErrorResponse, + ErrorDetail, + ErrorAdditionalInfo, + CostAllocationRuleDefinition, + CostAllocationRuleProperties, + CostAllocationRuleDetails, + SourceCostAllocationResource, + TargetCostAllocationResource, + CostAllocationProportion, + CostAllocationPolicyType, + RuleStatus, + CostAllocationResource, + CostAllocationResourceType, + CostAllocationRuleCheckNameAvailabilityRequest, + CostAllocationRuleCheckNameAvailabilityResponse, + Reason, + BenefitRecommendationModel, + BenefitRecommendationProperties, + BenefitRecommendationPropertiesUnion, + LookBackPeriod, + RecommendationUsageDetails, + Grain, + Term, + AllSavingsBenefitDetails, + AllSavingsList, + Scope, + SingleScopeBenefitRecommendationProperties, + SharedScopeBenefitRecommendationProperties, + BenefitResource, + BenefitKind, + BenefitUtilizationSummary, + BenefitUtilizationSummaryUnion, + IncludedQuantityUtilizationSummary, + IncludedQuantityUtilizationSummaryProperties, + SavingsPlanUtilizationSummary, + SavingsPlanUtilizationSummaryProperties, + BenefitUtilizationSummaryProperties, + BenefitUtilizationSummariesRequest, + BenefitUtilizationSummariesOperationStatus, + OperationStatusType, + AsyncOperationStatusProperties, + BenefitUtilizationSummaryReportSchema, + ArmErrorResponse, + GenerateDetailedCostReportDefinition, + GenerateDetailedCostReportMetricType, + GenerateDetailedCostReportTimePeriod, + GenerateDetailedCostReportErrorResponse, + ForecastDefinition, + ForecastType, + ForecastTimeframe, + ForecastTimePeriod, + ForecastDataset, + ForecastDatasetConfiguration, + ForecastAggregation, + FunctionName, + ForecastFilter, + ForecastComparisonExpression, + ForecastOperatorType, + ForecastResult, + ForecastProperties, + ForecastColumn, + CostManagementResource, + Dimension, + DimensionProperties, + QueryDefinition, + QueryTimePeriod, + QueryDataset, + QueryDatasetConfiguration, + QueryAggregation, + QueryGrouping, + QueryFilter, + QueryComparisonExpression, + QueryOperatorType, + QueryResult, + QueryProperties, + QueryColumn, + OperationStatus, + ReportURL, + ReservationReportSchema, + PricesheetDownloadProperties, + MCAPriceSheetProperties, + ExternalCloudProviderType, + GrainParameter, +} from "./models.js"; +export { + KnownReportOperationStatusType, + KnownCreatedByType, + KnownOrigin, + KnownActionType, + KnownCategoryType, + KnownTimeGrainType, + KnownBudgetOperatorType, + KnownBudgetNotificationOperatorType, + KnownFrequency, + KnownThresholdType, + KnownCultureCode, + KnownStatusType, + KnownRecurrenceType, + KnownSystemAssignedServiceIdentityType, + KnownFormatType, + KnownDestinationType, + KnownExportType, + KnownTimeframeType, + KnownGranularityType, + KnownFilterItemNames, + KnownExecutionType, + KnownExecutionStatus, + KnownDataOverwriteBehaviorType, + KnownCompressionModeType, + KnownReportType, + KnownReportTimeframeType, + KnownReportGranularityType, + KnownFunctionType, + KnownQueryColumnType, + KnownReportConfigSortingType, + KnownOperatorType, + KnownChartType, + KnownAccumulatedType, + KnownMetricType, + KnownKpiType, + KnownPivotType, + KnownAlertType, + KnownAlertCategory, + KnownAlertCriteria, + KnownAlertSource, + KnownAlertTimeGrainType, + KnownAlertOperator, + KnownAlertStatus, + KnownFileFormat, + KnownScheduleFrequency, + KnownDaysOfWeek, + KnownWeeksOfMonth, + KnownScheduledActionStatus, + KnownScheduledActionKind, + KnownCheckNameAvailabilityReason, + KnownSettingsKind, + KnownSettingType, + KnownCostDetailsStatusType, + KnownCostDetailsDataFormat, + KnownCostDetailsMetricType, + KnownCostAllocationPolicyType, + KnownRuleStatus, + KnownCostAllocationResourceType, + KnownReason, + KnownLookBackPeriod, + KnownGrain, + KnownTerm, + KnownScope, + KnownBenefitKind, + KnownOperationStatusType, + KnownBenefitUtilizationSummaryReportSchema, + KnownGenerateDetailedCostReportMetricType, + KnownForecastType, + KnownForecastTimeframe, + KnownFunctionName, + KnownForecastOperatorType, + KnownQueryOperatorType, + KnownReservationReportSchema, + KnownExternalCloudProviderType, + KnownGrainParameter, + KnownVersions, +} from "./models.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/models/mappers.ts b/sdk/cost-management/arm-costmanagement/src/models/mappers.ts deleted file mode 100644 index 58b8d6da87c8..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/models/mappers.ts +++ /dev/null @@ -1,3957 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import * as coreClient from "@azure/core-client"; - -export const OperationListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationListResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "CostManagementOperation" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const Operation: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Operation", - modelProperties: { - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String" - } - }, - isDataAction: { - serializedName: "isDataAction", - readOnly: true, - type: { - name: "Boolean" - } - }, - display: { - serializedName: "display", - type: { - name: "Composite", - className: "OperationDisplay" - } - }, - origin: { - serializedName: "origin", - readOnly: true, - type: { - name: "String" - } - }, - actionType: { - serializedName: "actionType", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const OperationDisplay: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationDisplay", - modelProperties: { - provider: { - serializedName: "provider", - readOnly: true, - type: { - name: "String" - } - }, - resource: { - serializedName: "resource", - readOnly: true, - type: { - name: "String" - } - }, - operation: { - serializedName: "operation", - readOnly: true, - type: { - name: "String" - } - }, - description: { - serializedName: "description", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const ErrorResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorResponse", - modelProperties: { - error: { - serializedName: "error", - type: { - name: "Composite", - className: "ErrorDetails" - } - } - } - } -}; - -export const ErrorDetails: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorDetails", - modelProperties: { - code: { - serializedName: "code", - readOnly: true, - type: { - name: "String" - } - }, - message: { - serializedName: "message", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const ViewListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ViewListResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "View" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const ReportConfigTimePeriod: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ReportConfigTimePeriod", - modelProperties: { - from: { - serializedName: "from", - required: true, - type: { - name: "DateTime" - } - }, - to: { - serializedName: "to", - required: true, - type: { - name: "DateTime" - } - } - } - } -}; - -export const ReportConfigDataset: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ReportConfigDataset", - modelProperties: { - granularity: { - serializedName: "granularity", - type: { - name: "String" - } - }, - configuration: { - serializedName: "configuration", - type: { - name: "Composite", - className: "ReportConfigDatasetConfiguration" - } - }, - aggregation: { - serializedName: "aggregation", - type: { - name: "Dictionary", - value: { - type: { name: "Composite", className: "ReportConfigAggregation" } - } - } - }, - grouping: { - constraints: { - MaxItems: 2 - }, - serializedName: "grouping", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ReportConfigGrouping" - } - } - } - }, - sorting: { - serializedName: "sorting", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ReportConfigSorting" - } - } - } - }, - filter: { - serializedName: "filter", - type: { - name: "Composite", - className: "ReportConfigFilter" - } - } - } - } -}; - -export const ReportConfigDatasetConfiguration: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ReportConfigDatasetConfiguration", - modelProperties: { - columns: { - serializedName: "columns", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - } - } - } -}; - -export const ReportConfigAggregation: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ReportConfigAggregation", - modelProperties: { - name: { - serializedName: "name", - required: true, - type: { - name: "String" - } - }, - function: { - serializedName: "function", - required: true, - type: { - name: "String" - } - } - } - } -}; - -export const ReportConfigGrouping: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ReportConfigGrouping", - modelProperties: { - type: { - serializedName: "type", - required: true, - type: { - name: "String" - } - }, - name: { - serializedName: "name", - required: true, - type: { - name: "String" - } - } - } - } -}; - -export const ReportConfigSorting: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ReportConfigSorting", - modelProperties: { - direction: { - serializedName: "direction", - type: { - name: "String" - } - }, - name: { - serializedName: "name", - required: true, - type: { - name: "String" - } - } - } - } -}; - -export const ReportConfigFilter: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ReportConfigFilter", - modelProperties: { - and: { - constraints: { - MinItems: 2 - }, - serializedName: "and", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ReportConfigFilter" - } - } - } - }, - or: { - constraints: { - MinItems: 2 - }, - serializedName: "or", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ReportConfigFilter" - } - } - } - }, - dimensions: { - serializedName: "dimensions", - type: { - name: "Composite", - className: "ReportConfigComparisonExpression" - } - }, - tags: { - serializedName: "tags", - type: { - name: "Composite", - className: "ReportConfigComparisonExpression" - } - } - } - } -}; - -export const ReportConfigComparisonExpression: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ReportConfigComparisonExpression", - modelProperties: { - name: { - serializedName: "name", - required: true, - type: { - name: "String" - } - }, - operator: { - serializedName: "operator", - required: true, - type: { - name: "String" - } - }, - values: { - constraints: { - MinItems: 1 - }, - serializedName: "values", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - } - } - } -}; - -export const KpiProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "KpiProperties", - modelProperties: { - type: { - serializedName: "type", - type: { - name: "String" - } - }, - id: { - serializedName: "id", - type: { - name: "String" - } - }, - enabled: { - serializedName: "enabled", - type: { - name: "Boolean" - } - } - } - } -}; - -export const PivotProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PivotProperties", - modelProperties: { - type: { - serializedName: "type", - type: { - name: "String" - } - }, - name: { - serializedName: "name", - type: { - name: "String" - } - } - } - } -}; - -export const CostManagementProxyResource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CostManagementProxyResource", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String" - } - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String" - } - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String" - } - }, - eTag: { - serializedName: "eTag", - type: { - name: "String" - } - } - } - } -}; - -export const AlertsResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AlertsResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Alert" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const AlertPropertiesDefinition: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AlertPropertiesDefinition", - modelProperties: { - type: { - serializedName: "type", - type: { - name: "String" - } - }, - category: { - serializedName: "category", - type: { - name: "String" - } - }, - criteria: { - serializedName: "criteria", - type: { - name: "String" - } - } - } - } -}; - -export const AlertPropertiesDetails: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AlertPropertiesDetails", - modelProperties: { - timeGrainType: { - serializedName: "timeGrainType", - type: { - name: "String" - } - }, - periodStartDate: { - serializedName: "periodStartDate", - type: { - name: "String" - } - }, - triggeredBy: { - serializedName: "triggeredBy", - type: { - name: "String" - } - }, - resourceGroupFilter: { - serializedName: "resourceGroupFilter", - type: { - name: "Sequence", - element: { - type: { - name: "any" - } - } - } - }, - resourceFilter: { - serializedName: "resourceFilter", - type: { - name: "Sequence", - element: { - type: { - name: "any" - } - } - } - }, - meterFilter: { - serializedName: "meterFilter", - type: { - name: "Sequence", - element: { - type: { - name: "any" - } - } - } - }, - tagFilter: { - serializedName: "tagFilter", - type: { - name: "Dictionary", - value: { type: { name: "any" } } - } - }, - threshold: { - serializedName: "threshold", - type: { - name: "Number" - } - }, - operator: { - serializedName: "operator", - type: { - name: "String" - } - }, - amount: { - serializedName: "amount", - type: { - name: "Number" - } - }, - unit: { - serializedName: "unit", - type: { - name: "String" - } - }, - currentSpend: { - serializedName: "currentSpend", - type: { - name: "Number" - } - }, - contactEmails: { - serializedName: "contactEmails", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - contactGroups: { - serializedName: "contactGroups", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - contactRoles: { - serializedName: "contactRoles", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - overridingAlert: { - serializedName: "overridingAlert", - type: { - name: "String" - } - }, - departmentName: { - serializedName: "departmentName", - type: { - name: "String" - } - }, - companyName: { - serializedName: "companyName", - type: { - name: "String" - } - }, - enrollmentNumber: { - serializedName: "enrollmentNumber", - type: { - name: "String" - } - }, - enrollmentStartDate: { - serializedName: "enrollmentStartDate", - type: { - name: "String" - } - }, - enrollmentEndDate: { - serializedName: "enrollmentEndDate", - type: { - name: "String" - } - }, - invoicingThreshold: { - serializedName: "invoicingThreshold", - type: { - name: "Number" - } - } - } - } -}; - -export const DismissAlertPayload: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DismissAlertPayload", - modelProperties: { - definition: { - serializedName: "properties.definition", - type: { - name: "Composite", - className: "AlertPropertiesDefinition" - } - }, - description: { - serializedName: "properties.description", - type: { - name: "String" - } - }, - source: { - serializedName: "properties.source", - type: { - name: "String" - } - }, - details: { - serializedName: "properties.details", - type: { - name: "Composite", - className: "AlertPropertiesDetails" - } - }, - costEntityId: { - serializedName: "properties.costEntityId", - type: { - name: "String" - } - }, - status: { - serializedName: "properties.status", - type: { - name: "String" - } - }, - creationTime: { - serializedName: "properties.creationTime", - type: { - name: "String" - } - }, - closeTime: { - serializedName: "properties.closeTime", - type: { - name: "String" - } - }, - modificationTime: { - serializedName: "properties.modificationTime", - type: { - name: "String" - } - }, - statusModificationUserName: { - serializedName: "properties.statusModificationUserName", - type: { - name: "String" - } - }, - statusModificationTime: { - serializedName: "properties.statusModificationTime", - type: { - name: "String" - } - } - } - } -}; - -export const ForecastDefinition: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ForecastDefinition", - modelProperties: { - type: { - serializedName: "type", - required: true, - type: { - name: "String" - } - }, - timeframe: { - serializedName: "timeframe", - required: true, - type: { - name: "String" - } - }, - timePeriod: { - serializedName: "timePeriod", - type: { - name: "Composite", - className: "ForecastTimePeriod" - } - }, - dataset: { - serializedName: "dataset", - type: { - name: "Composite", - className: "ForecastDataset" - } - }, - includeActualCost: { - serializedName: "includeActualCost", - type: { - name: "Boolean" - } - }, - includeFreshPartialCost: { - serializedName: "includeFreshPartialCost", - type: { - name: "Boolean" - } - } - } - } -}; - -export const ForecastTimePeriod: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ForecastTimePeriod", - modelProperties: { - from: { - serializedName: "from", - required: true, - type: { - name: "DateTime" - } - }, - to: { - serializedName: "to", - required: true, - type: { - name: "DateTime" - } - } - } - } -}; - -export const ForecastDataset: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ForecastDataset", - modelProperties: { - granularity: { - serializedName: "granularity", - type: { - name: "String" - } - }, - configuration: { - serializedName: "configuration", - type: { - name: "Composite", - className: "ForecastDatasetConfiguration" - } - }, - aggregation: { - serializedName: "aggregation", - required: true, - type: { - name: "Dictionary", - value: { - type: { name: "Composite", className: "ForecastAggregation" } - } - } - }, - filter: { - serializedName: "filter", - type: { - name: "Composite", - className: "ForecastFilter" - } - } - } - } -}; - -export const ForecastDatasetConfiguration: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ForecastDatasetConfiguration", - modelProperties: { - columns: { - serializedName: "columns", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - } - } - } -}; - -export const ForecastAggregation: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ForecastAggregation", - modelProperties: { - name: { - serializedName: "name", - required: true, - type: { - name: "String" - } - }, - function: { - serializedName: "function", - required: true, - type: { - name: "String" - } - } - } - } -}; - -export const ForecastFilter: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ForecastFilter", - modelProperties: { - and: { - constraints: { - MinItems: 2 - }, - serializedName: "and", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ForecastFilter" - } - } - } - }, - or: { - constraints: { - MinItems: 2 - }, - serializedName: "or", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ForecastFilter" - } - } - } - }, - dimensions: { - serializedName: "dimensions", - type: { - name: "Composite", - className: "ForecastComparisonExpression" - } - }, - tags: { - serializedName: "tags", - type: { - name: "Composite", - className: "ForecastComparisonExpression" - } - } - } - } -}; - -export const ForecastComparisonExpression: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ForecastComparisonExpression", - modelProperties: { - name: { - serializedName: "name", - required: true, - type: { - name: "String" - } - }, - operator: { - serializedName: "operator", - required: true, - type: { - name: "String" - } - }, - values: { - constraints: { - MinItems: 1 - }, - serializedName: "values", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - } - } - } -}; - -export const ForecastColumn: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ForecastColumn", - modelProperties: { - name: { - serializedName: "name", - type: { - name: "String" - } - }, - type: { - serializedName: "type", - type: { - name: "String" - } - } - } - } -}; - -export const CostManagementResource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CostManagementResource", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String" - } - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String" - } - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String" - } - }, - location: { - serializedName: "location", - readOnly: true, - type: { - name: "String" - } - }, - sku: { - serializedName: "sku", - readOnly: true, - type: { - name: "String" - } - }, - eTag: { - serializedName: "eTag", - readOnly: true, - type: { - name: "String" - } - }, - tags: { - serializedName: "tags", - readOnly: true, - type: { - name: "Dictionary", - value: { type: { name: "String" } } - } - } - } - } -}; - -export const DimensionsListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DimensionsListResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Dimension" - } - } - } - } - } - } -}; - -export const QueryDefinition: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "QueryDefinition", - modelProperties: { - type: { - serializedName: "type", - required: true, - type: { - name: "String" - } - }, - timeframe: { - serializedName: "timeframe", - required: true, - type: { - name: "String" - } - }, - timePeriod: { - serializedName: "timePeriod", - type: { - name: "Composite", - className: "QueryTimePeriod" - } - }, - dataset: { - serializedName: "dataset", - type: { - name: "Composite", - className: "QueryDataset" - } - } - } - } -}; - -export const QueryTimePeriod: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "QueryTimePeriod", - modelProperties: { - from: { - serializedName: "from", - required: true, - type: { - name: "DateTime" - } - }, - to: { - serializedName: "to", - required: true, - type: { - name: "DateTime" - } - } - } - } -}; - -export const QueryDataset: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "QueryDataset", - modelProperties: { - granularity: { - serializedName: "granularity", - type: { - name: "String" - } - }, - configuration: { - serializedName: "configuration", - type: { - name: "Composite", - className: "QueryDatasetConfiguration" - } - }, - aggregation: { - serializedName: "aggregation", - type: { - name: "Dictionary", - value: { type: { name: "Composite", className: "QueryAggregation" } } - } - }, - grouping: { - constraints: { - MaxItems: 2 - }, - serializedName: "grouping", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "QueryGrouping" - } - } - } - }, - filter: { - serializedName: "filter", - type: { - name: "Composite", - className: "QueryFilter" - } - } - } - } -}; - -export const QueryDatasetConfiguration: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "QueryDatasetConfiguration", - modelProperties: { - columns: { - serializedName: "columns", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - } - } - } -}; - -export const QueryAggregation: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "QueryAggregation", - modelProperties: { - name: { - serializedName: "name", - required: true, - type: { - name: "String" - } - }, - function: { - serializedName: "function", - required: true, - type: { - name: "String" - } - } - } - } -}; - -export const QueryGrouping: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "QueryGrouping", - modelProperties: { - type: { - serializedName: "type", - required: true, - type: { - name: "String" - } - }, - name: { - serializedName: "name", - required: true, - type: { - name: "String" - } - } - } - } -}; - -export const QueryFilter: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "QueryFilter", - modelProperties: { - and: { - constraints: { - MinItems: 2 - }, - serializedName: "and", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "QueryFilter" - } - } - } - }, - or: { - constraints: { - MinItems: 2 - }, - serializedName: "or", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "QueryFilter" - } - } - } - }, - dimensions: { - serializedName: "dimensions", - type: { - name: "Composite", - className: "QueryComparisonExpression" - } - }, - tags: { - serializedName: "tags", - type: { - name: "Composite", - className: "QueryComparisonExpression" - } - } - } - } -}; - -export const QueryComparisonExpression: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "QueryComparisonExpression", - modelProperties: { - name: { - serializedName: "name", - required: true, - type: { - name: "String" - } - }, - operator: { - serializedName: "operator", - required: true, - type: { - name: "String" - } - }, - values: { - constraints: { - MinItems: 1 - }, - serializedName: "values", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - } - } - } -}; - -export const QueryColumn: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "QueryColumn", - modelProperties: { - name: { - serializedName: "name", - type: { - name: "String" - } - }, - type: { - serializedName: "type", - type: { - name: "String" - } - } - } - } -}; - -export const OperationStatus: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationStatus", - modelProperties: { - status: { - serializedName: "status", - type: { - name: "String" - } - }, - reportUrl: { - serializedName: "properties.reportUrl", - type: { - name: "String" - } - }, - validUntil: { - serializedName: "properties.validUntil", - type: { - name: "DateTime" - } - } - } - } -}; - -export const ExportListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExportListResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Export" - } - } - } - } - } - } -}; - -export const ExportSchedule: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExportSchedule", - modelProperties: { - status: { - serializedName: "status", - type: { - name: "String" - } - }, - recurrence: { - serializedName: "recurrence", - type: { - name: "String" - } - }, - recurrencePeriod: { - serializedName: "recurrencePeriod", - type: { - name: "Composite", - className: "ExportRecurrencePeriod" - } - } - } - } -}; - -export const ExportRecurrencePeriod: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExportRecurrencePeriod", - modelProperties: { - from: { - serializedName: "from", - required: true, - type: { - name: "DateTime" - } - }, - to: { - serializedName: "to", - type: { - name: "DateTime" - } - } - } - } -}; - -export const CommonExportProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CommonExportProperties", - modelProperties: { - format: { - serializedName: "format", - type: { - name: "String" - } - }, - deliveryInfo: { - serializedName: "deliveryInfo", - type: { - name: "Composite", - className: "ExportDeliveryInfo" - } - }, - definition: { - serializedName: "definition", - type: { - name: "Composite", - className: "ExportDefinition" - } - }, - runHistory: { - serializedName: "runHistory", - type: { - name: "Composite", - className: "ExportExecutionListResult" - } - }, - partitionData: { - serializedName: "partitionData", - type: { - name: "Boolean" - } - }, - nextRunTimeEstimate: { - serializedName: "nextRunTimeEstimate", - readOnly: true, - type: { - name: "DateTime" - } - } - } - } -}; - -export const ExportDeliveryInfo: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExportDeliveryInfo", - modelProperties: { - destination: { - serializedName: "destination", - type: { - name: "Composite", - className: "ExportDeliveryDestination" - } - } - } - } -}; - -export const ExportDeliveryDestination: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExportDeliveryDestination", - modelProperties: { - resourceId: { - serializedName: "resourceId", - type: { - name: "String" - } - }, - container: { - serializedName: "container", - required: true, - type: { - name: "String" - } - }, - rootFolderPath: { - serializedName: "rootFolderPath", - type: { - name: "String" - } - }, - sasToken: { - serializedName: "sasToken", - type: { - name: "String" - } - }, - storageAccount: { - serializedName: "storageAccount", - type: { - name: "String" - } - } - } - } -}; - -export const ExportDefinition: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExportDefinition", - modelProperties: { - type: { - serializedName: "type", - required: true, - type: { - name: "String" - } - }, - timeframe: { - serializedName: "timeframe", - required: true, - type: { - name: "String" - } - }, - timePeriod: { - serializedName: "timePeriod", - type: { - name: "Composite", - className: "ExportTimePeriod" - } - }, - dataSet: { - serializedName: "dataSet", - type: { - name: "Composite", - className: "ExportDataset" - } - } - } - } -}; - -export const ExportTimePeriod: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExportTimePeriod", - modelProperties: { - from: { - serializedName: "from", - required: true, - type: { - name: "DateTime" - } - }, - to: { - serializedName: "to", - required: true, - type: { - name: "DateTime" - } - } - } - } -}; - -export const ExportDataset: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExportDataset", - modelProperties: { - granularity: { - serializedName: "granularity", - type: { - name: "String" - } - }, - configuration: { - serializedName: "configuration", - type: { - name: "Composite", - className: "ExportDatasetConfiguration" - } - } - } - } -}; - -export const ExportDatasetConfiguration: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExportDatasetConfiguration", - modelProperties: { - columns: { - serializedName: "columns", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - } - } - } -}; - -export const ExportExecutionListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExportExecutionListResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ExportRun" - } - } - } - } - } - } -}; - -export const GenerateCostDetailsReportRequestDefinition: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "GenerateCostDetailsReportRequestDefinition", - modelProperties: { - metric: { - serializedName: "metric", - type: { - name: "String" - } - }, - timePeriod: { - serializedName: "timePeriod", - type: { - name: "Composite", - className: "CostDetailsTimePeriod" - } - }, - billingPeriod: { - serializedName: "billingPeriod", - type: { - name: "String" - } - }, - invoiceId: { - serializedName: "invoiceId", - type: { - name: "String" - } - } - } - } -}; - -export const CostDetailsTimePeriod: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CostDetailsTimePeriod", - modelProperties: { - start: { - serializedName: "start", - required: true, - type: { - name: "String" - } - }, - end: { - serializedName: "end", - required: true, - type: { - name: "String" - } - } - } - } -}; - -export const CostDetailsOperationResults: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CostDetailsOperationResults", - modelProperties: { - id: { - serializedName: "id", - type: { - name: "String" - } - }, - name: { - serializedName: "name", - type: { - name: "String" - } - }, - type: { - serializedName: "type", - type: { - name: "String" - } - }, - status: { - serializedName: "status", - type: { - name: "String" - } - }, - validTill: { - serializedName: "validTill", - type: { - name: "DateTime" - } - }, - error: { - serializedName: "error", - type: { - name: "Composite", - className: "ErrorDetails" - } - }, - manifestVersion: { - serializedName: "manifest.manifestVersion", - type: { - name: "String" - } - }, - dataFormat: { - serializedName: "manifest.dataFormat", - type: { - name: "String" - } - }, - byteCount: { - serializedName: "manifest.byteCount", - type: { - name: "Number" - } - }, - blobCount: { - serializedName: "manifest.blobCount", - type: { - name: "Number" - } - }, - compressData: { - serializedName: "manifest.compressData", - type: { - name: "Boolean" - } - }, - blobs: { - serializedName: "manifest.blobs", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "BlobInfo" - } - } - } - }, - requestScope: { - serializedName: "manifest.requestContext.requestScope", - type: { - name: "String" - } - }, - requestBody: { - serializedName: "manifest.requestContext.requestBody", - type: { - name: "Composite", - className: "GenerateCostDetailsReportRequestDefinition" - } - } - } - } -}; - -export const BlobInfo: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "BlobInfo", - modelProperties: { - blobLink: { - serializedName: "blobLink", - type: { - name: "String" - } - }, - byteCount: { - serializedName: "byteCount", - type: { - name: "Number" - } - } - } - } -}; - -export const GenerateCostDetailsReportErrorResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "GenerateCostDetailsReportErrorResponse", - modelProperties: { - error: { - serializedName: "error", - type: { - name: "Composite", - className: "ErrorDetails" - } - } - } - } -}; - -export const GenerateDetailedCostReportDefinition: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "GenerateDetailedCostReportDefinition", - modelProperties: { - metric: { - serializedName: "metric", - type: { - name: "String" - } - }, - timePeriod: { - serializedName: "timePeriod", - type: { - name: "Composite", - className: "GenerateDetailedCostReportTimePeriod" - } - }, - billingPeriod: { - serializedName: "billingPeriod", - type: { - name: "String" - } - }, - invoiceId: { - serializedName: "invoiceId", - type: { - name: "String" - } - }, - customerId: { - serializedName: "customerId", - type: { - name: "String" - } - } - } - } -}; - -export const GenerateDetailedCostReportTimePeriod: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "GenerateDetailedCostReportTimePeriod", - modelProperties: { - start: { - serializedName: "start", - required: true, - type: { - name: "String" - } - }, - end: { - serializedName: "end", - required: true, - type: { - name: "String" - } - } - } - } -}; - -export const GenerateDetailedCostReportOperationResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "GenerateDetailedCostReportOperationResult", - modelProperties: { - id: { - serializedName: "id", - type: { - name: "String" - } - }, - name: { - serializedName: "name", - type: { - name: "String" - } - }, - type: { - serializedName: "type", - type: { - name: "String" - } - }, - expiryTime: { - serializedName: "properties.expiryTime", - readOnly: true, - type: { - name: "DateTime" - } - }, - validTill: { - serializedName: "properties.validTill", - type: { - name: "DateTime" - } - }, - downloadUrl: { - serializedName: "properties.downloadUrl", - type: { - name: "String" - } - } - } - } -}; - -export const DownloadURL: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DownloadURL", - modelProperties: { - expiryTime: { - serializedName: "expiryTime", - readOnly: true, - type: { - name: "DateTime" - } - }, - validTill: { - serializedName: "validTill", - type: { - name: "DateTime" - } - }, - downloadUrl: { - serializedName: "downloadUrl", - type: { - name: "String" - } - } - } - } -}; - -export const GenerateDetailedCostReportErrorResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "GenerateDetailedCostReportErrorResponse", - modelProperties: { - error: { - serializedName: "error", - type: { - name: "Composite", - className: "ErrorDetails" - } - } - } - } -}; - -export const GenerateDetailedCostReportOperationStatuses: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "GenerateDetailedCostReportOperationStatuses", - modelProperties: { - id: { - serializedName: "id", - type: { - name: "String" - } - }, - name: { - serializedName: "name", - type: { - name: "String" - } - }, - status: { - serializedName: "status", - type: { - name: "Composite", - className: "Status" - } - }, - startTime: { - serializedName: "startTime", - type: { - name: "String" - } - }, - endTime: { - serializedName: "endTime", - type: { - name: "String" - } - }, - type: { - serializedName: "type", - type: { - name: "String" - } - }, - error: { - serializedName: "error", - type: { - name: "Composite", - className: "ErrorDetails" - } - }, - expiryTime: { - serializedName: "properties.expiryTime", - readOnly: true, - type: { - name: "DateTime" - } - }, - validTill: { - serializedName: "properties.validTill", - type: { - name: "DateTime" - } - }, - downloadUrl: { - serializedName: "properties.downloadUrl", - type: { - name: "String" - } - } - } - } -}; - -export const Status: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Status", - modelProperties: { - status: { - serializedName: "status", - type: { - name: "String" - } - } - } - } -}; - -export const ScheduledActionListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ScheduledActionListResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ScheduledAction" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const FileDestination: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "FileDestination", - modelProperties: { - fileFormats: { - serializedName: "fileFormats", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - } - } - } -}; - -export const NotificationProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NotificationProperties", - modelProperties: { - to: { - constraints: { - MinItems: 1, - MaxItems: 20 - }, - serializedName: "to", - required: true, - type: { - name: "Sequence", - element: { - constraints: { - Pattern: new RegExp( - "^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\\.)+[A-Za-z]{2,}$" - ) - }, - type: { - name: "String" - } - } - } - }, - language: { - serializedName: "language", - type: { - name: "String" - } - }, - message: { - serializedName: "message", - type: { - name: "String" - } - }, - regionalFormat: { - serializedName: "regionalFormat", - type: { - name: "String" - } - }, - subject: { - serializedName: "subject", - required: true, - type: { - name: "String" - } - } - } - } -}; - -export const ScheduleProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ScheduleProperties", - modelProperties: { - frequency: { - serializedName: "frequency", - required: true, - type: { - name: "String" - } - }, - hourOfDay: { - serializedName: "hourOfDay", - type: { - name: "Number" - } - }, - daysOfWeek: { - serializedName: "daysOfWeek", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - weeksOfMonth: { - serializedName: "weeksOfMonth", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - dayOfMonth: { - serializedName: "dayOfMonth", - type: { - name: "Number" - } - }, - startDate: { - serializedName: "startDate", - required: true, - type: { - name: "DateTime" - } - }, - endDate: { - serializedName: "endDate", - required: true, - type: { - name: "DateTime" - } - } - } - } -}; - -export const SystemData: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "SystemData", - modelProperties: { - createdBy: { - serializedName: "createdBy", - type: { - name: "String" - } - }, - createdByType: { - serializedName: "createdByType", - type: { - name: "String" - } - }, - createdAt: { - serializedName: "createdAt", - type: { - name: "DateTime" - } - }, - lastModifiedBy: { - serializedName: "lastModifiedBy", - type: { - name: "String" - } - }, - lastModifiedByType: { - serializedName: "lastModifiedByType", - type: { - name: "String" - } - }, - lastModifiedAt: { - serializedName: "lastModifiedAt", - type: { - name: "DateTime" - } - } - } - } -}; - -export const Resource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Resource", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String" - } - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String" - } - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const ErrorResponseWithNestedDetails: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorResponseWithNestedDetails", - modelProperties: { - error: { - serializedName: "error", - type: { - name: "Composite", - className: "ErrorDetailsWithNestedDetails" - } - } - } - } -}; - -export const CheckNameAvailabilityRequest: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CheckNameAvailabilityRequest", - modelProperties: { - name: { - serializedName: "name", - type: { - name: "String" - } - }, - type: { - serializedName: "type", - type: { - name: "String" - } - } - } - } -}; - -export const CheckNameAvailabilityResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CheckNameAvailabilityResponse", - modelProperties: { - nameAvailable: { - serializedName: "nameAvailable", - type: { - name: "Boolean" - } - }, - reason: { - serializedName: "reason", - type: { - name: "String" - } - }, - message: { - serializedName: "message", - type: { - name: "String" - } - } - } - } -}; - -export const BenefitRecommendationsListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "BenefitRecommendationsListResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "BenefitRecommendationModel" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const BenefitRecommendationProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "BenefitRecommendationProperties", - uberParent: "BenefitRecommendationProperties", - polymorphicDiscriminator: { - serializedName: "scope", - clientName: "scope" - }, - modelProperties: { - firstConsumptionDate: { - serializedName: "firstConsumptionDate", - readOnly: true, - type: { - name: "DateTime" - } - }, - lastConsumptionDate: { - serializedName: "lastConsumptionDate", - readOnly: true, - type: { - name: "DateTime" - } - }, - lookBackPeriod: { - serializedName: "lookBackPeriod", - type: { - name: "String" - } - }, - totalHours: { - serializedName: "totalHours", - readOnly: true, - type: { - name: "Number" - } - }, - usage: { - serializedName: "usage", - type: { - name: "Composite", - className: "RecommendationUsageDetails" - } - }, - armSkuName: { - serializedName: "armSkuName", - readOnly: true, - type: { - name: "String" - } - }, - term: { - serializedName: "term", - type: { - name: "String" - } - }, - commitmentGranularity: { - serializedName: "commitmentGranularity", - type: { - name: "String" - } - }, - currencyCode: { - serializedName: "currencyCode", - readOnly: true, - type: { - name: "String" - } - }, - costWithoutBenefit: { - serializedName: "costWithoutBenefit", - readOnly: true, - type: { - name: "Number" - } - }, - recommendationDetails: { - serializedName: "recommendationDetails", - type: { - name: "Composite", - className: "AllSavingsBenefitDetails" - } - }, - allRecommendationDetails: { - serializedName: "allRecommendationDetails", - type: { - name: "Composite", - className: "AllSavingsList" - } - }, - scope: { - serializedName: "scope", - required: true, - type: { - name: "String" - } - } - } - } -}; - -export const RecommendationUsageDetails: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "RecommendationUsageDetails", - modelProperties: { - usageGrain: { - serializedName: "usageGrain", - type: { - name: "String" - } - }, - charges: { - serializedName: "charges", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Number" - } - } - } - } - } - } -}; - -export const AllSavingsBenefitDetails: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AllSavingsBenefitDetails", - modelProperties: { - overageCost: { - serializedName: "overageCost", - readOnly: true, - type: { - name: "Number" - } - }, - benefitCost: { - serializedName: "benefitCost", - readOnly: true, - type: { - name: "Number" - } - }, - totalCost: { - serializedName: "totalCost", - readOnly: true, - type: { - name: "Number" - } - }, - savingsAmount: { - serializedName: "savingsAmount", - readOnly: true, - type: { - name: "Number" - } - }, - savingsPercentage: { - serializedName: "savingsPercentage", - readOnly: true, - type: { - name: "Number" - } - }, - coveragePercentage: { - serializedName: "coveragePercentage", - readOnly: true, - type: { - name: "Number" - } - }, - commitmentAmount: { - serializedName: "commitmentAmount", - readOnly: true, - type: { - name: "Number" - } - }, - averageUtilizationPercentage: { - serializedName: "averageUtilizationPercentage", - readOnly: true, - type: { - name: "Number" - } - }, - wastageCost: { - serializedName: "wastageCost", - readOnly: true, - type: { - name: "Number" - } - } - } - } -}; - -export const AllSavingsList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AllSavingsList", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "AllSavingsBenefitDetails" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const BenefitUtilizationSummariesListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "BenefitUtilizationSummariesListResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "BenefitUtilizationSummary" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const BenefitUtilizationSummaryProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "BenefitUtilizationSummaryProperties", - modelProperties: { - armSkuName: { - serializedName: "armSkuName", - readOnly: true, - type: { - name: "String" - } - }, - benefitId: { - serializedName: "benefitId", - readOnly: true, - type: { - name: "String" - } - }, - benefitOrderId: { - serializedName: "benefitOrderId", - readOnly: true, - type: { - name: "String" - } - }, - benefitType: { - serializedName: "benefitType", - type: { - name: "String" - } - }, - usageDate: { - serializedName: "usageDate", - readOnly: true, - type: { - name: "DateTime" - } - } - } - } -}; - -export const CostManagementOperation: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CostManagementOperation", - modelProperties: { - ...Operation.type.modelProperties, - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const ErrorDetailsWithNestedDetails: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorDetailsWithNestedDetails", - modelProperties: { - ...ErrorDetails.type.modelProperties, - details: { - serializedName: "details", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorDetailsWithNestedDetails" - } - } - } - } - } - } -}; - -export const View: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "View", - modelProperties: { - ...CostManagementProxyResource.type.modelProperties, - displayName: { - serializedName: "properties.displayName", - type: { - name: "String" - } - }, - scope: { - serializedName: "properties.scope", - type: { - name: "String" - } - }, - createdOn: { - serializedName: "properties.createdOn", - readOnly: true, - type: { - name: "DateTime" - } - }, - modifiedOn: { - serializedName: "properties.modifiedOn", - readOnly: true, - type: { - name: "DateTime" - } - }, - dateRange: { - serializedName: "properties.dateRange", - readOnly: true, - type: { - name: "String" - } - }, - currency: { - serializedName: "properties.currency", - readOnly: true, - type: { - name: "String" - } - }, - chart: { - serializedName: "properties.chart", - type: { - name: "String" - } - }, - accumulated: { - serializedName: "properties.accumulated", - type: { - name: "String" - } - }, - metric: { - serializedName: "properties.metric", - type: { - name: "String" - } - }, - kpis: { - serializedName: "properties.kpis", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "KpiProperties" - } - } - } - }, - pivots: { - serializedName: "properties.pivots", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "PivotProperties" - } - } - } - }, - typePropertiesQueryType: { - serializedName: "properties.query.type", - type: { - name: "String" - } - }, - timeframe: { - serializedName: "properties.query.timeframe", - type: { - name: "String" - } - }, - timePeriod: { - serializedName: "properties.query.timePeriod", - type: { - name: "Composite", - className: "ReportConfigTimePeriod" - } - }, - dataSet: { - serializedName: "properties.query.dataSet", - type: { - name: "Composite", - className: "ReportConfigDataset" - } - }, - includeMonetaryCommitment: { - serializedName: "properties.query.includeMonetaryCommitment", - type: { - name: "Boolean" - } - } - } - } -}; - -export const Alert: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Alert", - modelProperties: { - ...CostManagementProxyResource.type.modelProperties, - definition: { - serializedName: "properties.definition", - type: { - name: "Composite", - className: "AlertPropertiesDefinition" - } - }, - description: { - serializedName: "properties.description", - type: { - name: "String" - } - }, - source: { - serializedName: "properties.source", - type: { - name: "String" - } - }, - details: { - serializedName: "properties.details", - type: { - name: "Composite", - className: "AlertPropertiesDetails" - } - }, - costEntityId: { - serializedName: "properties.costEntityId", - type: { - name: "String" - } - }, - status: { - serializedName: "properties.status", - type: { - name: "String" - } - }, - creationTime: { - serializedName: "properties.creationTime", - type: { - name: "String" - } - }, - closeTime: { - serializedName: "properties.closeTime", - type: { - name: "String" - } - }, - modificationTime: { - serializedName: "properties.modificationTime", - type: { - name: "String" - } - }, - statusModificationUserName: { - serializedName: "properties.statusModificationUserName", - type: { - name: "String" - } - }, - statusModificationTime: { - serializedName: "properties.statusModificationTime", - type: { - name: "String" - } - } - } - } -}; - -export const ExportRun: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExportRun", - modelProperties: { - ...CostManagementProxyResource.type.modelProperties, - executionType: { - serializedName: "properties.executionType", - type: { - name: "String" - } - }, - status: { - serializedName: "properties.status", - type: { - name: "String" - } - }, - submittedBy: { - serializedName: "properties.submittedBy", - type: { - name: "String" - } - }, - submittedTime: { - serializedName: "properties.submittedTime", - type: { - name: "DateTime" - } - }, - processingStartTime: { - serializedName: "properties.processingStartTime", - type: { - name: "DateTime" - } - }, - processingEndTime: { - serializedName: "properties.processingEndTime", - type: { - name: "DateTime" - } - }, - fileName: { - serializedName: "properties.fileName", - type: { - name: "String" - } - }, - runSettings: { - serializedName: "properties.runSettings", - type: { - name: "Composite", - className: "CommonExportProperties" - } - }, - error: { - serializedName: "properties.error", - type: { - name: "Composite", - className: "ErrorDetails" - } - } - } - } -}; - -export const Export: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Export", - modelProperties: { - ...CostManagementProxyResource.type.modelProperties, - format: { - serializedName: "properties.format", - type: { - name: "String" - } - }, - deliveryInfo: { - serializedName: "properties.deliveryInfo", - type: { - name: "Composite", - className: "ExportDeliveryInfo" - } - }, - definition: { - serializedName: "properties.definition", - type: { - name: "Composite", - className: "ExportDefinition" - } - }, - runHistory: { - serializedName: "properties.runHistory", - type: { - name: "Composite", - className: "ExportExecutionListResult" - } - }, - partitionData: { - serializedName: "properties.partitionData", - type: { - name: "Boolean" - } - }, - nextRunTimeEstimate: { - serializedName: "properties.nextRunTimeEstimate", - readOnly: true, - type: { - name: "DateTime" - } - }, - schedule: { - serializedName: "properties.schedule", - type: { - name: "Composite", - className: "ExportSchedule" - } - } - } - } -}; - -export const ForecastResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ForecastResult", - modelProperties: { - ...CostManagementResource.type.modelProperties, - nextLink: { - serializedName: "properties.nextLink", - type: { - name: "String" - } - }, - columns: { - serializedName: "properties.columns", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ForecastColumn" - } - } - } - }, - rows: { - serializedName: "properties.rows", - type: { - name: "Sequence", - element: { - type: { - name: "Sequence", - element: { - type: { - name: "any" - } - } - } - } - } - } - } - } -}; - -export const Dimension: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Dimension", - modelProperties: { - ...CostManagementResource.type.modelProperties, - description: { - serializedName: "properties.description", - readOnly: true, - type: { - name: "String" - } - }, - filterEnabled: { - serializedName: "properties.filterEnabled", - readOnly: true, - type: { - name: "Boolean" - } - }, - groupingEnabled: { - serializedName: "properties.groupingEnabled", - readOnly: true, - type: { - name: "Boolean" - } - }, - data: { - serializedName: "properties.data", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - total: { - serializedName: "properties.total", - readOnly: true, - type: { - name: "Number" - } - }, - category: { - serializedName: "properties.category", - readOnly: true, - type: { - name: "String" - } - }, - usageStart: { - serializedName: "properties.usageStart", - readOnly: true, - type: { - name: "DateTime" - } - }, - usageEnd: { - serializedName: "properties.usageEnd", - readOnly: true, - type: { - name: "DateTime" - } - }, - nextLink: { - serializedName: "properties.nextLink", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const QueryResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "QueryResult", - modelProperties: { - ...CostManagementResource.type.modelProperties, - nextLink: { - serializedName: "properties.nextLink", - type: { - name: "String" - } - }, - columns: { - serializedName: "properties.columns", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "QueryColumn" - } - } - } - }, - rows: { - serializedName: "properties.rows", - type: { - name: "Sequence", - element: { - type: { - name: "Sequence", - element: { - type: { - name: "any" - } - } - } - } - } - } - } - } -}; - -export const ExportProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExportProperties", - modelProperties: { - ...CommonExportProperties.type.modelProperties, - schedule: { - serializedName: "schedule", - type: { - name: "Composite", - className: "ExportSchedule" - } - } - } - } -}; - -export const ProxyResource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ProxyResource", - modelProperties: { - ...Resource.type.modelProperties - } - } -}; - -export const BenefitResource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "BenefitResource", - modelProperties: { - ...Resource.type.modelProperties, - kind: { - serializedName: "kind", - type: { - name: "String" - } - } - } - } -}; - -export const BenefitUtilizationSummary: coreClient.CompositeMapper = { - serializedName: "BenefitUtilizationSummary", - type: { - name: "Composite", - className: "BenefitUtilizationSummary", - uberParent: "Resource", - polymorphicDiscriminator: { - serializedName: "kind", - clientName: "kind" - }, - modelProperties: { - ...Resource.type.modelProperties, - kind: { - serializedName: "kind", - required: true, - type: { - name: "String" - } - } - } - } -}; - -export const SingleScopeBenefitRecommendationProperties: coreClient.CompositeMapper = { - serializedName: "Single", - type: { - name: "Composite", - className: "SingleScopeBenefitRecommendationProperties", - uberParent: "BenefitRecommendationProperties", - polymorphicDiscriminator: - BenefitRecommendationProperties.type.polymorphicDiscriminator, - modelProperties: { - ...BenefitRecommendationProperties.type.modelProperties, - subscriptionId: { - serializedName: "subscriptionId", - readOnly: true, - type: { - name: "String" - } - }, - resourceGroup: { - serializedName: "resourceGroup", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const SharedScopeBenefitRecommendationProperties: coreClient.CompositeMapper = { - serializedName: "Shared", - type: { - name: "Composite", - className: "SharedScopeBenefitRecommendationProperties", - uberParent: "BenefitRecommendationProperties", - polymorphicDiscriminator: - BenefitRecommendationProperties.type.polymorphicDiscriminator, - modelProperties: { - ...BenefitRecommendationProperties.type.modelProperties - } - } -}; - -export const IncludedQuantityUtilizationSummaryProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "IncludedQuantityUtilizationSummaryProperties", - modelProperties: { - ...BenefitUtilizationSummaryProperties.type.modelProperties, - utilizationPercentage: { - serializedName: "utilizationPercentage", - readOnly: true, - type: { - name: "Number" - } - } - } - } -}; - -export const SavingsPlanUtilizationSummaryProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "SavingsPlanUtilizationSummaryProperties", - modelProperties: { - ...BenefitUtilizationSummaryProperties.type.modelProperties, - avgUtilizationPercentage: { - serializedName: "avgUtilizationPercentage", - readOnly: true, - type: { - name: "Number" - } - }, - minUtilizationPercentage: { - serializedName: "minUtilizationPercentage", - readOnly: true, - type: { - name: "Number" - } - }, - maxUtilizationPercentage: { - serializedName: "maxUtilizationPercentage", - readOnly: true, - type: { - name: "Number" - } - } - } - } -}; - -export const ScheduledActionProxyResource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ScheduledActionProxyResource", - modelProperties: { - ...ProxyResource.type.modelProperties, - eTag: { - serializedName: "eTag", - readOnly: true, - type: { - name: "String" - } - }, - kind: { - serializedName: "kind", - type: { - name: "String" - } - }, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData" - } - } - } - } -}; - -export const BenefitRecommendationModel: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "BenefitRecommendationModel", - modelProperties: { - ...BenefitResource.type.modelProperties, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "BenefitRecommendationProperties" - } - } - } - } -}; - -export const IncludedQuantityUtilizationSummary: coreClient.CompositeMapper = { - serializedName: "IncludedQuantity", - type: { - name: "Composite", - className: "IncludedQuantityUtilizationSummary", - uberParent: "BenefitUtilizationSummary", - polymorphicDiscriminator: - BenefitUtilizationSummary.type.polymorphicDiscriminator, - modelProperties: { - ...BenefitUtilizationSummary.type.modelProperties, - armSkuName: { - serializedName: "properties.armSkuName", - readOnly: true, - type: { - name: "String" - } - }, - benefitId: { - serializedName: "properties.benefitId", - readOnly: true, - type: { - name: "String" - } - }, - benefitOrderId: { - serializedName: "properties.benefitOrderId", - readOnly: true, - type: { - name: "String" - } - }, - benefitType: { - serializedName: "properties.benefitType", - type: { - name: "String" - } - }, - usageDate: { - serializedName: "properties.usageDate", - readOnly: true, - type: { - name: "DateTime" - } - }, - utilizationPercentage: { - serializedName: "properties.utilizationPercentage", - readOnly: true, - type: { - name: "Number" - } - } - } - } -}; - -export const SavingsPlanUtilizationSummary: coreClient.CompositeMapper = { - serializedName: "SavingsPlan", - type: { - name: "Composite", - className: "SavingsPlanUtilizationSummary", - uberParent: "BenefitUtilizationSummary", - polymorphicDiscriminator: - BenefitUtilizationSummary.type.polymorphicDiscriminator, - modelProperties: { - ...BenefitUtilizationSummary.type.modelProperties, - armSkuName: { - serializedName: "properties.armSkuName", - readOnly: true, - type: { - name: "String" - } - }, - benefitId: { - serializedName: "properties.benefitId", - readOnly: true, - type: { - name: "String" - } - }, - benefitOrderId: { - serializedName: "properties.benefitOrderId", - readOnly: true, - type: { - name: "String" - } - }, - benefitType: { - serializedName: "properties.benefitType", - type: { - name: "String" - } - }, - usageDate: { - serializedName: "properties.usageDate", - readOnly: true, - type: { - name: "DateTime" - } - }, - avgUtilizationPercentage: { - serializedName: "properties.avgUtilizationPercentage", - readOnly: true, - type: { - name: "Number" - } - }, - minUtilizationPercentage: { - serializedName: "properties.minUtilizationPercentage", - readOnly: true, - type: { - name: "Number" - } - }, - maxUtilizationPercentage: { - serializedName: "properties.maxUtilizationPercentage", - readOnly: true, - type: { - name: "Number" - } - } - } - } -}; - -export const ScheduledAction: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ScheduledAction", - modelProperties: { - ...ScheduledActionProxyResource.type.modelProperties, - displayName: { - serializedName: "properties.displayName", - type: { - name: "String" - } - }, - fileDestination: { - serializedName: "properties.fileDestination", - type: { - name: "Composite", - className: "FileDestination" - } - }, - notification: { - serializedName: "properties.notification", - type: { - name: "Composite", - className: "NotificationProperties" - } - }, - notificationEmail: { - serializedName: "properties.notificationEmail", - type: { - name: "String" - } - }, - schedule: { - serializedName: "properties.schedule", - type: { - name: "Composite", - className: "ScheduleProperties" - } - }, - scope: { - serializedName: "properties.scope", - type: { - name: "String" - } - }, - status: { - serializedName: "properties.status", - type: { - name: "String" - } - }, - viewId: { - serializedName: "properties.viewId", - type: { - name: "String" - } - } - } - } -}; - -export const GenerateReservationDetailsReportByBillingAccountIdHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "GenerateReservationDetailsReportByBillingAccountIdHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String" - } - }, - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number" - } - } - } - } -}; - -export const GenerateReservationDetailsReportByBillingProfileIdHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "GenerateReservationDetailsReportByBillingProfileIdHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String" - } - }, - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number" - } - } - } - } -}; - -export const GenerateCostDetailsReportCreateOperationHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "GenerateCostDetailsReportCreateOperationHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String" - } - }, - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number" - } - } - } - } -}; - -export const GenerateDetailedCostReportCreateOperationHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "GenerateDetailedCostReportCreateOperationHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String" - } - }, - azureConsumptionAsyncOperation: { - serializedName: "azure-consumption-asyncoperation", - type: { - name: "String" - } - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String" - } - }, - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number" - } - } - } - } -}; - -export const PriceSheetDownloadHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PriceSheetDownloadHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String" - } - }, - retryAfter: { - serializedName: "retry-after", - type: { - name: "String" - } - }, - oDataEntityId: { - serializedName: "odata-entityid", - type: { - name: "String" - } - } - } - } -}; - -export const PriceSheetDownloadByBillingProfileHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PriceSheetDownloadByBillingProfileHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String" - } - }, - retryAfter: { - serializedName: "retry-after", - type: { - name: "String" - } - }, - oDataEntityId: { - serializedName: "odata-entityid", - type: { - name: "String" - } - } - } - } -}; - -export let discriminators = { - BenefitRecommendationProperties: BenefitRecommendationProperties, - "Resource.BenefitUtilizationSummary": BenefitUtilizationSummary, - "BenefitRecommendationProperties.Single": SingleScopeBenefitRecommendationProperties, - "BenefitRecommendationProperties.Shared": SharedScopeBenefitRecommendationProperties, - "BenefitUtilizationSummary.IncludedQuantity": IncludedQuantityUtilizationSummary, - "BenefitUtilizationSummary.SavingsPlan": SavingsPlanUtilizationSummary -}; diff --git a/sdk/cost-management/arm-costmanagement/src/models/models.ts b/sdk/cost-management/arm-costmanagement/src/models/models.ts new file mode 100644 index 000000000000..baaf2fdd1d17 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/models/models.ts @@ -0,0 +1,7145 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { areAllPropsUndefined } from "../static-helpers/serialization/check-prop-undefined.js"; + +/** + * This file contains only generated model types and their (de)serializers. + * Disable the following rules for internal models with '_' prefix and deserializers which require 'any' for raw JSON input. + */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ +/** The status of the long running operation for cost detailed report. */ +export interface GenerateDetailedCostReportOperationStatuses extends ExtensionResource { + /** The status of the long running operation. */ + status?: Status; + /** The startTime of the operation. */ + startTime?: string; + /** The endTime of the operation. */ + endTime?: string; + /** The details of the error. */ + error?: ErrorDetails; + /** The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. */ + readonly expiryTime?: Date; + /** The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. */ + validTill?: Date; + /** The URL to download the generated report. */ + downloadUrl?: string; +} + +export function generateDetailedCostReportOperationStatusesDeserializer( + item: any, +): GenerateDetailedCostReportOperationStatuses { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : _generateDetailedCostReportOperationStatusesPropertiesDeserializer(item["properties"])), + status: !item["status"] ? item["status"] : statusDeserializer(item["status"]), + startTime: item["startTime"], + endTime: item["endTime"], + error: !item["error"] ? item["error"] : errorDetailsDeserializer(item["error"]), + }; +} + +/** The URL to download the generated report. */ +export interface DownloadURL { + /** The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. */ + readonly expiryTime?: Date; + /** The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. */ + validTill?: Date; + /** The URL to download the generated report. */ + downloadUrl?: string; +} + +export function downloadURLDeserializer(item: any): DownloadURL { + return { + expiryTime: !item["expiryTime"] ? item["expiryTime"] : new Date(item["expiryTime"]), + validTill: !item["validTill"] ? item["validTill"] : new Date(item["validTill"]), + downloadUrl: item["downloadUrl"], + }; +} + +/** The status of the long running operation. */ +export interface Status { + /** The status of the long running operation. */ + status?: ReportOperationStatusType; +} + +export function statusDeserializer(item: any): Status { + return { + status: item["status"], + }; +} + +/** The status of the long running operation. */ +export enum KnownReportOperationStatusType { + /** InProgress */ + InProgress = "InProgress", + /** Completed */ + Completed = "Completed", + /** Failed */ + Failed = "Failed", + /** Queued */ + Queued = "Queued", + /** NoDataFound */ + NoDataFound = "NoDataFound", + /** ReadyToDownload */ + ReadyToDownload = "ReadyToDownload", + /** TimedOut */ + TimedOut = "TimedOut", +} + +/** + * The status of the long running operation. \ + * {@link KnownReportOperationStatusType} can be used interchangeably with ReportOperationStatusType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **InProgress** \ + * **Completed** \ + * **Failed** \ + * **Queued** \ + * **NoDataFound** \ + * **ReadyToDownload** \ + * **TimedOut** + */ +export type ReportOperationStatusType = string; + +/** The details of the error. */ +export interface ErrorDetails { + /** Error code. */ + readonly code?: string; + /** Error message indicating why the operation failed. */ + readonly message?: string; +} + +export function errorDetailsDeserializer(item: any): ErrorDetails { + return { + code: item["code"], + message: item["message"], + }; +} + +/** The base extension resource. */ +export interface ExtensionResource extends Resource {} + +export function extensionResourceSerializer(_item: ExtensionResource): any { + return {}; +} + +export function extensionResourceDeserializer(item: any): ExtensionResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} */ + readonly id?: string; + /** The name of the resource */ + readonly name?: string; + /** The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" */ + readonly type?: string; + /** Azure Resource Manager metadata containing createdBy and modifiedBy information. */ + readonly systemData?: SystemData; +} + +export function resourceSerializer(_item: Resource): any { + return {}; +} + +export function resourceDeserializer(item: any): Resource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +export function systemDataDeserializer(item: any): SystemData { + return { + createdBy: item["createdBy"], + createdByType: item["createdByType"], + createdAt: !item["createdAt"] ? item["createdAt"] : new Date(item["createdAt"]), + lastModifiedBy: item["lastModifiedBy"], + lastModifiedByType: item["lastModifiedByType"], + lastModifiedAt: !item["lastModifiedAt"] + ? item["lastModifiedAt"] + : new Date(item["lastModifiedAt"]), + }; +} + +/** The kind of entity that created the resource. */ +export enum KnownCreatedByType { + /** The entity was created by a user. */ + User = "User", + /** The entity was created by an application. */ + Application = "Application", + /** The entity was created by a managed identity. */ + ManagedIdentity = "ManagedIdentity", + /** The entity was created by a key. */ + Key = "Key", +} + +/** + * The kind of entity that created the resource. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User**: The entity was created by a user. \ + * **Application**: The entity was created by an application. \ + * **ManagedIdentity**: The entity was created by a managed identity. \ + * **Key**: The entity was created by a key. + */ +export type CreatedByType = string; + +/** Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. \n\nSome Error responses: \n\n * 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the \"x-ms-ratelimit-microsoft.consumption-retry-after\" header. \n\n * 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the \"Retry-After\" header. */ +export interface ErrorResponse { + /** The details of the error. */ + error?: ErrorDetails; +} + +export function errorResponseDeserializer(item: any): ErrorResponse { + return { + error: !item["error"] ? item["error"] : errorDetailsDeserializer(item["error"]), + }; +} + +/** Result of listing cost management operations. It contains a list of operations and a URL link to get the next set of results. */ +export interface _OperationListResult { + /** List of cost management operations supported by the Microsoft.CostManagement resource provider. */ + readonly value?: CostManagementOperation[]; + /** URL to get the next set of operation list results if there are any. */ + readonly nextLink?: string; +} + +export function _operationListResultDeserializer(item: any): _OperationListResult { + return { + value: !item["value"] ? item["value"] : costManagementOperationArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function costManagementOperationArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return costManagementOperationDeserializer(item); + }); +} + +/** A Cost management REST API operation. */ +export interface CostManagementOperation extends Operation { + /** Operation id: {provider}/{resource}/{operation}. */ + readonly id?: string; +} + +export function costManagementOperationDeserializer(item: any): CostManagementOperation { + return { + name: item["name"], + isDataAction: item["isDataAction"], + display: !item["display"] ? item["display"] : operationDisplayDeserializer(item["display"]), + origin: item["origin"], + actionType: item["actionType"], + id: item["id"], + }; +} + +/** Details of a REST API operation, returned from the Resource Provider Operations API */ +export interface Operation { + /** The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" */ + readonly name?: string; + /** Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure Resource Manager/control-plane operations. */ + readonly isDataAction?: boolean; + /** Localized display information for this particular operation. */ + display?: OperationDisplay; + /** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ + readonly origin?: Origin; + /** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ + readonly actionType?: ActionType; +} + +export function operationDeserializer(item: any): Operation { + return { + name: item["name"], + isDataAction: item["isDataAction"], + display: !item["display"] ? item["display"] : operationDisplayDeserializer(item["display"]), + origin: item["origin"], + actionType: item["actionType"], + }; +} + +/** Localized display information for an operation. */ +export interface OperationDisplay { + /** The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". */ + readonly provider?: string; + /** The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". */ + readonly resource?: string; + /** The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". */ + readonly operation?: string; + /** The short, localized friendly description of the operation; suitable for tool tips and detailed views. */ + readonly description?: string; +} + +export function operationDisplayDeserializer(item: any): OperationDisplay { + return { + provider: item["provider"], + resource: item["resource"], + operation: item["operation"], + description: item["description"], + }; +} + +/** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ +export enum KnownOrigin { + /** Indicates the operation is initiated by a user. */ + User = "user", + /** Indicates the operation is initiated by a system. */ + System = "system", + /** Indicates the operation is initiated by a user or system. */ + UserSystem = "user,system", +} + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" \ + * {@link KnownOrigin} can be used interchangeably with Origin, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **user**: Indicates the operation is initiated by a user. \ + * **system**: Indicates the operation is initiated by a system. \ + * **user,system**: Indicates the operation is initiated by a user or system. + */ +export type Origin = string; + +/** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ +export enum KnownActionType { + /** Actions are for internal-only APIs. */ + Internal = "Internal", +} + +/** + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. \ + * {@link KnownActionType} can be used interchangeably with ActionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Internal**: Actions are for internal-only APIs. + */ +export type ActionType = string; + +/** A budget resource. */ +export interface Budget extends ExtensionResource { + /** eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. */ + eTag?: string; + /** + * The category of the budget. + * - 'Cost' defines a Budget. + * - 'ReservationUtilization' defines a Reservation Utilization Alert Rule. + */ + category?: CategoryType; + /** + * The total amount of cost to track with the budget. + * + * Supported for CategoryType(s): Cost. + * + * Required for CategoryType(s): Cost. + */ + amount?: number; + /** + * The time covered by a budget. Tracking of the amount will be reset based on the time grain. + * + * Supported for CategoryType(s): Cost, ReservationUtilization. + * + * Supported timeGrainTypes for **CategoryType: Cost** + * + * - Monthly + * - Quarterly + * - Annually + * - BillingMonth* + * - BillingQuarter* + * - BillingAnnual* + * + * *only supported for Web Direct customers. + * + * Supported timeGrainTypes for **CategoryType: ReservationUtilization** + * - Last7Days + * - Last30Days + * + * Required for CategoryType(s): Cost, ReservationUtilization. + */ + timeGrain?: TimeGrainType; + /** + * The time period that defines the active period of the budget. The budget will evaluate data on or after the startDate and will expire on the endDate. + * + * Supported for CategoryType(s): Cost, ReservationUtilization. + * + * Required for CategoryType(s): Cost, ReservationUtilization. + */ + timePeriod?: BudgetTimePeriod; + /** + * May be used to filter budgets by user-specified dimensions and/or tags. + * + * Supported for CategoryType(s): Cost, ReservationUtilization. + */ + filter?: BudgetFilter; + /** + * The current amount of cost which is being tracked for a budget. + * + * Supported for CategoryType(s): Cost. + */ + readonly currentSpend?: CurrentSpend; + /** + * Dictionary of notifications associated with the budget. + * + * Supported for CategoryType(s): Cost, ReservationUtilization. + * + * - Constraints for **CategoryType: Cost** - Budget can have up to 5 notifications with thresholdType: Actual and 5 notifications with thresholdType: Forecasted. + * - Constraints for **CategoryType: ReservationUtilization** - Only one notification allowed. thresholdType is not applicable. + */ + notifications?: Record; + /** + * The forecasted cost which is being tracked for a budget. + * + * Supported for CategoryType(s): Cost. + */ + readonly forecastSpend?: ForecastSpend; +} + +export function budgetSerializer(item: Budget): any { + return { + properties: areAllPropsUndefined(item, [ + "category", + "amount", + "timeGrain", + "timePeriod", + "filter", + "notifications", + ]) + ? undefined + : _budgetPropertiesSerializer(item), + eTag: item["eTag"], + }; +} + +export function budgetDeserializer(item: any): Budget { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : _budgetPropertiesDeserializer(item["properties"])), + eTag: item["eTag"], + }; +} + +/** The properties of the budget. */ +export interface BudgetProperties { + /** + * The category of the budget. + * - 'Cost' defines a Budget. + * - 'ReservationUtilization' defines a Reservation Utilization Alert Rule. + */ + category: CategoryType; + /** + * The total amount of cost to track with the budget. + * + * Supported for CategoryType(s): Cost. + * + * Required for CategoryType(s): Cost. + */ + amount?: number; + /** + * The time covered by a budget. Tracking of the amount will be reset based on the time grain. + * + * Supported for CategoryType(s): Cost, ReservationUtilization. + * + * Supported timeGrainTypes for **CategoryType: Cost** + * + * - Monthly + * - Quarterly + * - Annually + * - BillingMonth* + * - BillingQuarter* + * - BillingAnnual* + * + * *only supported for Web Direct customers. + * + * Supported timeGrainTypes for **CategoryType: ReservationUtilization** + * - Last7Days + * - Last30Days + * + * Required for CategoryType(s): Cost, ReservationUtilization. + */ + timeGrain: TimeGrainType; + /** + * The time period that defines the active period of the budget. The budget will evaluate data on or after the startDate and will expire on the endDate. + * + * Supported for CategoryType(s): Cost, ReservationUtilization. + * + * Required for CategoryType(s): Cost, ReservationUtilization. + */ + timePeriod: BudgetTimePeriod; + /** + * May be used to filter budgets by user-specified dimensions and/or tags. + * + * Supported for CategoryType(s): Cost, ReservationUtilization. + */ + filter?: BudgetFilter; + /** + * The current amount of cost which is being tracked for a budget. + * + * Supported for CategoryType(s): Cost. + */ + readonly currentSpend?: CurrentSpend; + /** + * Dictionary of notifications associated with the budget. + * + * Supported for CategoryType(s): Cost, ReservationUtilization. + * + * - Constraints for **CategoryType: Cost** - Budget can have up to 5 notifications with thresholdType: Actual and 5 notifications with thresholdType: Forecasted. + * - Constraints for **CategoryType: ReservationUtilization** - Only one notification allowed. thresholdType is not applicable. + */ + notifications?: Record; + /** + * The forecasted cost which is being tracked for a budget. + * + * Supported for CategoryType(s): Cost. + */ + readonly forecastSpend?: ForecastSpend; +} + +export function budgetPropertiesSerializer(item: BudgetProperties): any { + return { + category: item["category"], + amount: item["amount"], + timeGrain: item["timeGrain"], + timePeriod: budgetTimePeriodSerializer(item["timePeriod"]), + filter: !item["filter"] ? item["filter"] : budgetFilterSerializer(item["filter"]), + notifications: !item["notifications"] + ? item["notifications"] + : notificationRecordSerializer(item["notifications"]), + }; +} + +export function budgetPropertiesDeserializer(item: any): BudgetProperties { + return { + category: item["category"], + amount: item["amount"], + timeGrain: item["timeGrain"], + timePeriod: budgetTimePeriodDeserializer(item["timePeriod"]), + filter: !item["filter"] ? item["filter"] : budgetFilterDeserializer(item["filter"]), + currentSpend: !item["currentSpend"] + ? item["currentSpend"] + : currentSpendDeserializer(item["currentSpend"]), + notifications: !item["notifications"] + ? item["notifications"] + : notificationRecordDeserializer(item["notifications"]), + forecastSpend: !item["forecastSpend"] + ? item["forecastSpend"] + : forecastSpendDeserializer(item["forecastSpend"]), + }; +} + +/** + * The category of the budget. + * - 'Cost' defines a Budget. + * - 'ReservationUtilization' defines a Reservation Utilization Alert Rule. + */ +export enum KnownCategoryType { + /** A Budget that evaluates monetary cost of Azure resources against an amount, and alerts based on a configured notification threshold. */ + Cost = "Cost", + /** An Alert Rule that evaluates the utilization percentage of Azure Reservations, and alerts based on a configured notification threshold. */ + ReservationUtilization = "ReservationUtilization", +} + +/** + * The category of the budget. + * - 'Cost' defines a Budget. + * - 'ReservationUtilization' defines a Reservation Utilization Alert Rule. \ + * {@link KnownCategoryType} can be used interchangeably with CategoryType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Cost**: A Budget that evaluates monetary cost of Azure resources against an amount, and alerts based on a configured notification threshold. \ + * **ReservationUtilization**: An Alert Rule that evaluates the utilization percentage of Azure Reservations, and alerts based on a configured notification threshold. + */ +export type CategoryType = string; + +/** + * The time covered by a budget. Tracking of the amount will be reset based on the time grain. + * + * Supported for CategoryType(s): Cost, ReservationUtilization. + * + * Supported timeGrainTypes for **CategoryType: Cost** + * + * - Monthly + * - Quarterly + * - Annually + * - BillingMonth* + * - BillingQuarter* + * - BillingAnnual* + * + * *only supported for Web Direct customers. + * + * Supported timeGrainTypes for **CategoryType: ReservationUtilization** + * - Last7Days + * - Last30Days + * + * Required for CategoryType(s): Cost, ReservationUtilization. + */ +export enum KnownTimeGrainType { + /** + * The budget will track costs in the current calendar month against the amount. + * + * Supported for CategoryType: Cost only. + */ + Monthly = "Monthly", + /** + * The budget will track costs in the current calendar quarter against the amount. + * + * Supported for CategoryType: Cost only. + */ + Quarterly = "Quarterly", + /** + * The budget will track costs in the current calendar year against the amount. + * + * Supported for CategoryType: Cost only. + */ + Annually = "Annually", + /** + * The budget will track costs in the current billing month against the amount. + * + * Supported for CategoryType: Cost and Web Direct customers only. + */ + BillingMonth = "BillingMonth", + /** + * The budget will track costs in the current billing quarter against the amount. + * + * Supported for CategoryType: Cost and Web Direct customers only. + */ + BillingQuarter = "BillingQuarter", + /** + * The budget will track costs in the current billing year against the amount. + * + * Supported for CategoryType: Cost and Web Direct customers only. + */ + BillingAnnual = "BillingAnnual", + /** + * The Reservation Utilization Alert Rule will evaluate reservations based on their 7-Day utilization percentage. + * + * Supported for CategoryType: ReservationUtilization only. + */ + Last7Days = "Last7Days", + /** + * The Reservation Utilization Alert Rule will evaluate reservations based on their 30-Day utilization percentage. + * + * Supported for CategoryType: ReservationUtilization only. + */ + Last30Days = "Last30Days", +} + +/** + * The time covered by a budget. Tracking of the amount will be reset based on the time grain. + * + * Supported for CategoryType(s): Cost, ReservationUtilization. + * + * Supported timeGrainTypes for **CategoryType: Cost** + * + * - Monthly + * - Quarterly + * - Annually + * - BillingMonth* + * - BillingQuarter* + * - BillingAnnual* + * + * *only supported for Web Direct customers. + * + * Supported timeGrainTypes for **CategoryType: ReservationUtilization** + * - Last7Days + * - Last30Days + * + * Required for CategoryType(s): Cost, ReservationUtilization. \ + * {@link KnownTimeGrainType} can be used interchangeably with TimeGrainType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Monthly**: The budget will track costs in the current calendar month against the amount. + * + * Supported for CategoryType: Cost only. \ + * **Quarterly**: The budget will track costs in the current calendar quarter against the amount. + * + * Supported for CategoryType: Cost only. \ + * **Annually**: The budget will track costs in the current calendar year against the amount. + * + * Supported for CategoryType: Cost only. \ + * **BillingMonth**: The budget will track costs in the current billing month against the amount. + * + * Supported for CategoryType: Cost and Web Direct customers only. \ + * **BillingQuarter**: The budget will track costs in the current billing quarter against the amount. + * + * Supported for CategoryType: Cost and Web Direct customers only. \ + * **BillingAnnual**: The budget will track costs in the current billing year against the amount. + * + * Supported for CategoryType: Cost and Web Direct customers only. \ + * **Last7Days**: The Reservation Utilization Alert Rule will evaluate reservations based on their 7-Day utilization percentage. + * + * Supported for CategoryType: ReservationUtilization only. \ + * **Last30Days**: The Reservation Utilization Alert Rule will evaluate reservations based on their 30-Day utilization percentage. + * + * Supported for CategoryType: ReservationUtilization only. + */ +export type TimeGrainType = string; + +/** + * The time period that defines the active period of the budget. The budget will evaluate data on or after the startDate and will expire on the endDate. + * + * Supported for CategoryType(s): Cost, ReservationUtilization. + * + * Required for CategoryType(s): Cost, ReservationUtilization. + */ +export interface BudgetTimePeriod { + /** + * The start date for the budget. + * + * - Constraints for **CategoryType: Cost** - Must be first of the month and should be less than the end date. Budget start date must be on or after June 1, 2017. Future start date should not be more than twelve months. Past start date should be selected within the timegrain period. + * + * - Constraints for **CategoryType: ReservationUtilization** - Must be on or after the current date and less than the end date. + */ + startDate: Date; + /** + * The end date for the budget. + * + * - Constraints for **CategoryType: Cost** - No constraints. If not provided, we default this to 10 years from the start date. + * + * - Constraints for **CategoryType: ReservationUtilization** - End date cannot be more than 3 years after the start date. + */ + endDate?: Date; +} + +export function budgetTimePeriodSerializer(item: BudgetTimePeriod): any { + return { + startDate: item["startDate"].toISOString(), + endDate: !item["endDate"] ? item["endDate"] : item["endDate"].toISOString(), + }; +} + +export function budgetTimePeriodDeserializer(item: any): BudgetTimePeriod { + return { + startDate: new Date(item["startDate"]), + endDate: !item["endDate"] ? item["endDate"] : new Date(item["endDate"]), + }; +} + +/** + * May be used to filter budgets by user-specified dimensions and/or tags. + * + * Supported for CategoryType(s): Cost, ReservationUtilization. + */ +export interface BudgetFilter { + /** + * The logical "AND" expression. Must have at least 2 items. + * + * Supported for CategoryType(s): Cost. + */ + and?: BudgetFilterProperties[]; + /** + * Has comparison expression for a dimension. + * + * Supported for CategoryType(s): Cost, ReservationUtilization. + * + * Supported dimension names for **CategoryType: ReservationUtilization** + * - ReservationId + * - ReservedResourceType + */ + dimensions?: BudgetComparisonExpression; + /** + * Has comparison expression for a tag. + * + * Supported for CategoryType(s): Cost. + */ + tags?: BudgetComparisonExpression; +} + +export function budgetFilterSerializer(item: BudgetFilter): any { + return { + and: !item["and"] ? item["and"] : budgetFilterPropertiesArraySerializer(item["and"]), + dimensions: !item["dimensions"] + ? item["dimensions"] + : budgetComparisonExpressionSerializer(item["dimensions"]), + tags: !item["tags"] ? item["tags"] : budgetComparisonExpressionSerializer(item["tags"]), + }; +} + +export function budgetFilterDeserializer(item: any): BudgetFilter { + return { + and: !item["and"] ? item["and"] : budgetFilterPropertiesArrayDeserializer(item["and"]), + dimensions: !item["dimensions"] + ? item["dimensions"] + : budgetComparisonExpressionDeserializer(item["dimensions"]), + tags: !item["tags"] ? item["tags"] : budgetComparisonExpressionDeserializer(item["tags"]), + }; +} + +export function budgetFilterPropertiesArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return budgetFilterPropertiesSerializer(item); + }); +} + +export function budgetFilterPropertiesArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return budgetFilterPropertiesDeserializer(item); + }); +} + +/** + * The Dimensions or Tags to filter a budget by. + * + * Supported for CategoryType(s): Cost, ReservationUtilization. + */ +export interface BudgetFilterProperties { + /** + * Has comparison expression for a dimension. + * + * Supported for CategoryType(s): Cost, ReservationUtilization. + * + * Supported dimension names for **CategoryType: ReservationUtilization** + * - ReservationId + * - ReservedResourceType + */ + dimensions?: BudgetComparisonExpression; + /** + * Has comparison expression for a tag. + * + * Supported for CategoryType(s): Cost. + */ + tags?: BudgetComparisonExpression; +} + +export function budgetFilterPropertiesSerializer(item: BudgetFilterProperties): any { + return { + dimensions: !item["dimensions"] + ? item["dimensions"] + : budgetComparisonExpressionSerializer(item["dimensions"]), + tags: !item["tags"] ? item["tags"] : budgetComparisonExpressionSerializer(item["tags"]), + }; +} + +export function budgetFilterPropertiesDeserializer(item: any): BudgetFilterProperties { + return { + dimensions: !item["dimensions"] + ? item["dimensions"] + : budgetComparisonExpressionDeserializer(item["dimensions"]), + tags: !item["tags"] ? item["tags"] : budgetComparisonExpressionDeserializer(item["tags"]), + }; +} + +/** The comparison expression to be used in the budgets. */ +export interface BudgetComparisonExpression { + /** The name of the column to use in comparison. */ + name: string; + /** The operator to use for comparison. */ + operator: BudgetOperatorType; + /** Array of values to use for comparison */ + values: string[]; +} + +export function budgetComparisonExpressionSerializer(item: BudgetComparisonExpression): any { + return { + name: item["name"], + operator: item["operator"], + values: item["values"].map((p: any) => { + return p; + }), + }; +} + +export function budgetComparisonExpressionDeserializer(item: any): BudgetComparisonExpression { + return { + name: item["name"], + operator: item["operator"], + values: item["values"].map((p: any) => { + return p; + }), + }; +} + +/** The operator to use for comparison. */ +export enum KnownBudgetOperatorType { + /** In */ + In = "In", +} + +/** + * The operator to use for comparison. \ + * {@link KnownBudgetOperatorType} can be used interchangeably with BudgetOperatorType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **In** + */ +export type BudgetOperatorType = string; + +/** + * The current amount of cost which is being tracked for a budget. + * + * Supported for CategoryType(s): Cost. + */ +export interface CurrentSpend { + /** The total amount of cost which is being tracked by the budget. */ + readonly amount?: number; + /** The unit of measure for the budget amount. */ + readonly unit?: string; +} + +export function currentSpendDeserializer(item: any): CurrentSpend { + return { + amount: item["amount"], + unit: item["unit"], + }; +} + +export function notificationRecordSerializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : notificationSerializer(item[key]); + }); + return result; +} + +export function notificationRecordDeserializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : notificationDeserializer(item[key]); + }); + return result; +} + +/** + * The notification associated with a budget. + * + * Supported for CategoryType(s): Cost, ReservationUtilization. + */ +export interface Notification { + /** + * The notification is enabled or not. + * + * Supported for CategoryType(s): Cost, ReservationUtilization. + */ + enabled: boolean; + /** + * The comparison operator. + * + * Supported for CategoryType(s): Cost, ReservationUtilization. + * + * Supported operators for **CategoryType: Cost** + * - GreaterThan + * - GreaterThanOrEqualTo + * + * Supported operators for **CategoryType: ReservationUtilization** + * - LessThan + */ + operator: BudgetNotificationOperatorType; + /** + * Threshold value associated with a notification. It is always percent with a maximum of 2 decimal places. + * + * Supported for CategoryType(s): Cost, ReservationUtilization. + * + * **CategoryType: Cost** - Must be between 0 and 1000. Notification is sent when the cost exceeded the threshold. + * + * **CategoryType: ReservationUtilization** - Must be between 0 and 100. Notification is sent when a reservation has a utilization percentage below the threshold. + */ + threshold: number; + /** + * Frequency of a notification. Represents how long the notification will be silent after triggering an alert for a threshold breach. If not specified, the frequency will be set by default based on the timeGrain (Weekly when timeGrain: Last7Days, Monthly when timeGrain: Last30Days). + * + * Supported for CategoryType(s): ReservationUtilization. + */ + frequency?: Frequency; + /** + * Email addresses to send the notification to when the threshold is breached. Must have at least one contact email or contact group specified at the Subscription or Resource Group scopes. All other scopes must have at least one contact email specified. + * + * Supported for CategoryType(s): Cost, ReservationUtilization. + */ + contactEmails: string[]; + /** + * Subscription or Resource Group scopes only. Contact roles to send the notification to when the threshold is breached. + * + * Supported for CategoryType(s): Cost. + */ + contactRoles?: string[]; + /** + * Subscription or Resource Group scopes only. Action groups to send the notification to when the threshold is exceeded. Must be provided as a fully qualified Azure resource id. + * + * Supported for CategoryType(s): Cost. + */ + contactGroups?: string[]; + /** + * The type of threshold. + * + * Supported for CategoryType(s): Cost. + */ + thresholdType?: ThresholdType; + /** + * Language in which the recipient will receive the notification, + * + * Supported for CategoryType(s): Cost, ReservationUtilization. + */ + locale?: CultureCode; +} + +export function notificationSerializer(item: Notification): any { + return { + enabled: item["enabled"], + operator: item["operator"], + threshold: item["threshold"], + frequency: item["frequency"], + contactEmails: item["contactEmails"].map((p: any) => { + return p; + }), + contactRoles: !item["contactRoles"] + ? item["contactRoles"] + : item["contactRoles"].map((p: any) => { + return p; + }), + contactGroups: !item["contactGroups"] + ? item["contactGroups"] + : item["contactGroups"].map((p: any) => { + return p; + }), + thresholdType: item["thresholdType"], + locale: item["locale"], + }; +} + +export function notificationDeserializer(item: any): Notification { + return { + enabled: item["enabled"], + operator: item["operator"], + threshold: item["threshold"], + frequency: item["frequency"], + contactEmails: item["contactEmails"].map((p: any) => { + return p; + }), + contactRoles: !item["contactRoles"] + ? item["contactRoles"] + : item["contactRoles"].map((p: any) => { + return p; + }), + contactGroups: !item["contactGroups"] + ? item["contactGroups"] + : item["contactGroups"].map((p: any) => { + return p; + }), + thresholdType: item["thresholdType"], + locale: item["locale"], + }; +} + +/** + * The comparison operator. + * + * Supported for CategoryType(s): Cost, ReservationUtilization. + * + * Supported operators for **CategoryType: Cost** + * - GreaterThan + * - GreaterThanOrEqualTo + * + * Supported operators for **CategoryType: ReservationUtilization** + * - LessThan + */ +export enum KnownBudgetNotificationOperatorType { + /** + * Notification will be triggered if the evaluated cost is the same as threshold value. Note: It’s not recommended to use this OperatorType as there’s low chance of cost being exactly the same as threshold value, leading to missing of your alert. This OperatorType will be deprecated in future. + * + * Supported for CategoryType(s): Cost. + */ + EqualTo = "EqualTo", + /** + * Notification will be triggered if the evaluated cost is greater than the threshold value. Note: This is the recommended OperatorType while configuring Budget Alert. + * + * Supported for CategoryType(s): Cost. + */ + GreaterThan = "GreaterThan", + /** + * Notification will be triggered if the evaluated cost is greater than or equal to the threshold value. + * + * Supported for CategoryType(s): Cost. + */ + GreaterThanOrEqualTo = "GreaterThanOrEqualTo", + /** + * Notification will be triggered if any Reservations in the scope of the Reservation Utilization Alert Rule have a utilization less than the threshold percentage. + * + * Supported for CategoryType(s): ReservationUtilization. + */ + LessThan = "LessThan", +} + +/** + * The comparison operator. + * + * Supported for CategoryType(s): Cost, ReservationUtilization. + * + * Supported operators for **CategoryType: Cost** + * - GreaterThan + * - GreaterThanOrEqualTo + * + * Supported operators for **CategoryType: ReservationUtilization** + * - LessThan \ + * {@link KnownBudgetNotificationOperatorType} can be used interchangeably with BudgetNotificationOperatorType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **EqualTo**: Notification will be triggered if the evaluated cost is the same as threshold value. Note: It’s not recommended to use this OperatorType as there’s low chance of cost being exactly the same as threshold value, leading to missing of your alert. This OperatorType will be deprecated in future. + * + * Supported for CategoryType(s): Cost. \ + * **GreaterThan**: Notification will be triggered if the evaluated cost is greater than the threshold value. Note: This is the recommended OperatorType while configuring Budget Alert. + * + * Supported for CategoryType(s): Cost. \ + * **GreaterThanOrEqualTo**: Notification will be triggered if the evaluated cost is greater than or equal to the threshold value. + * + * Supported for CategoryType(s): Cost. \ + * **LessThan**: Notification will be triggered if any Reservations in the scope of the Reservation Utilization Alert Rule have a utilization less than the threshold percentage. + * + * Supported for CategoryType(s): ReservationUtilization. + */ +export type BudgetNotificationOperatorType = string; + +/** + * Frequency of a notification. Represents how long the notification will be silent after triggering an alert for a threshold breach. If not specified, the frequency will be set by default based on the timeGrain (Weekly when timeGrain: Last7Days, Monthly when timeGrain: Last30Days). + * + * Supported for CategoryType(s): ReservationUtilization. + */ +export enum KnownFrequency { + /** After the threshold breaches and an Alert is fired, no further alerts will be sent until the next calendar day. */ + Daily = "Daily", + /** After the threshold breaches and an Alert is fired, no further alerts will be sent for 7 calendar days. */ + Weekly = "Weekly", + /** After the threshold breaches and an Alert is fired, no further alerts will be sent for 30 calendar days. */ + Monthly = "Monthly", +} + +/** + * Frequency of a notification. Represents how long the notification will be silent after triggering an alert for a threshold breach. If not specified, the frequency will be set by default based on the timeGrain (Weekly when timeGrain: Last7Days, Monthly when timeGrain: Last30Days). + * + * Supported for CategoryType(s): ReservationUtilization. \ + * {@link KnownFrequency} can be used interchangeably with Frequency, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Daily**: After the threshold breaches and an Alert is fired, no further alerts will be sent until the next calendar day. \ + * **Weekly**: After the threshold breaches and an Alert is fired, no further alerts will be sent for 7 calendar days. \ + * **Monthly**: After the threshold breaches and an Alert is fired, no further alerts will be sent for 30 calendar days. + */ +export type Frequency = string; + +/** + * The type of threshold. + * + * Supported for CategoryType(s): Cost. + */ +export enum KnownThresholdType { + /** Actual costs budget alerts notify when the actual accrued cost exceeds the allocated budget. */ + Actual = "Actual", + /** Forecasted costs budget alerts provide advanced notification that your spending trends are likely to exceed your allocated budget, as it relies on forecasted cost predictions. */ + Forecasted = "Forecasted", +} + +/** + * The type of threshold. + * + * Supported for CategoryType(s): Cost. \ + * {@link KnownThresholdType} can be used interchangeably with ThresholdType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Actual**: Actual costs budget alerts notify when the actual accrued cost exceeds the allocated budget. \ + * **Forecasted**: Forecasted costs budget alerts provide advanced notification that your spending trends are likely to exceed your allocated budget, as it relies on forecasted cost predictions. + */ +export type ThresholdType = string; + +/** + * Language in which the recipient will receive the notification, + * + * Supported for CategoryType(s): Cost, ReservationUtilization. + */ +export enum KnownCultureCode { + /** en-us */ + EnUs = "en-us", + /** ja-jp */ + JaJp = "ja-jp", + /** zh-cn */ + ZhCn = "zh-cn", + /** de-de */ + DeDe = "de-de", + /** es-es */ + EsEs = "es-es", + /** fr-fr */ + FrFr = "fr-fr", + /** it-it */ + ItIt = "it-it", + /** ko-kr */ + KoKr = "ko-kr", + /** pt-br */ + PtBr = "pt-br", + /** ru-ru */ + RuRu = "ru-ru", + /** zh-tw */ + ZhTw = "zh-tw", + /** cs-cz */ + CsCz = "cs-cz", + /** pl-pl */ + PlPl = "pl-pl", + /** tr-tr */ + TrTr = "tr-tr", + /** da-dk */ + DaDk = "da-dk", + /** en-gb */ + EnGb = "en-gb", + /** hu-hu */ + HuHu = "hu-hu", + /** nb-no */ + NbNo = "nb-no", + /** nl-nl */ + NlNl = "nl-nl", + /** pt-pt */ + PtPt = "pt-pt", + /** sv-se */ + SvSe = "sv-se", +} + +/** + * Language in which the recipient will receive the notification, + * + * Supported for CategoryType(s): Cost, ReservationUtilization. \ + * {@link KnownCultureCode} can be used interchangeably with CultureCode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **en-us** \ + * **ja-jp** \ + * **zh-cn** \ + * **de-de** \ + * **es-es** \ + * **fr-fr** \ + * **it-it** \ + * **ko-kr** \ + * **pt-br** \ + * **ru-ru** \ + * **zh-tw** \ + * **cs-cz** \ + * **pl-pl** \ + * **tr-tr** \ + * **da-dk** \ + * **en-gb** \ + * **hu-hu** \ + * **nb-no** \ + * **nl-nl** \ + * **pt-pt** \ + * **sv-se** + */ +export type CultureCode = string; + +/** + * The forecasted cost which is being tracked for a budget. + * + * Supported for CategoryType(s): Cost. + */ +export interface ForecastSpend { + /** The forecasted cost for the total time period which is being tracked by the budget. This value is only provided if the budget contains a forecast alert type. */ + readonly amount?: number; + /** The unit of measure for the budget amount. */ + readonly unit?: string; +} + +export function forecastSpendDeserializer(item: any): ForecastSpend { + return { + amount: item["amount"], + unit: item["unit"], + }; +} + +/** Result of listing budgets. It contains a list of available budgets in the scope provided. */ +export interface _BudgetsListResult { + /** The list of budgets. */ + readonly value?: Budget[]; + /** The link (url) to the next page of results.\r\nIt's null for now, added for future use. */ + nextLink?: string; +} + +export function _budgetsListResultDeserializer(item: any): _BudgetsListResult { + return { + value: !item["value"] ? item["value"] : budgetArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function budgetArraySerializer(result: Array): any[] { + return result.map((item) => { + return budgetSerializer(item); + }); +} + +export function budgetArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return budgetDeserializer(item); + }); +} + +/** An export resource. */ +export interface Export extends ExtensionResource { + /** The managed identity associated with Export */ + identity?: SystemAssignedServiceIdentity; + /** The location of the Export's managed identity. Only required when utilizing managed identity. */ + location?: string; + /** eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. */ + eTag?: string; + /** The format of the export being delivered. */ + format?: FormatType; + /** Has delivery information for the export. */ + deliveryInfo?: ExportDeliveryInfo; + /** Has the definition for the export. */ + definition?: ExportDefinition; + /** If requested, has the most recent run history for the export. */ + runHistory?: ExportExecutionListResult; + /** If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. */ + partitionData?: boolean; + /** Allow customers to select overwrite data(OverwritePreviousReport) for exports. This setting will enable overwrite data for the same month in customer storage account. By default set to CreateNewReport. */ + dataOverwriteBehavior?: DataOverwriteBehaviorType; + /** Allow customers to select compress data for exports. This setting will enable destination file compression scheme at runtime. By default set to None. Gzip is for csv and snappy for parquet. */ + compressionMode?: CompressionModeType; + /** The export description set by customer at time of export creation/update. */ + exportDescription?: string; + /** If the export has an active schedule, provides an estimate of the next run time. */ + readonly nextRunTimeEstimate?: Date; + /** The export suspension reason if export is in SystemSuspended state. This is not populated currently. */ + readonly systemSuspensionContext?: ExportSuspensionContext; + /** Has schedule information for the export. */ + schedule?: ExportSchedule; +} + +export function exportSerializer(item: Export): any { + return { + properties: areAllPropsUndefined(item, [ + "format", + "deliveryInfo", + "definition", + "runHistory", + "partitionData", + "dataOverwriteBehavior", + "compressionMode", + "exportDescription", + "schedule", + ]) + ? undefined + : _exportPropertiesSerializer(item), + identity: !item["identity"] + ? item["identity"] + : systemAssignedServiceIdentitySerializer(item["identity"]), + location: item["location"], + eTag: item["eTag"], + }; +} + +export function exportDeserializer(item: any): Export { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : _exportPropertiesDeserializer(item["properties"])), + identity: !item["identity"] + ? item["identity"] + : systemAssignedServiceIdentityDeserializer(item["identity"]), + location: item["location"], + eTag: item["eTag"], + }; +} + +/** The properties of the export. */ +export interface ExportProperties extends CommonExportProperties { + /** Has schedule information for the export. */ + schedule?: ExportSchedule; +} + +export function exportPropertiesSerializer(item: ExportProperties): any { + return { + format: item["format"], + deliveryInfo: exportDeliveryInfoSerializer(item["deliveryInfo"]), + definition: exportDefinitionSerializer(item["definition"]), + runHistory: !item["runHistory"] + ? item["runHistory"] + : exportExecutionListResultSerializer(item["runHistory"]), + partitionData: item["partitionData"], + dataOverwriteBehavior: item["dataOverwriteBehavior"], + compressionMode: item["compressionMode"], + exportDescription: item["exportDescription"], + schedule: !item["schedule"] ? item["schedule"] : exportScheduleSerializer(item["schedule"]), + }; +} + +export function exportPropertiesDeserializer(item: any): ExportProperties { + return { + format: item["format"], + deliveryInfo: exportDeliveryInfoDeserializer(item["deliveryInfo"]), + definition: exportDefinitionDeserializer(item["definition"]), + runHistory: !item["runHistory"] + ? item["runHistory"] + : exportExecutionListResultDeserializer(item["runHistory"]), + partitionData: item["partitionData"], + dataOverwriteBehavior: item["dataOverwriteBehavior"], + compressionMode: item["compressionMode"], + exportDescription: item["exportDescription"], + nextRunTimeEstimate: !item["nextRunTimeEstimate"] + ? item["nextRunTimeEstimate"] + : new Date(item["nextRunTimeEstimate"]), + systemSuspensionContext: !item["systemSuspensionContext"] + ? item["systemSuspensionContext"] + : exportSuspensionContextDeserializer(item["systemSuspensionContext"]), + schedule: !item["schedule"] ? item["schedule"] : exportScheduleDeserializer(item["schedule"]), + }; +} + +/** The schedule associated with the export. */ +export interface ExportSchedule { + /** The status of the export's schedule. If 'Inactive', the export's schedule is paused. To enable export set the status to be Active and then make a PUT request. */ + status?: StatusType; + /** The schedule recurrence. */ + recurrence?: RecurrenceType; + /** 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; +} + +export function exportScheduleSerializer(item: ExportSchedule): any { + return { + status: item["status"], + recurrence: item["recurrence"], + recurrencePeriod: !item["recurrencePeriod"] + ? item["recurrencePeriod"] + : exportRecurrencePeriodSerializer(item["recurrencePeriod"]), + }; +} + +export function exportScheduleDeserializer(item: any): ExportSchedule { + return { + status: item["status"], + recurrence: item["recurrence"], + recurrencePeriod: !item["recurrencePeriod"] + ? item["recurrencePeriod"] + : exportRecurrencePeriodDeserializer(item["recurrencePeriod"]), + }; +} + +/** The status of the export's schedule. If 'Inactive', the export's schedule is paused. To enable export set the status to be Active and then make a PUT request. */ +export enum KnownStatusType { + /** Active */ + Active = "Active", + /** Inactive */ + Inactive = "Inactive", +} + +/** + * The status of the export's schedule. If 'Inactive', the export's schedule is paused. To enable export set the status to be Active and then make a PUT request. \ + * {@link KnownStatusType} can be used interchangeably with StatusType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Active** \ + * **Inactive** + */ +export type StatusType = string; + +/** The schedule recurrence. */ +export enum KnownRecurrenceType { + /** Daily */ + Daily = "Daily", + /** Weekly */ + Weekly = "Weekly", + /** Monthly */ + Monthly = "Monthly", + /** Annually */ + Annually = "Annually", +} + +/** + * The schedule recurrence. \ + * {@link KnownRecurrenceType} can be used interchangeably with RecurrenceType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Daily** \ + * **Weekly** \ + * **Monthly** \ + * **Annually** + */ +export type RecurrenceType = string; + +/** The start and end date for recurrence schedule. */ +export interface ExportRecurrencePeriod { + /** The start date of recurrence. */ + from: Date; + /** The end date of recurrence. */ + to?: Date; +} + +export function exportRecurrencePeriodSerializer(item: ExportRecurrencePeriod): any { + return { + from: item["from"].toISOString(), + to: !item["to"] ? item["to"] : item["to"].toISOString(), + }; +} + +export function exportRecurrencePeriodDeserializer(item: any): ExportRecurrencePeriod { + return { + from: new Date(item["from"]), + to: !item["to"] ? item["to"] : new Date(item["to"]), + }; +} + +/** Managed service identity (either system assigned, or none) */ +export interface SystemAssignedServiceIdentity { + /** The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. */ + readonly principalId?: string; + /** The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. */ + readonly tenantId?: string; + /** The type of managed identity assigned to this resource. */ + type: SystemAssignedServiceIdentityType; +} + +export function systemAssignedServiceIdentitySerializer(item: SystemAssignedServiceIdentity): any { + return { type: item["type"] }; +} + +export function systemAssignedServiceIdentityDeserializer( + item: any, +): SystemAssignedServiceIdentity { + return { + principalId: item["principalId"], + tenantId: item["tenantId"], + type: item["type"], + }; +} + +/** Type of managed service identity (either system assigned, or none). */ +export enum KnownSystemAssignedServiceIdentityType { + /** No managed system identity. */ + None = "None", + /** System assigned managed system identity. */ + SystemAssigned = "SystemAssigned", +} + +/** + * Type of managed service identity (either system assigned, or none). \ + * {@link KnownSystemAssignedServiceIdentityType} can be used interchangeably with SystemAssignedServiceIdentityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None**: No managed system identity. \ + * **SystemAssigned**: System assigned managed system identity. + */ +export type SystemAssignedServiceIdentityType = string; + +/** The common properties of the export. */ +export interface CommonExportProperties { + /** The format of the export being delivered. */ + format?: FormatType; + /** Has delivery information for the export. */ + deliveryInfo: ExportDeliveryInfo; + /** Has the definition for the export. */ + definition: ExportDefinition; + /** If requested, has the most recent run history for the export. */ + runHistory?: ExportExecutionListResult; + /** If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. */ + partitionData?: boolean; + /** Allow customers to select overwrite data(OverwritePreviousReport) for exports. This setting will enable overwrite data for the same month in customer storage account. By default set to CreateNewReport. */ + dataOverwriteBehavior?: DataOverwriteBehaviorType; + /** Allow customers to select compress data for exports. This setting will enable destination file compression scheme at runtime. By default set to None. Gzip is for csv and snappy for parquet. */ + compressionMode?: CompressionModeType; + /** The export description set by customer at time of export creation/update. */ + exportDescription?: string; + /** If the export has an active schedule, provides an estimate of the next run time. */ + readonly nextRunTimeEstimate?: Date; + /** The export suspension reason if export is in SystemSuspended state. This is not populated currently. */ + readonly systemSuspensionContext?: ExportSuspensionContext; +} + +export function commonExportPropertiesSerializer(item: CommonExportProperties): any { + return { + format: item["format"], + deliveryInfo: exportDeliveryInfoSerializer(item["deliveryInfo"]), + definition: exportDefinitionSerializer(item["definition"]), + runHistory: !item["runHistory"] + ? item["runHistory"] + : exportExecutionListResultSerializer(item["runHistory"]), + partitionData: item["partitionData"], + dataOverwriteBehavior: item["dataOverwriteBehavior"], + compressionMode: item["compressionMode"], + exportDescription: item["exportDescription"], + }; +} + +export function commonExportPropertiesDeserializer(item: any): CommonExportProperties { + return { + format: item["format"], + deliveryInfo: exportDeliveryInfoDeserializer(item["deliveryInfo"]), + definition: exportDefinitionDeserializer(item["definition"]), + runHistory: !item["runHistory"] + ? item["runHistory"] + : exportExecutionListResultDeserializer(item["runHistory"]), + partitionData: item["partitionData"], + dataOverwriteBehavior: item["dataOverwriteBehavior"], + compressionMode: item["compressionMode"], + exportDescription: item["exportDescription"], + nextRunTimeEstimate: !item["nextRunTimeEstimate"] + ? item["nextRunTimeEstimate"] + : new Date(item["nextRunTimeEstimate"]), + systemSuspensionContext: !item["systemSuspensionContext"] + ? item["systemSuspensionContext"] + : exportSuspensionContextDeserializer(item["systemSuspensionContext"]), + }; +} + +/** The format of the export being delivered. */ +export enum KnownFormatType { + /** Csv */ + Csv = "Csv", + /** Parquet */ + Parquet = "Parquet", +} + +/** + * The format of the export being delivered. \ + * {@link KnownFormatType} can be used interchangeably with FormatType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Csv** \ + * **Parquet** + */ +export type FormatType = string; + +/** The delivery information associated with a export. */ +export interface ExportDeliveryInfo { + /** Has destination for the export being delivered. */ + destination: ExportDeliveryDestination; +} + +export function exportDeliveryInfoSerializer(item: ExportDeliveryInfo): any { + return { destination: exportDeliveryDestinationSerializer(item["destination"]) }; +} + +export function exportDeliveryInfoDeserializer(item: any): ExportDeliveryInfo { + return { + destination: exportDeliveryDestinationDeserializer(item["destination"]), + }; +} + +/** 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 ). */ +export interface ExportDeliveryDestination { + /** The export delivery destination type. Currently only 'AzureBlob' is supported. */ + type?: DestinationType; + /** 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; + /** The name of the container where exports will be uploaded. If the container does not exist it will be created. */ + container: string; + /** The name of the directory where exports will be uploaded. */ + rootFolderPath?: string; + /** 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; + /** 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; +} + +export function exportDeliveryDestinationSerializer(item: ExportDeliveryDestination): any { + return { + type: item["type"], + resourceId: item["resourceId"], + container: item["container"], + rootFolderPath: item["rootFolderPath"], + sasToken: item["sasToken"], + storageAccount: item["storageAccount"], + }; +} + +export function exportDeliveryDestinationDeserializer(item: any): ExportDeliveryDestination { + return { + type: item["type"], + resourceId: item["resourceId"], + container: item["container"], + rootFolderPath: item["rootFolderPath"], + sasToken: item["sasToken"], + storageAccount: item["storageAccount"], + }; +} + +/** The export delivery destination type. Currently only 'AzureBlob' is supported. */ +export enum KnownDestinationType { + /** AzureBlob */ + AzureBlob = "AzureBlob", +} + +/** + * The export delivery destination type. Currently only 'AzureBlob' is supported. \ + * {@link KnownDestinationType} can be used interchangeably with DestinationType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **AzureBlob** + */ +export type DestinationType = string; + +/** The definition of an export. */ +export interface ExportDefinition { + /** 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; + /** The time frame for pulling data for the export. If custom, then a specific time period must be provided. */ + timeframe: TimeframeType; + /** Has time period for pulling data for the export. */ + timePeriod?: ExportTimePeriod; + /** The definition for data in the export. */ + dataSet?: ExportDataset; +} + +export function exportDefinitionSerializer(item: ExportDefinition): any { + return { + type: item["type"], + timeframe: item["timeframe"], + timePeriod: !item["timePeriod"] + ? item["timePeriod"] + : exportTimePeriodSerializer(item["timePeriod"]), + dataSet: !item["dataSet"] ? item["dataSet"] : exportDatasetSerializer(item["dataSet"]), + }; +} + +export function exportDefinitionDeserializer(item: any): ExportDefinition { + return { + type: item["type"], + timeframe: item["timeframe"], + timePeriod: !item["timePeriod"] + ? item["timePeriod"] + : exportTimePeriodDeserializer(item["timePeriod"]), + dataSet: !item["dataSet"] ? item["dataSet"] : exportDatasetDeserializer(item["dataSet"]), + }; +} + +/** 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. */ +export enum KnownExportType { + /** Usage */ + Usage = "Usage", + /** ActualCost */ + ActualCost = "ActualCost", + /** AmortizedCost */ + AmortizedCost = "AmortizedCost", + /** FocusCost */ + FocusCost = "FocusCost", + /** PriceSheet */ + PriceSheet = "PriceSheet", + /** ReservationTransactions */ + ReservationTransactions = "ReservationTransactions", + /** ReservationRecommendations */ + ReservationRecommendations = "ReservationRecommendations", + /** ReservationDetails */ + ReservationDetails = "ReservationDetails", +} + +/** + * 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. \ + * {@link KnownExportType} can be used interchangeably with ExportType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Usage** \ + * **ActualCost** \ + * **AmortizedCost** \ + * **FocusCost** \ + * **PriceSheet** \ + * **ReservationTransactions** \ + * **ReservationRecommendations** \ + * **ReservationDetails** + */ +export type ExportType = string; + +/** The time frame for pulling data for the export. If custom, then a specific time period must be provided. */ +export enum KnownTimeframeType { + /** MonthToDate */ + MonthToDate = "MonthToDate", + /** BillingMonthToDate */ + BillingMonthToDate = "BillingMonthToDate", + /** TheLastMonth */ + TheLastMonth = "TheLastMonth", + /** TheLastBillingMonth */ + TheLastBillingMonth = "TheLastBillingMonth", + /** WeekToDate */ + WeekToDate = "WeekToDate", + /** Custom */ + Custom = "Custom", + /** TheCurrentMonth */ + TheCurrentMonth = "TheCurrentMonth", +} + +/** + * The time frame for pulling data for the export. If custom, then a specific time period must be provided. \ + * {@link KnownTimeframeType} can be used interchangeably with TimeframeType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **MonthToDate** \ + * **BillingMonthToDate** \ + * **TheLastMonth** \ + * **TheLastBillingMonth** \ + * **WeekToDate** \ + * **Custom** \ + * **TheCurrentMonth** + */ +export type TimeframeType = string; + +/** The date range for data in the export. This should only be specified with timeFrame set to 'Custom'. The maximum date range is 1 calendar month. */ +export interface ExportTimePeriod { + /** The start date for export data. */ + from: Date; + /** The end date for export data. */ + to: Date; +} + +export function exportTimePeriodSerializer(item: ExportTimePeriod): any { + return { from: item["from"].toISOString(), to: item["to"].toISOString() }; +} + +export function exportTimePeriodDeserializer(item: any): ExportTimePeriod { + return { + from: new Date(item["from"]), + to: new Date(item["to"]), + }; +} + +/** The definition for data in the export. */ +export interface ExportDataset { + /** The granularity of rows in the export. Currently 'Daily' is supported for most cases. */ + granularity?: GranularityType; + /** The export dataset configuration. */ + configuration?: ExportDatasetConfiguration; +} + +export function exportDatasetSerializer(item: ExportDataset): any { + return { + granularity: item["granularity"], + configuration: !item["configuration"] + ? item["configuration"] + : exportDatasetConfigurationSerializer(item["configuration"]), + }; +} + +export function exportDatasetDeserializer(item: any): ExportDataset { + return { + granularity: item["granularity"], + configuration: !item["configuration"] + ? item["configuration"] + : exportDatasetConfigurationDeserializer(item["configuration"]), + }; +} + +/** The granularity of rows in the export. Currently 'Daily' is supported for most cases. */ +export enum KnownGranularityType { + /** Daily */ + Daily = "Daily", + /** Monthly */ + Monthly = "Monthly", +} + +/** + * The granularity of rows in the export. Currently 'Daily' is supported for most cases. \ + * {@link KnownGranularityType} can be used interchangeably with GranularityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Daily** \ + * **Monthly** + */ +export type GranularityType = string; + +/** This is on path to deprecation and will not be supported going forward. */ +export interface ExportDatasetConfiguration { + /** 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[]; + /** The data version for the selected for the export. If not provided then the export will default to latest data version. */ + dataVersion?: string; + /** Filters associated with the data sets. */ + filters?: FilterItems[]; +} + +export function exportDatasetConfigurationSerializer(item: ExportDatasetConfiguration): any { + return { + columns: !item["columns"] + ? item["columns"] + : item["columns"].map((p: any) => { + return p; + }), + dataVersion: item["dataVersion"], + filters: !item["filters"] ? item["filters"] : filterItemsArraySerializer(item["filters"]), + }; +} + +export function exportDatasetConfigurationDeserializer(item: any): ExportDatasetConfiguration { + return { + columns: !item["columns"] + ? item["columns"] + : item["columns"].map((p: any) => { + return p; + }), + dataVersion: item["dataVersion"], + filters: !item["filters"] ? item["filters"] : filterItemsArrayDeserializer(item["filters"]), + }; +} + +export function filterItemsArraySerializer(result: Array): any[] { + return result.map((item) => { + return filterItemsSerializer(item); + }); +} + +export function filterItemsArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return filterItemsDeserializer(item); + }); +} + +/** Will contain the filter name and value to operate on. This is currently only supported for Export Definition type of ReservationRecommendations. */ +export interface FilterItems { + /** The name of the filter. This is currently only supported for Export Definition type of ReservationRecommendations. Supported names are ['ReservationScope', 'LookBackPeriod', 'ResourceType'] */ + name?: FilterItemNames; + /** Value to filter by. Currently values supported per name are, for 'ReservationScope' supported values are ['Single', 'Shared'], for 'LookBackPeriod' supported values are ['Last7Days', 'Last30Days', 'Last60Days'] and for 'ResourceType' supported values are ['VirtualMachines', 'SQLDatabases', 'PostgreSQL', 'ManagedDisk', 'MySQL', 'RedHat', 'MariaDB', 'RedisCache', 'CosmosDB', 'SqlDataWarehouse', 'SUSELinux', 'AppService', 'BlockBlob', 'AzureDataExplorer', 'VMwareCloudSimple']. */ + value?: string; +} + +export function filterItemsSerializer(item: FilterItems): any { + return { name: item["name"], value: item["value"] }; +} + +export function filterItemsDeserializer(item: any): FilterItems { + return { + name: item["name"], + value: item["value"], + }; +} + +/** The name of the filter. This is currently only supported for Export Definition type of ReservationRecommendations. Supported names are ['ReservationScope', 'LookBackPeriod', 'ResourceType'] */ +export enum KnownFilterItemNames { + /** ReservationScope */ + ReservationScope = "ReservationScope", + /** ResourceType */ + ResourceType = "ResourceType", + /** LookBackPeriod */ + LookBackPeriod = "LookBackPeriod", +} + +/** + * The name of the filter. This is currently only supported for Export Definition type of ReservationRecommendations. Supported names are ['ReservationScope', 'LookBackPeriod', 'ResourceType'] \ + * {@link KnownFilterItemNames} can be used interchangeably with FilterItemNames, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ReservationScope** \ + * **ResourceType** \ + * **LookBackPeriod** + */ +export type FilterItemNames = string; + +/** Result of listing the run history of an export. */ +export interface ExportExecutionListResult { + /** A list of export runs. */ + readonly value?: ExportRun[]; +} + +export function exportExecutionListResultSerializer(_item: ExportExecutionListResult): any { + return {}; +} + +export function exportExecutionListResultDeserializer(item: any): ExportExecutionListResult { + return { + value: !item["value"] ? item["value"] : exportRunArrayDeserializer(item["value"]), + }; +} + +export function exportRunArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return exportRunDeserializer(item); + }); +} + +/** An export run. */ +export interface ExportRun extends CostManagementProxyResource { + /** The type of the export run. */ + executionType?: ExecutionType; + /** The last known status of the export run. */ + status?: ExecutionStatus; + /** The identifier for the entity that triggered the export. For on-demand runs it is the user email. For scheduled runs it is 'System'. */ + submittedBy?: string; + /** The time when export was queued to be run. */ + submittedTime?: Date; + /** The time when export was picked up to be run. */ + processingStartTime?: Date; + /** The time when the export run finished. */ + processingEndTime?: Date; + /** The start datetime for the export. */ + startDate?: Date; + /** The end datetime for the export. */ + endDate?: Date; + /** The name of the exported file. */ + fileName?: string; + /** The manifest file location(URI location) for the exported files. */ + manifestFile?: string; + /** The export settings that were in effect for this run. */ + runSettings?: CommonExportProperties; + /** The details of any error. */ + error?: ErrorDetails; +} + +export function exportRunDeserializer(item: any): ExportRun { + return { + id: item["id"], + name: item["name"], + type: item["type"], + eTag: item["eTag"], + ...(!item["properties"] + ? item["properties"] + : _exportRunPropertiesDeserializer(item["properties"])), + }; +} + +/** The properties of the export run. */ +export interface ExportRunProperties { + /** The type of the export run. */ + executionType?: ExecutionType; + /** The last known status of the export run. */ + status?: ExecutionStatus; + /** The identifier for the entity that triggered the export. For on-demand runs it is the user email. For scheduled runs it is 'System'. */ + submittedBy?: string; + /** The time when export was queued to be run. */ + submittedTime?: Date; + /** The time when export was picked up to be run. */ + processingStartTime?: Date; + /** The time when the export run finished. */ + processingEndTime?: Date; + /** The start datetime for the export. */ + startDate?: Date; + /** The end datetime for the export. */ + endDate?: Date; + /** The name of the exported file. */ + fileName?: string; + /** The manifest file location(URI location) for the exported files. */ + manifestFile?: string; + /** The export settings that were in effect for this run. */ + runSettings?: CommonExportProperties; + /** The details of any error. */ + error?: ErrorDetails; +} + +export function exportRunPropertiesDeserializer(item: any): ExportRunProperties { + return { + executionType: item["executionType"], + status: item["status"], + submittedBy: item["submittedBy"], + submittedTime: !item["submittedTime"] ? item["submittedTime"] : new Date(item["submittedTime"]), + processingStartTime: !item["processingStartTime"] + ? item["processingStartTime"] + : new Date(item["processingStartTime"]), + processingEndTime: !item["processingEndTime"] + ? item["processingEndTime"] + : new Date(item["processingEndTime"]), + startDate: !item["startDate"] ? item["startDate"] : new Date(item["startDate"]), + endDate: !item["endDate"] ? item["endDate"] : new Date(item["endDate"]), + fileName: item["fileName"], + manifestFile: item["manifestFile"], + runSettings: !item["runSettings"] + ? item["runSettings"] + : commonExportPropertiesDeserializer(item["runSettings"]), + error: !item["error"] ? item["error"] : errorDetailsDeserializer(item["error"]), + }; +} + +/** The type of the export run. */ +export enum KnownExecutionType { + /** OnDemand */ + OnDemand = "OnDemand", + /** Scheduled */ + Scheduled = "Scheduled", +} + +/** + * The type of the export run. \ + * {@link KnownExecutionType} can be used interchangeably with ExecutionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **OnDemand** \ + * **Scheduled** + */ +export type ExecutionType = string; + +/** The last known status of the export run. */ +export enum KnownExecutionStatus { + /** Queued */ + Queued = "Queued", + /** InProgress */ + InProgress = "InProgress", + /** Completed */ + Completed = "Completed", + /** Failed */ + Failed = "Failed", + /** Timeout */ + Timeout = "Timeout", + /** NewDataNotAvailable */ + NewDataNotAvailable = "NewDataNotAvailable", + /** DataNotAvailable */ + DataNotAvailable = "DataNotAvailable", +} + +/** + * The last known status of the export run. \ + * {@link KnownExecutionStatus} can be used interchangeably with ExecutionStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Queued** \ + * **InProgress** \ + * **Completed** \ + * **Failed** \ + * **Timeout** \ + * **NewDataNotAvailable** \ + * **DataNotAvailable** + */ +export type ExecutionStatus = string; + +/** Allow customers to select overwrite data(OverwritePreviousReport) for exports. This setting will enable overwrite data for the same month in customer storage account. By default set to CreateNewReport. */ +export enum KnownDataOverwriteBehaviorType { + /** OverwritePreviousReport */ + OverwritePreviousReport = "OverwritePreviousReport", + /** CreateNewReport */ + CreateNewReport = "CreateNewReport", +} + +/** + * Allow customers to select overwrite data(OverwritePreviousReport) for exports. This setting will enable overwrite data for the same month in customer storage account. By default set to CreateNewReport. \ + * {@link KnownDataOverwriteBehaviorType} can be used interchangeably with DataOverwriteBehaviorType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **OverwritePreviousReport** \ + * **CreateNewReport** + */ +export type DataOverwriteBehaviorType = string; + +/** Allow customers to select compress data for exports. This setting will enable destination file compression scheme at runtime. By default set to None. Gzip is for csv and snappy for parquet. */ +export enum KnownCompressionModeType { + /** gzip */ + Gzip = "gzip", + /** snappy */ + Snappy = "snappy", + /** none */ + None = "none", +} + +/** + * Allow customers to select compress data for exports. This setting will enable destination file compression scheme at runtime. By default set to None. Gzip is for csv and snappy for parquet. \ + * {@link KnownCompressionModeType} can be used interchangeably with CompressionModeType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **gzip** \ + * **snappy** \ + * **none** + */ +export type CompressionModeType = string; + +/** The properties of the export run. This is not populated currently. */ +export interface ExportSuspensionContext { + /** The code for export suspension. */ + suspensionCode?: string; + /** The detailed reason for export suspension. */ + suspensionReason?: string; + /** The time when the export was suspended. */ + suspensionTime?: Date; +} + +export function exportSuspensionContextDeserializer(item: any): ExportSuspensionContext { + return { + suspensionCode: item["suspensionCode"], + suspensionReason: item["suspensionReason"], + suspensionTime: !item["suspensionTime"] + ? item["suspensionTime"] + : new Date(item["suspensionTime"]), + }; +} + +/** The Resource model definition. */ +export interface CostManagementProxyResource { + /** Resource Id. */ + readonly id?: string; + /** Resource name. */ + readonly name?: string; + /** Resource type. */ + readonly type?: string; + /** 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; +} + +export function costManagementProxyResourceDeserializer(item: any): CostManagementProxyResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + eTag: item["eTag"], + }; +} + +/** Result of listing exports. It contains a list of available exports in the scope provided. */ +export interface ExportListResult { + /** The list of exports. */ + readonly value?: Export[]; +} + +export function exportListResultDeserializer(item: any): ExportListResult { + return { + value: !item["value"] ? item["value"] : exportArrayDeserializer(item["value"]), + }; +} + +export function exportArraySerializer(result: Array): any[] { + return result.map((item) => { + return exportSerializer(item); + }); +} + +export function exportArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return exportDeserializer(item); + }); +} + +/** The export run request. */ +export interface ExportRunRequest { + /** Has time period for pulling data for the export. */ + timePeriod?: ExportTimePeriod; +} + +export function exportRunRequestSerializer(item: ExportRunRequest): any { + return { + timePeriod: !item["timePeriod"] + ? item["timePeriod"] + : exportTimePeriodSerializer(item["timePeriod"]), + }; +} + +/** The result of the long running operation for cost detailed report. */ +export interface GenerateDetailedCostReportOperationResult extends ExtensionResource { + /** The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. */ + readonly expiryTime?: Date; + /** The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. */ + validTill?: Date; + /** The URL to download the generated report. */ + downloadUrl?: string; +} + +export function generateDetailedCostReportOperationResultDeserializer( + item: any, +): GenerateDetailedCostReportOperationResult { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : _generateDetailedCostReportOperationResultPropertiesDeserializer(item["properties"])), + }; +} + +/** States and configurations of Cost Analysis. */ +export interface View extends ProxyResource { + /** 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; + /** User input name of the view. Required. */ + displayName?: string; + /** 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; + /** Date the user created this view. */ + readonly createdOn?: Date; + /** Date when the user last modified this view. */ + modifiedOn?: Date; + /** Date range of the current view. */ + dateRange?: string; + /** Currency of the current view. */ + readonly currency?: string; + /** Query body configuration. Required. */ + query?: ReportConfigDefinition; + /** Chart type of the main view in Cost Analysis. Required. */ + chart?: ChartType; + /** Show costs accumulated over time. */ + accumulated?: AccumulatedType; + /** Metric to use when displaying costs. */ + metric?: MetricType; + /** List of KPIs to show in Cost Analysis UI. */ + kpis?: KpiProperties[]; + /** Configuration of 3 sub-views in the Cost Analysis UI. */ + pivots?: PivotProperties[]; +} + +export function viewSerializer(item: View): any { + return { + properties: areAllPropsUndefined(item, [ + "displayName", + "scope", + "modifiedOn", + "dateRange", + "query", + "chart", + "accumulated", + "metric", + "kpis", + "pivots", + ]) + ? undefined + : _viewPropertiesSerializer(item), + eTag: item["eTag"], + }; +} + +export function viewDeserializer(item: any): View { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] ? item["properties"] : _viewPropertiesDeserializer(item["properties"])), + eTag: item["eTag"], + }; +} + +/** The properties of the view. */ +export interface ViewProperties { + /** User input name of the view. Required. */ + displayName?: string; + /** 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; + /** Date the user created this view. */ + readonly createdOn?: Date; + /** Date when the user last modified this view. */ + modifiedOn?: Date; + /** Date range of the current view. */ + dateRange?: string; + /** Currency of the current view. */ + readonly currency?: string; + /** Chart type of the main view in Cost Analysis. Required. */ + chart?: ChartType; + /** Show costs accumulated over time. */ + accumulated?: AccumulatedType; + /** Metric to use when displaying costs. */ + metric?: MetricType; + /** List of KPIs to show in Cost Analysis UI. */ + kpis?: KpiProperties[]; + /** Configuration of 3 sub-views in the Cost Analysis UI. */ + pivots?: PivotProperties[]; + /** 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; + /** The time frame for pulling data for the report. If custom, then a specific time period must be provided. */ + timeframe?: ReportTimeframeType; + /** Has time period for pulling data for the report. */ + timePeriod?: ReportConfigTimePeriod; + /** Has definition for data in this report config. */ + dataSet?: ReportConfigDataset; + /** If true, report includes monetary commitment. */ + includeMonetaryCommitment?: boolean; +} + +export function viewPropertiesSerializer(item: ViewProperties): any { + return { + displayName: item["displayName"], + scope: item["scope"], + modifiedOn: !item["modifiedOn"] ? item["modifiedOn"] : item["modifiedOn"].toISOString(), + dateRange: item["dateRange"], + query: areAllPropsUndefined(item, [ + "type", + "timeframe", + "timePeriod", + "dataSet", + "includeMonetaryCommitment", + ]) + ? undefined + : _viewPropertiesQuerySerializer(item), + chart: item["chart"], + accumulated: item["accumulated"], + metric: item["metric"], + kpis: !item["kpis"] ? item["kpis"] : kpiPropertiesArraySerializer(item["kpis"]), + pivots: !item["pivots"] ? item["pivots"] : pivotPropertiesArraySerializer(item["pivots"]), + }; +} + +export function viewPropertiesDeserializer(item: any): ViewProperties { + return { + displayName: item["displayName"], + scope: item["scope"], + createdOn: !item["createdOn"] ? item["createdOn"] : new Date(item["createdOn"]), + modifiedOn: !item["modifiedOn"] ? item["modifiedOn"] : new Date(item["modifiedOn"]), + dateRange: item["dateRange"], + currency: item["currency"], + ...(!item["query"] ? item["query"] : _viewPropertiesQueryDeserializer(item["query"])), + chart: item["chart"], + accumulated: item["accumulated"], + metric: item["metric"], + kpis: !item["kpis"] ? item["kpis"] : kpiPropertiesArrayDeserializer(item["kpis"]), + pivots: !item["pivots"] ? item["pivots"] : pivotPropertiesArrayDeserializer(item["pivots"]), + }; +} + +/** The definition of a report config. */ +export interface ReportConfigDefinition { + /** 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; + /** The time frame for pulling data for the report. If custom, then a specific time period must be provided. */ + timeframe: ReportTimeframeType; + /** Has time period for pulling data for the report. */ + timePeriod?: ReportConfigTimePeriod; + /** Has definition for data in this report config. */ + dataSet?: ReportConfigDataset; + /** If true, report includes monetary commitment. */ + includeMonetaryCommitment?: boolean; +} + +export function reportConfigDefinitionSerializer(item: ReportConfigDefinition): any { + return { + type: item["type"], + timeframe: item["timeframe"], + timePeriod: !item["timePeriod"] + ? item["timePeriod"] + : reportConfigTimePeriodSerializer(item["timePeriod"]), + dataSet: !item["dataSet"] ? item["dataSet"] : reportConfigDatasetSerializer(item["dataSet"]), + includeMonetaryCommitment: item["includeMonetaryCommitment"], + }; +} + +export function reportConfigDefinitionDeserializer(item: any): ReportConfigDefinition { + return { + type: item["type"], + timeframe: item["timeframe"], + timePeriod: !item["timePeriod"] + ? item["timePeriod"] + : reportConfigTimePeriodDeserializer(item["timePeriod"]), + dataSet: !item["dataSet"] ? item["dataSet"] : reportConfigDatasetDeserializer(item["dataSet"]), + includeMonetaryCommitment: item["includeMonetaryCommitment"], + }; +} + +/** 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. */ +export enum KnownReportType { + /** Usage */ + Usage = "Usage", +} + +/** + * 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. \ + * {@link KnownReportType} can be used interchangeably with ReportType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Usage** + */ +export type ReportType = string; + +/** The time frame for pulling data for the report. If custom, then a specific time period must be provided. */ +export enum KnownReportTimeframeType { + /** WeekToDate */ + WeekToDate = "WeekToDate", + /** MonthToDate */ + MonthToDate = "MonthToDate", + /** YearToDate */ + YearToDate = "YearToDate", + /** Custom */ + Custom = "Custom", +} + +/** + * The time frame for pulling data for the report. If custom, then a specific time period must be provided. \ + * {@link KnownReportTimeframeType} can be used interchangeably with ReportTimeframeType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **WeekToDate** \ + * **MonthToDate** \ + * **YearToDate** \ + * **Custom** + */ +export type ReportTimeframeType = string; + +/** The start and end date for pulling data for the report. */ +export interface ReportConfigTimePeriod { + /** The start date to pull data from. */ + from: Date; + /** The end date to pull data to. */ + to: Date; +} + +export function reportConfigTimePeriodSerializer(item: ReportConfigTimePeriod): any { + return { from: item["from"].toISOString(), to: item["to"].toISOString() }; +} + +export function reportConfigTimePeriodDeserializer(item: any): ReportConfigTimePeriod { + return { + from: new Date(item["from"]), + to: new Date(item["to"]), + }; +} + +/** The definition of data present in the report. */ +export interface ReportConfigDataset { + /** The granularity of rows in the report. */ + granularity?: ReportGranularityType; + /** Has configuration information for the data in the report. The configuration will be ignored if aggregation and grouping are provided. */ + configuration?: ReportConfigDatasetConfiguration; + /** 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?: Record; + /** Array of group by expression to use in the report. Report can have up to 2 group by clauses. */ + grouping?: ReportConfigGrouping[]; + /** Array of order by expression to use in the report. */ + sorting?: ReportConfigSorting[]; + /** Has filter expression to use in the report. */ + filter?: ReportConfigFilter; +} + +export function reportConfigDatasetSerializer(item: ReportConfigDataset): any { + return { + granularity: item["granularity"], + configuration: !item["configuration"] + ? item["configuration"] + : reportConfigDatasetConfigurationSerializer(item["configuration"]), + aggregation: !item["aggregation"] + ? item["aggregation"] + : reportConfigAggregationRecordSerializer(item["aggregation"]), + grouping: !item["grouping"] + ? item["grouping"] + : reportConfigGroupingArraySerializer(item["grouping"]), + sorting: !item["sorting"] + ? item["sorting"] + : reportConfigSortingArraySerializer(item["sorting"]), + filter: !item["filter"] ? item["filter"] : reportConfigFilterSerializer(item["filter"]), + }; +} + +export function reportConfigDatasetDeserializer(item: any): ReportConfigDataset { + return { + granularity: item["granularity"], + configuration: !item["configuration"] + ? item["configuration"] + : reportConfigDatasetConfigurationDeserializer(item["configuration"]), + aggregation: !item["aggregation"] + ? item["aggregation"] + : reportConfigAggregationRecordDeserializer(item["aggregation"]), + grouping: !item["grouping"] + ? item["grouping"] + : reportConfigGroupingArrayDeserializer(item["grouping"]), + sorting: !item["sorting"] + ? item["sorting"] + : reportConfigSortingArrayDeserializer(item["sorting"]), + filter: !item["filter"] ? item["filter"] : reportConfigFilterDeserializer(item["filter"]), + }; +} + +/** The granularity of rows in the report. */ +export enum KnownReportGranularityType { + /** Daily */ + Daily = "Daily", + /** Monthly */ + Monthly = "Monthly", +} + +/** + * The granularity of rows in the report. \ + * {@link KnownReportGranularityType} can be used interchangeably with ReportGranularityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Daily** \ + * **Monthly** + */ +export type ReportGranularityType = string; + +/** The configuration of dataset in the report. */ +export interface ReportConfigDatasetConfiguration { + /** 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[]; +} + +export function reportConfigDatasetConfigurationSerializer( + item: ReportConfigDatasetConfiguration, +): any { + return { + columns: !item["columns"] + ? item["columns"] + : item["columns"].map((p: any) => { + return p; + }), + }; +} + +export function reportConfigDatasetConfigurationDeserializer( + item: any, +): ReportConfigDatasetConfiguration { + return { + columns: !item["columns"] + ? item["columns"] + : item["columns"].map((p: any) => { + return p; + }), + }; +} + +export function reportConfigAggregationRecordSerializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : reportConfigAggregationSerializer(item[key]); + }); + return result; +} + +export function reportConfigAggregationRecordDeserializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : reportConfigAggregationDeserializer(item[key]); + }); + return result; +} + +/** The aggregation expression to be used in the report. */ +export interface ReportConfigAggregation { + /** The name of the column to aggregate. */ + name: string; + /** The name of the aggregation function to use. */ + function: FunctionType; +} + +export function reportConfigAggregationSerializer(item: ReportConfigAggregation): any { + return { name: item["name"], function: item["function"] }; +} + +export function reportConfigAggregationDeserializer(item: any): ReportConfigAggregation { + return { + name: item["name"], + function: item["function"], + }; +} + +/** The name of the aggregation function to use. */ +export enum KnownFunctionType { + /** Sum */ + Sum = "Sum", +} + +/** + * The name of the aggregation function to use. \ + * {@link KnownFunctionType} can be used interchangeably with FunctionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Sum** + */ +export type FunctionType = string; + +export function reportConfigGroupingArraySerializer(result: Array): any[] { + return result.map((item) => { + return reportConfigGroupingSerializer(item); + }); +} + +export function reportConfigGroupingArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return reportConfigGroupingDeserializer(item); + }); +} + +/** The group by expression to be used in the report. */ +export interface ReportConfigGrouping { + /** Has type of the column to group. */ + type: QueryColumnType; + /** The name of the column to group. This version supports subscription lowest possible grain. */ + name: string; +} + +export function reportConfigGroupingSerializer(item: ReportConfigGrouping): any { + return { type: item["type"], name: item["name"] }; +} + +export function reportConfigGroupingDeserializer(item: any): ReportConfigGrouping { + return { + type: item["type"], + name: item["name"], + }; +} + +/** The type of the column in the report. */ +export enum KnownQueryColumnType { + /** The tag associated with the cost data. */ + TagKey = "TagKey", + /** The dimension of cost data. */ + Dimension = "Dimension", +} + +/** + * The type of the column in the report. \ + * {@link KnownQueryColumnType} can be used interchangeably with QueryColumnType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **TagKey**: The tag associated with the cost data. \ + * **Dimension**: The dimension of cost data. + */ +export type QueryColumnType = string; + +export function reportConfigSortingArraySerializer(result: Array): any[] { + return result.map((item) => { + return reportConfigSortingSerializer(item); + }); +} + +export function reportConfigSortingArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return reportConfigSortingDeserializer(item); + }); +} + +/** The order by expression to be used in the report. */ +export interface ReportConfigSorting { + /** Direction of sort. */ + direction?: ReportConfigSortingType; + /** The name of the column to sort. */ + name: string; +} + +export function reportConfigSortingSerializer(item: ReportConfigSorting): any { + return { direction: item["direction"], name: item["name"] }; +} + +export function reportConfigSortingDeserializer(item: any): ReportConfigSorting { + return { + direction: item["direction"], + name: item["name"], + }; +} + +/** Direction of sort. */ +export enum KnownReportConfigSortingType { + /** Ascending */ + Ascending = "Ascending", + /** Descending */ + Descending = "Descending", +} + +/** + * Direction of sort. \ + * {@link KnownReportConfigSortingType} can be used interchangeably with ReportConfigSortingType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Ascending** \ + * **Descending** + */ +export type ReportConfigSortingType = string; + +/** The filter expression to be used in the report. */ +export interface ReportConfigFilter { + /** The logical "AND" expression. Must have at least 2 items. */ + and?: ReportConfigFilter[]; + /** The logical "OR" expression. Must have at least 2 items. */ + or?: ReportConfigFilter[]; + /** Has comparison expression for a dimension */ + dimensions?: ReportConfigComparisonExpression; + /** Has comparison expression for a tag */ + tags?: ReportConfigComparisonExpression; +} + +export function reportConfigFilterSerializer(item: ReportConfigFilter): any { + return { + and: !item["and"] ? item["and"] : reportConfigFilterArraySerializer(item["and"]), + or: !item["or"] ? item["or"] : reportConfigFilterArraySerializer(item["or"]), + dimensions: !item["dimensions"] + ? item["dimensions"] + : reportConfigComparisonExpressionSerializer(item["dimensions"]), + tags: !item["tags"] ? item["tags"] : reportConfigComparisonExpressionSerializer(item["tags"]), + }; +} + +export function reportConfigFilterDeserializer(item: any): ReportConfigFilter { + return { + and: !item["and"] ? item["and"] : reportConfigFilterArrayDeserializer(item["and"]), + or: !item["or"] ? item["or"] : reportConfigFilterArrayDeserializer(item["or"]), + dimensions: !item["dimensions"] + ? item["dimensions"] + : reportConfigComparisonExpressionDeserializer(item["dimensions"]), + tags: !item["tags"] ? item["tags"] : reportConfigComparisonExpressionDeserializer(item["tags"]), + }; +} + +export function reportConfigFilterArraySerializer(result: Array): any[] { + return result.map((item) => { + return reportConfigFilterSerializer(item); + }); +} + +export function reportConfigFilterArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return reportConfigFilterDeserializer(item); + }); +} + +/** The comparison expression to be used in the report. */ +export interface ReportConfigComparisonExpression { + /** The name of the column to use in comparison. */ + name: string; + /** The operator to use for comparison. */ + operator: OperatorType; + /** Array of values to use for comparison */ + values: string[]; +} + +export function reportConfigComparisonExpressionSerializer( + item: ReportConfigComparisonExpression, +): any { + return { + name: item["name"], + operator: item["operator"], + values: item["values"].map((p: any) => { + return p; + }), + }; +} + +export function reportConfigComparisonExpressionDeserializer( + item: any, +): ReportConfigComparisonExpression { + return { + name: item["name"], + operator: item["operator"], + values: item["values"].map((p: any) => { + return p; + }), + }; +} + +/** The operator to use for comparison. */ +export enum KnownOperatorType { + /** In */ + In = "In", + /** Contains */ + Contains = "Contains", +} + +/** + * The operator to use for comparison. \ + * {@link KnownOperatorType} can be used interchangeably with OperatorType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **In** \ + * **Contains** + */ +export type OperatorType = string; + +/** Chart type of the main view in Cost Analysis. Required. */ +export enum KnownChartType { + /** Area */ + Area = "Area", + /** Line */ + Line = "Line", + /** StackedColumn */ + StackedColumn = "StackedColumn", + /** GroupedColumn */ + GroupedColumn = "GroupedColumn", + /** Table */ + Table = "Table", +} + +/** + * Chart type of the main view in Cost Analysis. Required. \ + * {@link KnownChartType} can be used interchangeably with ChartType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Area** \ + * **Line** \ + * **StackedColumn** \ + * **GroupedColumn** \ + * **Table** + */ +export type ChartType = string; + +/** Show costs accumulated over time. */ +export enum KnownAccumulatedType { + /** true */ + True = "true", + /** false */ + False = "false", +} + +/** + * Show costs accumulated over time. \ + * {@link KnownAccumulatedType} can be used interchangeably with AccumulatedType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **true** \ + * **false** + */ +export type AccumulatedType = string; + +/** Metric to use when displaying costs. */ +export enum KnownMetricType { + /** ActualCost */ + ActualCost = "ActualCost", + /** AmortizedCost */ + AmortizedCost = "AmortizedCost", + /** AHUB */ + Ahub = "AHUB", +} + +/** + * Metric to use when displaying costs. \ + * {@link KnownMetricType} can be used interchangeably with MetricType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ActualCost** \ + * **AmortizedCost** \ + * **AHUB** + */ +export type MetricType = string; + +export function kpiPropertiesArraySerializer(result: Array): any[] { + return result.map((item) => { + return kpiPropertiesSerializer(item); + }); +} + +export function kpiPropertiesArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return kpiPropertiesDeserializer(item); + }); +} + +/** Each KPI must contain a 'type' and 'enabled' key. */ +export interface KpiProperties { + /** KPI type (Forecast, Budget). */ + type?: KpiType; + /** ID of resource related to metric (budget). */ + id?: string; + /** show the KPI in the UI? */ + enabled?: boolean; +} + +export function kpiPropertiesSerializer(item: KpiProperties): any { + return { type: item["type"], id: item["id"], enabled: item["enabled"] }; +} + +export function kpiPropertiesDeserializer(item: any): KpiProperties { + return { + type: item["type"], + id: item["id"], + enabled: item["enabled"], + }; +} + +/** KPI type (Forecast, Budget). */ +export enum KnownKpiType { + /** Forecast */ + Forecast = "Forecast", + /** Budget */ + Budget = "Budget", +} + +/** + * KPI type (Forecast, Budget). \ + * {@link KnownKpiType} can be used interchangeably with KpiType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Forecast** \ + * **Budget** + */ +export type KpiType = string; + +export function pivotPropertiesArraySerializer(result: Array): any[] { + return result.map((item) => { + return pivotPropertiesSerializer(item); + }); +} + +export function pivotPropertiesArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return pivotPropertiesDeserializer(item); + }); +} + +/** Each pivot must contain a 'type' and 'name'. */ +export interface PivotProperties { + /** Data type to show in view. */ + type?: PivotType; + /** Data field to show in view. */ + name?: string; +} + +export function pivotPropertiesSerializer(item: PivotProperties): any { + return { type: item["type"], name: item["name"] }; +} + +export function pivotPropertiesDeserializer(item: any): PivotProperties { + return { + type: item["type"], + name: item["name"], + }; +} + +/** Data type to show in view. */ +export enum KnownPivotType { + /** Dimension */ + Dimension = "Dimension", + /** TagKey */ + TagKey = "TagKey", +} + +/** + * Data type to show in view. \ + * {@link KnownPivotType} can be used interchangeably with PivotType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Dimension** \ + * **TagKey** + */ +export type PivotType = string; + +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export interface ProxyResource extends Resource {} + +export function proxyResourceSerializer(_item: ProxyResource): any { + return {}; +} + +export function proxyResourceDeserializer(item: any): ProxyResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Result of listing views. It contains a list of available views. */ +export interface _ViewListResult { + /** The list of views. */ + readonly value?: View[]; + /** The link (url) to the next page of results. */ + nextLink?: string; +} + +export function _viewListResultDeserializer(item: any): _ViewListResult { + return { + value: !item["value"] ? item["value"] : viewArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function viewArraySerializer(result: Array): any[] { + return result.map((item) => { + return viewSerializer(item); + }); +} + +export function viewArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return viewDeserializer(item); + }); +} + +/** An individual alert. */ +export interface Alert extends ExtensionResource { + /** 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; + /** defines the type of alert */ + definition?: AlertPropertiesDefinition; + /** Alert description */ + description?: string; + /** Source of alert */ + source?: AlertSource; + /** Alert details */ + details?: AlertPropertiesDetails; + /** related budget */ + costEntityId?: string; + /** alert status */ + status?: AlertStatus; + /** dateTime in which alert was created */ + creationTime?: string; + /** dateTime in which alert was closed */ + closeTime?: string; + /** dateTime in which alert was last modified */ + modificationTime?: string; + /** User who last modified the alert */ + statusModificationUserName?: string; + /** dateTime in which the alert status was last modified */ + statusModificationTime?: string; +} + +export function alertDeserializer(item: any): Alert { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : _alertPropertiesDeserializer(item["properties"])), + eTag: item["eTag"], + }; +} + +/** Alert properties. */ +export interface AlertProperties { + /** defines the type of alert */ + definition?: AlertPropertiesDefinition; + /** Alert description */ + description?: string; + /** Source of alert */ + source?: AlertSource; + /** Alert details */ + details?: AlertPropertiesDetails; + /** related budget */ + costEntityId?: string; + /** alert status */ + status?: AlertStatus; + /** dateTime in which alert was created */ + creationTime?: string; + /** dateTime in which alert was closed */ + closeTime?: string; + /** dateTime in which alert was last modified */ + modificationTime?: string; + /** User who last modified the alert */ + statusModificationUserName?: string; + /** dateTime in which the alert status was last modified */ + statusModificationTime?: string; +} + +export function alertPropertiesSerializer(item: AlertProperties): any { + return { + definition: !item["definition"] + ? item["definition"] + : alertPropertiesDefinitionSerializer(item["definition"]), + description: item["description"], + source: item["source"], + details: !item["details"] ? item["details"] : alertPropertiesDetailsSerializer(item["details"]), + costEntityId: item["costEntityId"], + status: item["status"], + creationTime: item["creationTime"], + closeTime: item["closeTime"], + modificationTime: item["modificationTime"], + statusModificationUserName: item["statusModificationUserName"], + statusModificationTime: item["statusModificationTime"], + }; +} + +export function alertPropertiesDeserializer(item: any): AlertProperties { + return { + definition: !item["definition"] + ? item["definition"] + : alertPropertiesDefinitionDeserializer(item["definition"]), + description: item["description"], + source: item["source"], + details: !item["details"] + ? item["details"] + : alertPropertiesDetailsDeserializer(item["details"]), + costEntityId: item["costEntityId"], + status: item["status"], + creationTime: item["creationTime"], + closeTime: item["closeTime"], + modificationTime: item["modificationTime"], + statusModificationUserName: item["statusModificationUserName"], + statusModificationTime: item["statusModificationTime"], + }; +} + +/** defines the type of alert */ +export interface AlertPropertiesDefinition { + /** type of alert */ + type?: AlertType; + /** Alert category */ + category?: AlertCategory; + /** Criteria that triggered alert */ + criteria?: AlertCriteria; +} + +export function alertPropertiesDefinitionSerializer(item: AlertPropertiesDefinition): any { + return { type: item["type"], category: item["category"], criteria: item["criteria"] }; +} + +export function alertPropertiesDefinitionDeserializer(item: any): AlertPropertiesDefinition { + return { + type: item["type"], + category: item["category"], + criteria: item["criteria"], + }; +} + +/** type of alert */ +export enum KnownAlertType { + /** Budget */ + Budget = "Budget", + /** Invoice */ + Invoice = "Invoice", + /** Credit */ + Credit = "Credit", + /** Quota */ + Quota = "Quota", + /** General */ + General = "General", + /** xCloud */ + XCloud = "xCloud", + /** BudgetForecast */ + BudgetForecast = "BudgetForecast", +} + +/** + * type of alert \ + * {@link KnownAlertType} can be used interchangeably with AlertType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Budget** \ + * **Invoice** \ + * **Credit** \ + * **Quota** \ + * **General** \ + * **xCloud** \ + * **BudgetForecast** + */ +export type AlertType = string; + +/** Alert category */ +export enum KnownAlertCategory { + /** Cost */ + Cost = "Cost", + /** Usage */ + Usage = "Usage", + /** Billing */ + Billing = "Billing", + /** System */ + System = "System", +} + +/** + * Alert category \ + * {@link KnownAlertCategory} can be used interchangeably with AlertCategory, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Cost** \ + * **Usage** \ + * **Billing** \ + * **System** + */ +export type AlertCategory = string; + +/** Criteria that triggered alert */ +export enum KnownAlertCriteria { + /** CostThresholdExceeded */ + CostThresholdExceeded = "CostThresholdExceeded", + /** UsageThresholdExceeded */ + UsageThresholdExceeded = "UsageThresholdExceeded", + /** CreditThresholdApproaching */ + CreditThresholdApproaching = "CreditThresholdApproaching", + /** CreditThresholdReached */ + CreditThresholdReached = "CreditThresholdReached", + /** QuotaThresholdApproaching */ + QuotaThresholdApproaching = "QuotaThresholdApproaching", + /** QuotaThresholdReached */ + QuotaThresholdReached = "QuotaThresholdReached", + /** MultiCurrency */ + MultiCurrency = "MultiCurrency", + /** ForecastCostThresholdExceeded */ + ForecastCostThresholdExceeded = "ForecastCostThresholdExceeded", + /** ForecastUsageThresholdExceeded */ + ForecastUsageThresholdExceeded = "ForecastUsageThresholdExceeded", + /** InvoiceDueDateApproaching */ + InvoiceDueDateApproaching = "InvoiceDueDateApproaching", + /** InvoiceDueDateReached */ + InvoiceDueDateReached = "InvoiceDueDateReached", + /** CrossCloudNewDataAvailable */ + CrossCloudNewDataAvailable = "CrossCloudNewDataAvailable", + /** CrossCloudCollectionError */ + CrossCloudCollectionError = "CrossCloudCollectionError", + /** GeneralThresholdError */ + GeneralThresholdError = "GeneralThresholdError", +} + +/** + * Criteria that triggered alert \ + * {@link KnownAlertCriteria} can be used interchangeably with AlertCriteria, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **CostThresholdExceeded** \ + * **UsageThresholdExceeded** \ + * **CreditThresholdApproaching** \ + * **CreditThresholdReached** \ + * **QuotaThresholdApproaching** \ + * **QuotaThresholdReached** \ + * **MultiCurrency** \ + * **ForecastCostThresholdExceeded** \ + * **ForecastUsageThresholdExceeded** \ + * **InvoiceDueDateApproaching** \ + * **InvoiceDueDateReached** \ + * **CrossCloudNewDataAvailable** \ + * **CrossCloudCollectionError** \ + * **GeneralThresholdError** + */ +export type AlertCriteria = string; + +/** Source of alert */ +export enum KnownAlertSource { + /** Preset */ + Preset = "Preset", + /** User */ + User = "User", +} + +/** + * Source of alert \ + * {@link KnownAlertSource} can be used interchangeably with AlertSource, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Preset** \ + * **User** + */ +export type AlertSource = string; + +/** Alert details */ +export interface AlertPropertiesDetails { + /** Type of timegrain cadence */ + timeGrainType?: AlertTimeGrainType; + /** datetime of periodStartDate */ + periodStartDate?: string; + /** notificationId that triggered this alert */ + triggeredBy?: string; + /** array of resourceGroups to filter by */ + resourceGroupFilter?: any[]; + /** array of resources to filter by */ + resourceFilter?: any[]; + /** array of meters to filter by */ + meterFilter?: any[]; + /** tags to filter by */ + tagFilter?: any; + /** notification threshold percentage as a decimal which activated this alert */ + threshold?: number; + /** operator used to compare currentSpend with amount */ + operator?: AlertOperator; + /** budget threshold amount */ + amount?: number; + /** unit of currency being used */ + unit?: string; + /** current spend */ + currentSpend?: number; + /** list of emails to contact */ + contactEmails?: string[]; + /** list of action groups to broadcast to */ + contactGroups?: string[]; + /** list of contact roles */ + contactRoles?: string[]; + /** overriding alert */ + overridingAlert?: string; + /** department name */ + departmentName?: string; + /** company name */ + companyName?: string; + /** enrollment number */ + enrollmentNumber?: string; + /** datetime of enrollmentStartDate */ + enrollmentStartDate?: string; + /** datetime of enrollmentEndDate */ + enrollmentEndDate?: string; + /** invoicing threshold */ + invoicingThreshold?: number; +} + +export function alertPropertiesDetailsSerializer(item: AlertPropertiesDetails): any { + return { + timeGrainType: item["timeGrainType"], + periodStartDate: item["periodStartDate"], + triggeredBy: item["triggeredBy"], + resourceGroupFilter: !item["resourceGroupFilter"] + ? item["resourceGroupFilter"] + : item["resourceGroupFilter"].map((p: any) => { + return p; + }), + resourceFilter: !item["resourceFilter"] + ? item["resourceFilter"] + : item["resourceFilter"].map((p: any) => { + return p; + }), + meterFilter: !item["meterFilter"] + ? item["meterFilter"] + : item["meterFilter"].map((p: any) => { + return p; + }), + tagFilter: item["tagFilter"], + threshold: item["threshold"], + operator: item["operator"], + amount: item["amount"], + unit: item["unit"], + currentSpend: item["currentSpend"], + contactEmails: !item["contactEmails"] + ? item["contactEmails"] + : item["contactEmails"].map((p: any) => { + return p; + }), + contactGroups: !item["contactGroups"] + ? item["contactGroups"] + : item["contactGroups"].map((p: any) => { + return p; + }), + contactRoles: !item["contactRoles"] + ? item["contactRoles"] + : item["contactRoles"].map((p: any) => { + return p; + }), + overridingAlert: item["overridingAlert"], + departmentName: item["departmentName"], + companyName: item["companyName"], + enrollmentNumber: item["enrollmentNumber"], + enrollmentStartDate: item["enrollmentStartDate"], + enrollmentEndDate: item["enrollmentEndDate"], + invoicingThreshold: item["invoicingThreshold"], + }; +} + +export function alertPropertiesDetailsDeserializer(item: any): AlertPropertiesDetails { + return { + timeGrainType: item["timeGrainType"], + periodStartDate: item["periodStartDate"], + triggeredBy: item["triggeredBy"], + resourceGroupFilter: !item["resourceGroupFilter"] + ? item["resourceGroupFilter"] + : item["resourceGroupFilter"].map((p: any) => { + return p; + }), + resourceFilter: !item["resourceFilter"] + ? item["resourceFilter"] + : item["resourceFilter"].map((p: any) => { + return p; + }), + meterFilter: !item["meterFilter"] + ? item["meterFilter"] + : item["meterFilter"].map((p: any) => { + return p; + }), + tagFilter: item["tagFilter"], + threshold: item["threshold"], + operator: item["operator"], + amount: item["amount"], + unit: item["unit"], + currentSpend: item["currentSpend"], + contactEmails: !item["contactEmails"] + ? item["contactEmails"] + : item["contactEmails"].map((p: any) => { + return p; + }), + contactGroups: !item["contactGroups"] + ? item["contactGroups"] + : item["contactGroups"].map((p: any) => { + return p; + }), + contactRoles: !item["contactRoles"] + ? item["contactRoles"] + : item["contactRoles"].map((p: any) => { + return p; + }), + overridingAlert: item["overridingAlert"], + departmentName: item["departmentName"], + companyName: item["companyName"], + enrollmentNumber: item["enrollmentNumber"], + enrollmentStartDate: item["enrollmentStartDate"], + enrollmentEndDate: item["enrollmentEndDate"], + invoicingThreshold: item["invoicingThreshold"], + }; +} + +/** Type of timegrain cadence */ +export enum KnownAlertTimeGrainType { + /** None */ + None = "None", + /** Monthly */ + Monthly = "Monthly", + /** Quarterly */ + Quarterly = "Quarterly", + /** Annually */ + Annually = "Annually", + /** BillingMonth */ + BillingMonth = "BillingMonth", + /** BillingQuarter */ + BillingQuarter = "BillingQuarter", + /** BillingAnnual */ + BillingAnnual = "BillingAnnual", +} + +/** + * Type of timegrain cadence \ + * {@link KnownAlertTimeGrainType} can be used interchangeably with AlertTimeGrainType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **Monthly** \ + * **Quarterly** \ + * **Annually** \ + * **BillingMonth** \ + * **BillingQuarter** \ + * **BillingAnnual** + */ +export type AlertTimeGrainType = string; + +/** operator used to compare currentSpend with amount */ +export enum KnownAlertOperator { + /** None */ + None = "None", + /** EqualTo */ + EqualTo = "EqualTo", + /** GreaterThan */ + GreaterThan = "GreaterThan", + /** GreaterThanOrEqualTo */ + GreaterThanOrEqualTo = "GreaterThanOrEqualTo", + /** LessThan */ + LessThan = "LessThan", + /** LessThanOrEqualTo */ + LessThanOrEqualTo = "LessThanOrEqualTo", +} + +/** + * operator used to compare currentSpend with amount \ + * {@link KnownAlertOperator} can be used interchangeably with AlertOperator, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **EqualTo** \ + * **GreaterThan** \ + * **GreaterThanOrEqualTo** \ + * **LessThan** \ + * **LessThanOrEqualTo** + */ +export type AlertOperator = string; + +/** alert status */ +export enum KnownAlertStatus { + /** None */ + None = "None", + /** Active */ + Active = "Active", + /** Overridden */ + Overridden = "Overridden", + /** Resolved */ + Resolved = "Resolved", + /** Dismissed */ + Dismissed = "Dismissed", +} + +/** + * alert status \ + * {@link KnownAlertStatus} can be used interchangeably with AlertStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **Active** \ + * **Overridden** \ + * **Resolved** \ + * **Dismissed** + */ +export type AlertStatus = string; + +/** The request payload to update an alert */ +export interface DismissAlertPayload { + /** defines the type of alert */ + definition?: AlertPropertiesDefinition; + /** Alert description */ + description?: string; + /** Source of alert */ + source?: AlertSource; + /** Alert details */ + details?: AlertPropertiesDetails; + /** related budget */ + costEntityId?: string; + /** alert status */ + status?: AlertStatus; + /** dateTime in which alert was created */ + creationTime?: string; + /** dateTime in which alert was closed */ + closeTime?: string; + /** dateTime in which alert was last modified */ + modificationTime?: string; + /** User who last modified the alert */ + statusModificationUserName?: string; + /** dateTime in which the alert status was last modified */ + statusModificationTime?: string; +} + +export function dismissAlertPayloadSerializer(item: DismissAlertPayload): any { + return { + properties: areAllPropsUndefined(item, [ + "definition", + "description", + "source", + "details", + "costEntityId", + "status", + "creationTime", + "closeTime", + "modificationTime", + "statusModificationUserName", + "statusModificationTime", + ]) + ? undefined + : _dismissAlertPayloadPropertiesSerializer(item), + }; +} + +/** Result of alerts. */ +export interface AlertsResult { + /** List of alerts. */ + readonly value?: Alert[]; + /** URL to get the next set of alerts results if there are any. */ + readonly nextLink?: string; +} + +export function alertsResultDeserializer(item: any): AlertsResult { + return { + value: !item["value"] ? item["value"] : alertArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function alertArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return alertDeserializer(item); + }); +} + +/** Scheduled action definition. */ +export interface ScheduledAction extends ProxyResource { + /** Resource Etag. For update calls, eTag is optional and can be specified to achieve optimistic concurrency. Fetch the resource's eTag by doing a 'GET' call first and then including the latest eTag as part of the request body or 'If-Match' header while performing the update. For create calls, eTag is not required. */ + eTag?: string; + /** Kind of the scheduled action. */ + kind?: ScheduledActionKind; + /** Scheduled action name. */ + displayName?: string; + /** Destination format of the view data. This is optional. */ + fileDestination?: FileDestination; + /** Notification properties based on scheduled action kind. */ + notification?: NotificationProperties; + /** Email address of the point of contact that should get the unsubscribe requests and notification emails. */ + notificationEmail?: string; + /** Schedule of the scheduled action. */ + schedule?: ScheduleProperties; + /** For private scheduled action(Create or Update), scope will be empty.
For shared scheduled action(Create or Update By Scope), Cost Management scope can be '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; + /** Status of the scheduled action. */ + status?: ScheduledActionStatus; + /** Cost analysis viewId used for scheduled action. For example, '/providers/Microsoft.CostManagement/views/swaggerExample' */ + viewId?: string; +} + +export function scheduledActionSerializer(item: ScheduledAction): any { + return { + properties: areAllPropsUndefined(item, [ + "displayName", + "fileDestination", + "notification", + "notificationEmail", + "schedule", + "scope", + "status", + "viewId", + ]) + ? undefined + : _scheduledActionPropertiesSerializer(item), + eTag: item["eTag"], + kind: item["kind"], + }; +} + +export function scheduledActionDeserializer(item: any): ScheduledAction { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : _scheduledActionPropertiesDeserializer(item["properties"])), + eTag: item["eTag"], + kind: item["kind"], + }; +} + +/** The properties of the scheduled action. */ +export interface ScheduledActionProperties { + /** Scheduled action name. */ + displayName: string; + /** Destination format of the view data. This is optional. */ + fileDestination?: FileDestination; + /** Notification properties based on scheduled action kind. */ + notification: NotificationProperties; + /** Email address of the point of contact that should get the unsubscribe requests and notification emails. */ + notificationEmail?: string; + /** Schedule of the scheduled action. */ + schedule: ScheduleProperties; + /** For private scheduled action(Create or Update), scope will be empty.
For shared scheduled action(Create or Update By Scope), Cost Management scope can be '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; + /** Status of the scheduled action. */ + status: ScheduledActionStatus; + /** Cost analysis viewId used for scheduled action. For example, '/providers/Microsoft.CostManagement/views/swaggerExample' */ + viewId: string; +} + +export function scheduledActionPropertiesSerializer(item: ScheduledActionProperties): any { + return { + displayName: item["displayName"], + fileDestination: !item["fileDestination"] + ? item["fileDestination"] + : fileDestinationSerializer(item["fileDestination"]), + notification: notificationPropertiesSerializer(item["notification"]), + notificationEmail: item["notificationEmail"], + schedule: schedulePropertiesSerializer(item["schedule"]), + scope: item["scope"], + status: item["status"], + viewId: item["viewId"], + }; +} + +export function scheduledActionPropertiesDeserializer(item: any): ScheduledActionProperties { + return { + displayName: item["displayName"], + fileDestination: !item["fileDestination"] + ? item["fileDestination"] + : fileDestinationDeserializer(item["fileDestination"]), + notification: notificationPropertiesDeserializer(item["notification"]), + notificationEmail: item["notificationEmail"], + schedule: schedulePropertiesDeserializer(item["schedule"]), + scope: item["scope"], + status: item["status"], + viewId: item["viewId"], + }; +} + +/** Destination of the view data. This is optional. Currently only CSV format is supported. */ +export interface FileDestination { + /** Destination of the view data. Currently only CSV format is supported. */ + fileFormats?: FileFormat[]; +} + +export function fileDestinationSerializer(item: FileDestination): any { + return { + fileFormats: !item["fileFormats"] + ? item["fileFormats"] + : item["fileFormats"].map((p: any) => { + return p; + }), + }; +} + +export function fileDestinationDeserializer(item: any): FileDestination { + return { + fileFormats: !item["fileFormats"] + ? item["fileFormats"] + : item["fileFormats"].map((p: any) => { + return p; + }), + }; +} + +/** Destination of the view data. Currently only CSV format is supported. */ +export enum KnownFileFormat { + /** Csv */ + Csv = "Csv", +} + +/** + * Destination of the view data. Currently only CSV format is supported. \ + * {@link KnownFileFormat} can be used interchangeably with FileFormat, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Csv** + */ +export type FileFormat = string; + +/** The properties of the scheduled action notification. */ +export interface NotificationProperties { + /** Array of email addresses. */ + to: string[]; + /** Locale of the email. */ + language?: string; + /** Optional message to be added in the email. Length is limited to 250 characters. */ + message?: string; + /** Regional format used for formatting date/time and currency values in the email. */ + regionalFormat?: string; + /** Subject of the email. Length is limited to 70 characters. */ + subject: string; +} + +export function notificationPropertiesSerializer(item: NotificationProperties): any { + return { + to: item["to"].map((p: any) => { + return p; + }), + language: item["language"], + message: item["message"], + regionalFormat: item["regionalFormat"], + subject: item["subject"], + }; +} + +export function notificationPropertiesDeserializer(item: any): NotificationProperties { + return { + to: item["to"].map((p: any) => { + return p; + }), + language: item["language"], + message: item["message"], + regionalFormat: item["regionalFormat"], + subject: item["subject"], + }; +} + +/** The properties of the schedule. */ +export interface ScheduleProperties { + /** Frequency of the schedule. */ + frequency: ScheduleFrequency; + /** UTC time at which cost analysis data will be emailed. */ + hourOfDay?: number; + /** Day names in english on which cost analysis data will be emailed. This property is applicable when frequency is Weekly or Monthly. */ + daysOfWeek?: DaysOfWeek[]; + /** 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[]; + /** 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?: number; + /** The start date and time of the scheduled action (UTC). */ + startDate: Date; + /** The end date and time of the scheduled action (UTC). */ + endDate: Date; +} + +export function schedulePropertiesSerializer(item: ScheduleProperties): any { + return { + frequency: item["frequency"], + hourOfDay: item["hourOfDay"], + daysOfWeek: !item["daysOfWeek"] + ? item["daysOfWeek"] + : item["daysOfWeek"].map((p: any) => { + return p; + }), + weeksOfMonth: !item["weeksOfMonth"] + ? item["weeksOfMonth"] + : item["weeksOfMonth"].map((p: any) => { + return p; + }), + dayOfMonth: item["dayOfMonth"], + startDate: item["startDate"].toISOString(), + endDate: item["endDate"].toISOString(), + }; +} + +export function schedulePropertiesDeserializer(item: any): ScheduleProperties { + return { + frequency: item["frequency"], + hourOfDay: item["hourOfDay"], + daysOfWeek: !item["daysOfWeek"] + ? item["daysOfWeek"] + : item["daysOfWeek"].map((p: any) => { + return p; + }), + weeksOfMonth: !item["weeksOfMonth"] + ? item["weeksOfMonth"] + : item["weeksOfMonth"].map((p: any) => { + return p; + }), + dayOfMonth: item["dayOfMonth"], + startDate: new Date(item["startDate"]), + endDate: new Date(item["endDate"]), + }; +} + +/** Frequency of the schedule. */ +export enum KnownScheduleFrequency { + /** Cost analysis data will be emailed every day. */ + Daily = "Daily", + /** Cost analysis data will be emailed every week. */ + Weekly = "Weekly", + /** Cost analysis data will be emailed every month. */ + Monthly = "Monthly", +} + +/** + * Frequency of the schedule. \ + * {@link KnownScheduleFrequency} can be used interchangeably with ScheduleFrequency, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Daily**: Cost analysis data will be emailed every day. \ + * **Weekly**: Cost analysis data will be emailed every week. \ + * **Monthly**: Cost analysis data will be emailed every month. + */ +export type ScheduleFrequency = string; + +/** Days of Week. */ +export enum KnownDaysOfWeek { + /** Monday */ + Monday = "Monday", + /** Tuesday */ + Tuesday = "Tuesday", + /** Wednesday */ + Wednesday = "Wednesday", + /** Thursday */ + Thursday = "Thursday", + /** Friday */ + Friday = "Friday", + /** Saturday */ + Saturday = "Saturday", + /** Sunday */ + Sunday = "Sunday", +} + +/** + * Days of Week. \ + * {@link KnownDaysOfWeek} can be used interchangeably with DaysOfWeek, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Monday** \ + * **Tuesday** \ + * **Wednesday** \ + * **Thursday** \ + * **Friday** \ + * **Saturday** \ + * **Sunday** + */ +export type DaysOfWeek = string; + +/** Weeks of month. */ +export enum KnownWeeksOfMonth { + /** First */ + First = "First", + /** Second */ + Second = "Second", + /** Third */ + Third = "Third", + /** Fourth */ + Fourth = "Fourth", + /** Last */ + Last = "Last", +} + +/** + * Weeks of month. \ + * {@link KnownWeeksOfMonth} can be used interchangeably with WeeksOfMonth, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **First** \ + * **Second** \ + * **Third** \ + * **Fourth** \ + * **Last** + */ +export type WeeksOfMonth = string; + +/** Status of the scheduled action. */ +export enum KnownScheduledActionStatus { + /** Scheduled action is saved and will be run. */ + Enabled = "Enabled", + /** Scheduled action is expired. */ + Expired = "Expired", + /** Scheduled action is saved but will not be run. */ + Disabled = "Disabled", +} + +/** + * Status of the scheduled action. \ + * {@link KnownScheduledActionStatus} can be used interchangeably with ScheduledActionStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled**: Scheduled action is saved and will be run. \ + * **Expired**: Scheduled action is expired. \ + * **Disabled**: Scheduled action is saved but will not be run. + */ +export type ScheduledActionStatus = string; + +/** Kind of the scheduled action. */ +export enum KnownScheduledActionKind { + /** Cost analysis data will be emailed. */ + Email = "Email", + /** 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. */ + InsightAlert = "InsightAlert", +} + +/** + * Kind of the scheduled action. \ + * {@link KnownScheduledActionKind} can be used interchangeably with ScheduledActionKind, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Email**: Cost analysis data will be emailed. \ + * **InsightAlert**: 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. + */ +export type ScheduledActionKind = string; + +/** + * 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. + */ +export interface ErrorResponseWithNestedDetails { + /** The details of the error. */ + error?: ErrorDetailsWithNestedDetails; +} + +export function errorResponseWithNestedDetailsDeserializer( + item: any, +): ErrorResponseWithNestedDetails { + return { + error: !item["error"] + ? item["error"] + : errorDetailsWithNestedDetailsDeserializer(item["error"]), + }; +} + +/** The details of the error. */ +export interface ErrorDetailsWithNestedDetails extends ErrorDetails { + /** The additional details of the error. */ + readonly details?: ErrorDetailsWithNestedDetails[]; +} + +export function errorDetailsWithNestedDetailsDeserializer( + item: any, +): ErrorDetailsWithNestedDetails { + return { + code: item["code"], + message: item["message"], + details: !item["details"] + ? item["details"] + : errorDetailsWithNestedDetailsArrayDeserializer(item["details"]), + }; +} + +export function errorDetailsWithNestedDetailsArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return errorDetailsWithNestedDetailsDeserializer(item); + }); +} + +/** Scheduled actions list result. It contains a list of scheduled actions. */ +export interface _ScheduledActionListResult { + /** The list of scheduled actions. */ + readonly value?: ScheduledAction[]; + /** The link (url) to the next page of results. */ + nextLink?: string; +} + +export function _scheduledActionListResultDeserializer(item: any): _ScheduledActionListResult { + return { + value: !item["value"] ? item["value"] : scheduledActionArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function scheduledActionArraySerializer(result: Array): any[] { + return result.map((item) => { + return scheduledActionSerializer(item); + }); +} + +export function scheduledActionArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return scheduledActionDeserializer(item); + }); +} + +/** The check availability request body. */ +export interface CheckNameAvailabilityRequest { + /** The name of the resource for which availability needs to be checked. */ + name?: string; + /** The resource type. */ + type?: string; +} + +export function checkNameAvailabilityRequestSerializer(item: CheckNameAvailabilityRequest): any { + return { name: item["name"], type: item["type"] }; +} + +/** The check availability result. */ +export interface CheckNameAvailabilityResponse { + /** Indicates if the resource name is available. */ + nameAvailable?: boolean; + /** The reason why the given name is not available. */ + reason?: CheckNameAvailabilityReason; + /** Detailed reason why the given name is not available. */ + message?: string; +} + +export function checkNameAvailabilityResponseDeserializer( + item: any, +): CheckNameAvailabilityResponse { + return { + nameAvailable: item["nameAvailable"], + reason: item["reason"], + message: item["message"], + }; +} + +/** Possible reasons for a name not being available. */ +export enum KnownCheckNameAvailabilityReason { + /** Name is invalid. */ + Invalid = "Invalid", + /** Name already exists. */ + AlreadyExists = "AlreadyExists", +} + +/** + * Possible reasons for a name not being available. \ + * {@link KnownCheckNameAvailabilityReason} can be used interchangeably with CheckNameAvailabilityReason, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Invalid**: Name is invalid. \ + * **AlreadyExists**: Name already exists. + */ +export type CheckNameAvailabilityReason = string; + +/** Setting definition. */ +export interface Setting extends ProxyResource { + /** Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. */ + /** The discriminator possible values: taginheritance */ + kind: SettingsKind; +} + +export function settingSerializer(item: Setting): any { + return { kind: item["kind"] }; +} + +export function settingDeserializer(item: any): Setting { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + kind: item["kind"], + }; +} + +/** Alias for SettingUnion */ +export type SettingUnion = TagInheritanceSetting | Setting; + +export function settingUnionSerializer(item: SettingUnion): any { + switch (item.kind) { + case "taginheritance": + return tagInheritanceSettingSerializer(item as TagInheritanceSetting); + + default: + return settingSerializer(item); + } +} + +export function settingUnionDeserializer(item: any): SettingUnion { + switch (item["kind"]) { + case "taginheritance": + return tagInheritanceSettingDeserializer(item as TagInheritanceSetting); + + default: + return settingDeserializer(item); + } +} + +/** Specifies the kind of settings. */ +export enum KnownSettingsKind { + /** taginheritance */ + Taginheritance = "taginheritance", +} + +/** + * Specifies the kind of settings. \ + * {@link KnownSettingsKind} can be used interchangeably with SettingsKind, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **taginheritance** + */ +export type SettingsKind = string; + +/** Known values of {@link SettingType} that the service accepts. */ +export enum KnownSettingType { + /** This setting applies billing profile, invoice section, subscription and resource group tags to current month's usage data of child resources. */ + Taginheritance = "taginheritance", +} + +/** Type of SettingType */ +export type SettingType = string; + +/** Tag Inheritance Setting definition. */ +export interface TagInheritanceSetting extends Setting { + /** The properties of the tag inheritance setting. */ + properties?: TagInheritanceProperties; + /** Specifies the kind of settings. */ + kind: "taginheritance"; +} + +export function tagInheritanceSettingSerializer(item: TagInheritanceSetting): any { + return { + kind: item["kind"], + properties: !item["properties"] + ? item["properties"] + : tagInheritancePropertiesSerializer(item["properties"]), + }; +} + +export function tagInheritanceSettingDeserializer(item: any): TagInheritanceSetting { + return { + kind: item["kind"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : tagInheritancePropertiesDeserializer(item["properties"]), + }; +} + +/** The properties of the tag inheritance setting. */ +export interface TagInheritanceProperties { + /** This property defines the behavior when an inherited tag being applied matches a lower scope tag (Eg. Subscription tag matches the resource tag). If set to true - when tags match, the highest scope tags will be applied. Billing profile is the highest scope, followed by invoice sections, subscriptions and resource groups (allows overriding of lower scope tag values). If set to false - when tags match, the lowest scope tags will be applied. So, if a resource has the same tag as a subscription tag, the resource tag will be applied (does not allow overriding of lower scope tag values). */ + preferContainerTags: boolean; +} + +export function tagInheritancePropertiesSerializer(item: TagInheritanceProperties): any { + return { preferContainerTags: item["preferContainerTags"] }; +} + +export function tagInheritancePropertiesDeserializer(item: any): TagInheritanceProperties { + return { + preferContainerTags: item["preferContainerTags"], + }; +} + +/** Setting list result. It contains a list of settings. */ +export interface SettingsListResult { + /** The list of settings. */ + readonly value?: SettingUnion[]; +} + +export function settingsListResultDeserializer(item: any): SettingsListResult { + return { + value: !item["value"] ? item["value"] : settingUnionArrayDeserializer(item["value"]), + }; +} + +export function settingUnionArraySerializer(result: Array): any[] { + return result.map((item) => { + return settingUnionSerializer(item); + }); +} + +export function settingUnionArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return settingUnionDeserializer(item); + }); +} + +/** The result of the long running operation for cost details Api. */ +export interface CostDetailsOperationResults { + /** The id of the long running operation. */ + id?: string; + /** The name of the long running operation. */ + name?: string; + /** The type of the long running operation. */ + type?: string; + /** The status of the cost details operation */ + status?: CostDetailsStatusType; + /** The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. */ + validTill?: Date; + /** The details of the error. */ + error?: ErrorDetails; + /** The Manifest version. */ + manifestVersion?: string; + /** The data format of the report */ + dataFormat?: CostDetailsDataFormat; + /** The total number of bytes in all blobs. */ + byteCount?: number; + /** The total number of blobs. */ + blobCount?: number; + /** Is the data in compressed format. */ + compressData?: boolean; + /** The context of the Cost Details request. */ + requestContext?: RequestContext; + /** List of blob information generated by this operation. */ + blobs?: BlobInfo[]; +} + +export function costDetailsOperationResultsDeserializer(item: any): CostDetailsOperationResults { + return { + id: item["id"], + name: item["name"], + type: item["type"], + status: item["status"], + ...(!item["manifest"] + ? item["manifest"] + : _costDetailsOperationResultsManifestDeserializer(item["manifest"])), + validTill: !item["validTill"] ? item["validTill"] : new Date(item["validTill"]), + error: !item["error"] ? item["error"] : errorDetailsDeserializer(item["error"]), + }; +} + +/** The status of the cost details operation */ +export enum KnownCostDetailsStatusType { + /** Operation is Completed. */ + CompletedCostDetailsStatusType = "Completed", + /** Operation is Completed and no cost data found. */ + NoDataFoundCostDetailsStatusType = "NoDataFound", + /** Operation Failed. */ + FailedCostDetailsStatusType = "Failed", +} + +/** + * The status of the cost details operation \ + * {@link KnownCostDetailsStatusType} can be used interchangeably with CostDetailsStatusType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Completed**: Operation is Completed. \ + * **NoDataFound**: Operation is Completed and no cost data found. \ + * **Failed**: Operation Failed. + */ +export type CostDetailsStatusType = string; + +/** The manifest of the report generated by the operation. */ +export interface ReportManifest { + /** The Manifest version. */ + manifestVersion?: string; + /** The data format of the report */ + dataFormat?: CostDetailsDataFormat; + /** The total number of bytes in all blobs. */ + byteCount?: number; + /** The total number of blobs. */ + blobCount?: number; + /** Is the data in compressed format. */ + compressData?: boolean; + /** List of blob information generated by this operation. */ + blobs?: BlobInfo[]; + /** The request scope of the request. */ + requestScope?: string; + /** The request payload body provided in Cost Details call */ + requestBody?: GenerateCostDetailsReportRequestDefinition; +} + +export function reportManifestDeserializer(item: any): ReportManifest { + return { + manifestVersion: item["manifestVersion"], + dataFormat: item["dataFormat"], + byteCount: item["byteCount"], + blobCount: item["blobCount"], + compressData: item["compressData"], + ...(!item["requestContext"] + ? item["requestContext"] + : _reportManifestRequestContextDeserializer(item["requestContext"])), + blobs: !item["blobs"] ? item["blobs"] : blobInfoArrayDeserializer(item["blobs"]), + }; +} + +/** The data format of the report */ +export enum KnownCostDetailsDataFormat { + /** Csv data format. */ + CsvCostDetailsDataFormat = "Csv", +} + +/** + * The data format of the report \ + * {@link KnownCostDetailsDataFormat} can be used interchangeably with CostDetailsDataFormat, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Csv**: Csv data format. + */ +export type CostDetailsDataFormat = string; + +/** The context of the Cost Details request. */ +export interface RequestContext { + /** The request scope of the request. */ + requestScope?: string; + /** The request payload body provided in Cost Details call */ + requestBody?: GenerateCostDetailsReportRequestDefinition; +} + +export function requestContextDeserializer(item: any): RequestContext { + return { + requestScope: item["requestScope"], + requestBody: !item["requestBody"] + ? item["requestBody"] + : generateCostDetailsReportRequestDefinitionDeserializer(item["requestBody"]), + }; +} + +/** The definition of a cost detailed report. */ +export interface GenerateCostDetailsReportRequestDefinition { + /** The type of the detailed report. By default ActualCost is provided */ + metric?: CostDetailsMetricType; + /** The specific date range of cost details requested for the report. This parameter cannot be used alongside either the invoiceId or billingPeriod parameters. If a timePeriod, invoiceId or billingPeriod parameter is not provided in the request body the API will return the current month's cost. API only allows data to be pulled for 1 month or less and no older than 13 months. If no timePeriod or billingPeriod or invoiceId is provided the API defaults to the open month time period */ + timePeriod?: CostDetailsTimePeriod; + /** This parameter can be used only by Enterprise Agreement customers. Use the YearMonth(e.g. 202008) format. This parameter cannot be used alongside either the invoiceId or timePeriod parameters. If a timePeriod, invoiceId or billingPeriod parameter is not provided in the request body the API will return the current month's cost. */ + billingPeriod?: string; + /** This parameter can only be used by Microsoft Customer Agreement customers. Additionally, it can only be used at the Billing Profile or Customer scope. This parameter cannot be used alongside either the billingPeriod or timePeriod parameters. If a timePeriod, invoiceId or billingPeriod parameter is not provided in the request body the API will return the current month's cost. */ + invoiceId?: string; +} + +export function generateCostDetailsReportRequestDefinitionSerializer( + item: GenerateCostDetailsReportRequestDefinition, +): any { + return { + metric: item["metric"], + timePeriod: !item["timePeriod"] + ? item["timePeriod"] + : costDetailsTimePeriodSerializer(item["timePeriod"]), + billingPeriod: item["billingPeriod"], + invoiceId: item["invoiceId"], + }; +} + +export function generateCostDetailsReportRequestDefinitionDeserializer( + item: any, +): GenerateCostDetailsReportRequestDefinition { + return { + metric: item["metric"], + timePeriod: !item["timePeriod"] + ? item["timePeriod"] + : costDetailsTimePeriodDeserializer(item["timePeriod"]), + billingPeriod: item["billingPeriod"], + invoiceId: item["invoiceId"], + }; +} + +/** The type of the detailed report. By default ActualCost is provided */ +export enum KnownCostDetailsMetricType { + /** Actual cost data. */ + ActualCostCostDetailsMetricType = "ActualCost", + /** Amortized cost data. */ + AmortizedCostCostDetailsMetricType = "AmortizedCost", +} + +/** + * The type of the detailed report. By default ActualCost is provided \ + * {@link KnownCostDetailsMetricType} can be used interchangeably with CostDetailsMetricType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ActualCost**: Actual cost data. \ + * **AmortizedCost**: Amortized cost data. + */ +export type CostDetailsMetricType = string; + +/** 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. */ +export interface CostDetailsTimePeriod { + /** The start date to pull data from. example format 2020-03-15 */ + start: string; + /** The end date to pull data to. example format 2020-03-15 */ + end: string; +} + +export function costDetailsTimePeriodSerializer(item: CostDetailsTimePeriod): any { + return { start: item["start"], end: item["end"] }; +} + +export function costDetailsTimePeriodDeserializer(item: any): CostDetailsTimePeriod { + return { + start: item["start"], + end: item["end"], + }; +} + +export function blobInfoArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return blobInfoDeserializer(item); + }); +} + +/** The blob information generated by this operation. */ +export interface BlobInfo { + /** Link to the blob to download file. */ + blobLink?: string; + /** Bytes in the blob. */ + byteCount?: number; +} + +export function blobInfoDeserializer(item: any): BlobInfo { + return { + blobLink: item["blobLink"], + byteCount: item["byteCount"], + }; +} + +/** + * 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. + */ +export interface GenerateCostDetailsReportErrorResponse { + /** The details of the error. */ + error?: ErrorDetails; +} + +export function generateCostDetailsReportErrorResponseDeserializer( + item: any, +): GenerateCostDetailsReportErrorResponse { + return { + error: !item["error"] ? item["error"] : errorDetailsDeserializer(item["error"]), + }; +} + +/** The error detail. */ +export interface ErrorDetail { + /** The error code. */ + readonly code?: string; + /** The error message. */ + readonly message?: string; + /** The error target. */ + readonly target?: string; + /** The error details. */ + readonly details?: ErrorDetail[]; + /** The error additional info. */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +export function errorDetailDeserializer(item: any): ErrorDetail { + return { + code: item["code"], + message: item["message"], + target: item["target"], + details: !item["details"] ? item["details"] : errorDetailArrayDeserializer(item["details"]), + additionalInfo: !item["additionalInfo"] + ? item["additionalInfo"] + : errorAdditionalInfoArrayDeserializer(item["additionalInfo"]), + }; +} + +export function errorDetailArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return errorDetailDeserializer(item); + }); +} + +export function errorAdditionalInfoArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return errorAdditionalInfoDeserializer(item); + }); +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** The additional info type. */ + readonly type?: string; + /** The additional info. */ + readonly info?: any; +} + +export function errorAdditionalInfoDeserializer(item: any): ErrorAdditionalInfo { + return { + type: item["type"], + info: item["info"], + }; +} + +/** The cost allocation rule model definition */ +export interface CostAllocationRuleDefinition extends ProxyResource { + /** Cost allocation rule properties */ + properties?: CostAllocationRuleProperties; +} + +export function costAllocationRuleDefinitionSerializer(item: CostAllocationRuleDefinition): any { + return { + properties: !item["properties"] + ? item["properties"] + : costAllocationRulePropertiesSerializer(item["properties"]), + }; +} + +export function costAllocationRuleDefinitionDeserializer(item: any): CostAllocationRuleDefinition { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : costAllocationRulePropertiesDeserializer(item["properties"]), + }; +} + +/** The properties of a cost allocation rule */ +export interface CostAllocationRuleProperties { + /** Description of a cost allocation rule. */ + description?: string; + /** Resource information for the cost allocation rule */ + details: CostAllocationRuleDetails; + /** Status of the rule */ + status: RuleStatus; + /** Time at which the rule was created. Rules that change cost for the same resource are applied in order of creation. */ + readonly createdDate?: Date; + /** Time at which the rule was last updated. */ + readonly updatedDate?: Date; +} + +export function costAllocationRulePropertiesSerializer(item: CostAllocationRuleProperties): any { + return { + description: item["description"], + details: costAllocationRuleDetailsSerializer(item["details"]), + status: item["status"], + }; +} + +export function costAllocationRulePropertiesDeserializer(item: any): CostAllocationRuleProperties { + return { + description: item["description"], + details: costAllocationRuleDetailsDeserializer(item["details"]), + status: item["status"], + createdDate: !item["createdDate"] ? item["createdDate"] : new Date(item["createdDate"]), + updatedDate: !item["updatedDate"] ? item["updatedDate"] : new Date(item["updatedDate"]), + }; +} + +/** Resource details of the cost allocation rule */ +export interface CostAllocationRuleDetails { + /** Source resources for cost allocation. At this time, this list can contain no more than one element. */ + sourceResources?: SourceCostAllocationResource[]; + /** Target resources for cost allocation. At this time, this list can contain no more than one element. */ + targetResources?: TargetCostAllocationResource[]; +} + +export function costAllocationRuleDetailsSerializer(item: CostAllocationRuleDetails): any { + return { + sourceResources: !item["sourceResources"] + ? item["sourceResources"] + : sourceCostAllocationResourceArraySerializer(item["sourceResources"]), + targetResources: !item["targetResources"] + ? item["targetResources"] + : targetCostAllocationResourceArraySerializer(item["targetResources"]), + }; +} + +export function costAllocationRuleDetailsDeserializer(item: any): CostAllocationRuleDetails { + return { + sourceResources: !item["sourceResources"] + ? item["sourceResources"] + : sourceCostAllocationResourceArrayDeserializer(item["sourceResources"]), + targetResources: !item["targetResources"] + ? item["targetResources"] + : targetCostAllocationResourceArrayDeserializer(item["targetResources"]), + }; +} + +export function sourceCostAllocationResourceArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return sourceCostAllocationResourceSerializer(item); + }); +} + +export function sourceCostAllocationResourceArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return sourceCostAllocationResourceDeserializer(item); + }); +} + +/** Source resources for cost allocation */ +export interface SourceCostAllocationResource extends CostAllocationResource { + /** Source Resources for cost allocation. This list cannot contain more than 25 values. */ + values: string[]; +} + +export function sourceCostAllocationResourceSerializer(item: SourceCostAllocationResource): any { + return { + resourceType: item["resourceType"], + name: item["name"], + values: item["values"].map((p: any) => { + return p; + }), + }; +} + +export function sourceCostAllocationResourceDeserializer(item: any): SourceCostAllocationResource { + return { + resourceType: item["resourceType"], + name: item["name"], + values: item["values"].map((p: any) => { + return p; + }), + }; +} + +export function targetCostAllocationResourceArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return targetCostAllocationResourceSerializer(item); + }); +} + +export function targetCostAllocationResourceArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return targetCostAllocationResourceDeserializer(item); + }); +} + +/** Target resources for cost allocation. */ +export interface TargetCostAllocationResource extends CostAllocationResource { + /** Target resources for cost allocation. This list cannot contain more than 25 values. */ + values: CostAllocationProportion[]; + /** Method of cost allocation for the rule */ + policyType: CostAllocationPolicyType; +} + +export function targetCostAllocationResourceSerializer(item: TargetCostAllocationResource): any { + return { + resourceType: item["resourceType"], + name: item["name"], + values: costAllocationProportionArraySerializer(item["values"]), + policyType: item["policyType"], + }; +} + +export function targetCostAllocationResourceDeserializer(item: any): TargetCostAllocationResource { + return { + resourceType: item["resourceType"], + name: item["name"], + values: costAllocationProportionArrayDeserializer(item["values"]), + policyType: item["policyType"], + }; +} + +export function costAllocationProportionArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return costAllocationProportionSerializer(item); + }); +} + +export function costAllocationProportionArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return costAllocationProportionDeserializer(item); + }); +} + +/** Target resources and allocation */ +export interface CostAllocationProportion { + /** Target resource for cost allocation */ + name: string; + /** Percentage of source cost to allocate to this resource. This value can be specified to two decimal places and the total percentage of all resources in this rule must sum to 100.00. */ + percentage: number; +} + +export function costAllocationProportionSerializer(item: CostAllocationProportion): any { + return { name: item["name"], percentage: item["percentage"] }; +} + +export function costAllocationProportionDeserializer(item: any): CostAllocationProportion { + return { + name: item["name"], + percentage: item["percentage"], + }; +} + +/** Method to use for allocating cost. FixedProportion indicates that cost will be split based on specified percentage values. */ +export enum KnownCostAllocationPolicyType { + /** FixedProportion */ + FixedProportion = "FixedProportion", +} + +/** + * Method to use for allocating cost. FixedProportion indicates that cost will be split based on specified percentage values. \ + * {@link KnownCostAllocationPolicyType} can be used interchangeably with CostAllocationPolicyType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **FixedProportion** + */ +export type CostAllocationPolicyType = string; + +/** Current status of the rule. */ +export enum KnownRuleStatus { + /** Rule is saved but not used to allocate costs. */ + NotActive = "NotActive", + /** Rule is saved and impacting cost allocation. */ + Active = "Active", + /** Rule is saved and cost allocation is being updated. Readonly value that cannot be submitted in a put request. */ + Processing = "Processing", +} + +/** + * Current status of the rule. \ + * {@link KnownRuleStatus} can be used interchangeably with RuleStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **NotActive**: Rule is saved but not used to allocate costs. \ + * **Active**: Rule is saved and impacting cost allocation. \ + * **Processing**: Rule is saved and cost allocation is being updated. Readonly value that cannot be submitted in a put request. + */ +export type RuleStatus = string; + +/** Common values for resources for cost allocation */ +export interface CostAllocationResource { + /** Type of resources contained in this cost allocation rule */ + resourceType: CostAllocationResourceType; + /** If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag */ + name: string; +} + +export function costAllocationResourceSerializer(item: CostAllocationResource): any { + return { resourceType: item["resourceType"], name: item["name"] }; +} + +export function costAllocationResourceDeserializer(item: any): CostAllocationResource { + return { + resourceType: item["resourceType"], + name: item["name"], + }; +} + +/** Category of resource to use for allocation. */ +export enum KnownCostAllocationResourceType { + /** Indicates an Azure dimension such as a subscription id or resource group name is being used for allocation. */ + Dimension = "Dimension", + /** Allocates cost based on Azure Tag key value pairs. */ + Tag = "Tag", +} + +/** + * Category of resource to use for allocation. \ + * {@link KnownCostAllocationResourceType} can be used interchangeably with CostAllocationResourceType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Dimension**: Indicates an Azure dimension such as a subscription id or resource group name is being used for allocation. \ + * **Tag**: Allocates cost based on Azure Tag key value pairs. + */ +export type CostAllocationResourceType = string; + +/** Result of listing cost allocation rules. It contains a list of available rules in the billing account or enterprise enrollment provided. */ +export interface _CostAllocationRuleList { + /** The list of cost allocation rules. */ + value?: CostAllocationRuleDefinition[]; + /** URL to get the next set of rule list results if there are any. */ + nextLink?: string; +} + +export function _costAllocationRuleListDeserializer(item: any): _CostAllocationRuleList { + return { + value: !item["value"] + ? item["value"] + : costAllocationRuleDefinitionArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function costAllocationRuleDefinitionArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return costAllocationRuleDefinitionSerializer(item); + }); +} + +export function costAllocationRuleDefinitionArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return costAllocationRuleDefinitionDeserializer(item); + }); +} + +/** The cost allocation rule check name availability request */ +export interface CostAllocationRuleCheckNameAvailabilityRequest { + /** Rule name */ + name?: string; + /** Resource type. This is expected to be Microsoft.CostManagement/costAllocationRules */ + type?: string; +} + +export function costAllocationRuleCheckNameAvailabilityRequestSerializer( + item: CostAllocationRuleCheckNameAvailabilityRequest, +): any { + return { name: item["name"], type: item["type"] }; +} + +/** The cost allocation rule check name availability response */ +export interface CostAllocationRuleCheckNameAvailabilityResponse { + /** Whether this rule name is available */ + nameAvailable?: boolean; + /** The reason this name is not available */ + reason?: Reason; + /** Error message if the name is not available */ + message?: string; +} + +export function costAllocationRuleCheckNameAvailabilityResponseDeserializer( + item: any, +): CostAllocationRuleCheckNameAvailabilityResponse { + return { + nameAvailable: item["nameAvailable"], + reason: item["reason"], + message: item["message"], + }; +} + +/** The reason this name is not available. */ +export enum KnownReason { + /** Invalid */ + Invalid = "Invalid", + /** AlreadyExists */ + AlreadyExists = "AlreadyExists", + /** Valid */ + Valid = "Valid", +} + +/** + * The reason this name is not available. \ + * {@link KnownReason} can be used interchangeably with Reason, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Invalid** \ + * **AlreadyExists** \ + * **Valid** + */ +export type Reason = string; + +/** Result of listing benefit recommendations. */ +export interface _BenefitRecommendationsListResult { + /** The list of benefit recommendations. */ + readonly value?: BenefitRecommendationModel[]; + /** The link (url) to the next page of results. */ + nextLink?: string; +} + +export function _benefitRecommendationsListResultDeserializer( + item: any, +): _BenefitRecommendationsListResult { + return { + value: !item["value"] + ? item["value"] + : benefitRecommendationModelArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function benefitRecommendationModelArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return benefitRecommendationModelDeserializer(item); + }); +} + +/** benefit plan recommendation details. */ +export interface BenefitRecommendationModel extends BenefitResource { + /** The properties of the benefit recommendations. */ + properties?: BenefitRecommendationPropertiesUnion; +} + +export function benefitRecommendationModelDeserializer(item: any): BenefitRecommendationModel { + return { + kind: item["kind"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : benefitRecommendationPropertiesUnionDeserializer(item["properties"]), + }; +} + +/** The properties of the benefit recommendations. */ +export interface BenefitRecommendationProperties { + /** The first usage date used for looking back for computing the recommendations. */ + readonly firstConsumptionDate?: Date; + /** The last usage date used for looking back for computing the recommendations. */ + readonly lastConsumptionDate?: Date; + /** The number of days of usage evaluated for computing the recommendations. */ + lookBackPeriod?: LookBackPeriod; + /** The total hours for which the cost is covered. Its equal to number of records in a property 'properties/usage/charges'. */ + readonly totalHours?: number; + /** On-demand charges between firstConsumptionDate and lastConsumptionDate that were used for computing benefit recommendations. */ + usage?: RecommendationUsageDetails; + /** ARM SKU name. 'Compute_Savings_Plan' for SavingsPlan. */ + readonly armSkuName?: string; + /** Term period of the benefit. For example, P1Y or P3Y. */ + term?: Term; + /** Grain of the proposed commitment amount. Supported values: 'Hourly' */ + commitmentGranularity?: Grain; + /** An ISO 4217 currency code identifier for the costs and savings amounts. */ + readonly currencyCode?: string; + /** The current cost without benefit, corresponds to 'totalHours' in the look-back period. */ + readonly costWithoutBenefit?: number; + /** The details of the proposed recommendation. */ + recommendationDetails?: AllSavingsBenefitDetails; + /** The list of all benefit recommendations with the recommendation details. */ + readonly allRecommendationDetails?: AllSavingsList; + /** Benefit scope. For example, Single or Shared. */ + /** The discriminator possible values: Single, Shared */ + scope: Scope; +} + +export function benefitRecommendationPropertiesDeserializer( + item: any, +): BenefitRecommendationProperties { + return { + firstConsumptionDate: !item["firstConsumptionDate"] + ? item["firstConsumptionDate"] + : new Date(item["firstConsumptionDate"]), + lastConsumptionDate: !item["lastConsumptionDate"] + ? item["lastConsumptionDate"] + : new Date(item["lastConsumptionDate"]), + lookBackPeriod: item["lookBackPeriod"], + totalHours: item["totalHours"], + usage: !item["usage"] ? item["usage"] : recommendationUsageDetailsDeserializer(item["usage"]), + armSkuName: item["armSkuName"], + term: item["term"], + commitmentGranularity: item["commitmentGranularity"], + currencyCode: item["currencyCode"], + costWithoutBenefit: item["costWithoutBenefit"], + recommendationDetails: !item["recommendationDetails"] + ? item["recommendationDetails"] + : allSavingsBenefitDetailsDeserializer(item["recommendationDetails"]), + allRecommendationDetails: !item["allRecommendationDetails"] + ? item["allRecommendationDetails"] + : allSavingsListDeserializer(item["allRecommendationDetails"]), + scope: item["scope"], + }; +} + +/** Alias for BenefitRecommendationPropertiesUnion */ +export type BenefitRecommendationPropertiesUnion = + | SingleScopeBenefitRecommendationProperties + | SharedScopeBenefitRecommendationProperties + | BenefitRecommendationProperties; + +export function benefitRecommendationPropertiesUnionDeserializer( + item: any, +): BenefitRecommendationPropertiesUnion { + switch (item["scope"]) { + case "Single": + return singleScopeBenefitRecommendationPropertiesDeserializer( + item as SingleScopeBenefitRecommendationProperties, + ); + + case "Shared": + return sharedScopeBenefitRecommendationPropertiesDeserializer( + item as SharedScopeBenefitRecommendationProperties, + ); + + default: + return benefitRecommendationPropertiesDeserializer(item); + } +} + +/** The number of days used to look back. */ +export enum KnownLookBackPeriod { + /** 7 days used to look back. */ + Last7Days = "Last7Days", + /** 30 days used to look back. */ + Last30Days = "Last30Days", + /** 60 days used to look back. */ + Last60Days = "Last60Days", +} + +/** + * The number of days used to look back. \ + * {@link KnownLookBackPeriod} can be used interchangeably with LookBackPeriod, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Last7Days**: 7 days used to look back. \ + * **Last30Days**: 30 days used to look back. \ + * **Last60Days**: 60 days used to look back. + */ +export type LookBackPeriod = string; + +/** On-demand charges between firstConsumptionDate and lastConsumptionDate that were used for computing benefit recommendations. */ +export interface RecommendationUsageDetails { + /** The grain of the usage. Supported values: 'Hourly' */ + usageGrain?: Grain; + /** On-demand charges for each hour between firstConsumptionDate and lastConsumptionDate that were used for computing benefit recommendations. */ + readonly charges?: number[]; +} + +export function recommendationUsageDetailsDeserializer(item: any): RecommendationUsageDetails { + return { + usageGrain: item["usageGrain"], + charges: !item["charges"] + ? item["charges"] + : item["charges"].map((p: any) => { + return p; + }), + }; +} + +/** Grain which corresponds to value. */ +export enum KnownGrain { + /** Hourly grain corresponds to value per hour. */ + Hourly = "Hourly", + /** Hourly grain corresponds to value per day. */ + Daily = "Daily", + /** Hourly grain corresponds to value per month. */ + Monthly = "Monthly", +} + +/** + * Grain which corresponds to value. \ + * {@link KnownGrain} can be used interchangeably with Grain, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Hourly**: Hourly grain corresponds to value per hour. \ + * **Daily**: Hourly grain corresponds to value per day. \ + * **Monthly**: Hourly grain corresponds to value per month. + */ +export type Grain = string; + +/** Grain which corresponds to value. */ +export enum KnownTerm { + /** Benefit term is 1 year. */ + P1Y = "P1Y", + /** Benefit term is 3 years. */ + P3Y = "P3Y", +} + +/** + * Grain which corresponds to value. \ + * {@link KnownTerm} can be used interchangeably with Term, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **P1Y**: Benefit term is 1 year. \ + * **P3Y**: Benefit term is 3 years. + */ +export type Term = string; + +/** Benefit recommendation details. */ +export interface AllSavingsBenefitDetails { + /** The difference between total cost and benefit cost for the 'totalHours' in the look-back period. */ + readonly overageCost?: number; + /** The estimated cost with benefit for the 'totalHours' in the look-back period. It's equal to (commitmentAmount * totalHours) */ + readonly benefitCost?: number; + /** Total cost, which is sum of benefit cost and overage cost. */ + readonly totalCost?: number; + /** The amount saved for the 'totalHours' in the look-back period, by purchasing the recommended quantity of the benefit. */ + readonly savingsAmount?: number; + /** The savings in percentage for the 'totalHours' in the look-back period, by purchasing the recommended quantity of benefit. */ + readonly savingsPercentage?: number; + /** Estimated benefit coverage percentage for the 'totalHours' in the look-back period, with this commitment. */ + readonly coveragePercentage?: number; + /** The commitment amount at the commitmentGranularity. */ + readonly commitmentAmount?: number; + /** Estimated average utilization percentage for the 'totalHours' in the look-back period, with this commitment. */ + readonly averageUtilizationPercentage?: number; + /** Estimated unused portion of the 'benefitCost'. */ + readonly wastageCost?: number; +} + +export function allSavingsBenefitDetailsDeserializer(item: any): AllSavingsBenefitDetails { + return { + overageCost: item["overageCost"], + benefitCost: item["benefitCost"], + totalCost: item["totalCost"], + savingsAmount: item["savingsAmount"], + savingsPercentage: item["savingsPercentage"], + coveragePercentage: item["coveragePercentage"], + commitmentAmount: item["commitmentAmount"], + averageUtilizationPercentage: item["averageUtilizationPercentage"], + wastageCost: item["wastageCost"], + }; +} + +/** The list of all benefit recommendations with the recommendation details. */ +export interface AllSavingsList { + /** The list of benefit recommendations with the recommendation details.. */ + readonly value?: AllSavingsBenefitDetails[]; + /** The link (URL) to the next page of results. */ + readonly nextLink?: string; +} + +export function allSavingsListDeserializer(item: any): AllSavingsList { + return { + value: !item["value"] + ? item["value"] + : allSavingsBenefitDetailsArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function allSavingsBenefitDetailsArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return allSavingsBenefitDetailsDeserializer(item); + }); +} + +/** Kind of the recommendation scope. */ +export enum KnownScope { + /** Single scope recommendation. */ + Single = "Single", + /** Shared scope recommendation. */ + Shared = "Shared", +} + +/** + * Kind of the recommendation scope. \ + * {@link KnownScope} can be used interchangeably with Scope, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Single**: Single scope recommendation. \ + * **Shared**: Shared scope recommendation. + */ +export type Scope = string; + +/** The properties of the benefit recommendations when scope is 'Single'. */ +export interface SingleScopeBenefitRecommendationProperties extends BenefitRecommendationProperties { + /** The subscription ID that this single scope recommendation is for. Applicable only if recommendation is for 'Single' scope. */ + readonly subscriptionId?: string; + /** The resource group that this single scope recommendation is for. Applicable only if recommendation is for 'Single' scope and 'ResourceGroup' request scope. */ + readonly resourceGroup?: string; + /** Benefit scope. For example, Single or Shared. */ + scope: "Single"; +} + +export function singleScopeBenefitRecommendationPropertiesDeserializer( + item: any, +): SingleScopeBenefitRecommendationProperties { + return { + firstConsumptionDate: !item["firstConsumptionDate"] + ? item["firstConsumptionDate"] + : new Date(item["firstConsumptionDate"]), + lastConsumptionDate: !item["lastConsumptionDate"] + ? item["lastConsumptionDate"] + : new Date(item["lastConsumptionDate"]), + lookBackPeriod: item["lookBackPeriod"], + totalHours: item["totalHours"], + usage: !item["usage"] ? item["usage"] : recommendationUsageDetailsDeserializer(item["usage"]), + armSkuName: item["armSkuName"], + term: item["term"], + commitmentGranularity: item["commitmentGranularity"], + currencyCode: item["currencyCode"], + costWithoutBenefit: item["costWithoutBenefit"], + recommendationDetails: !item["recommendationDetails"] + ? item["recommendationDetails"] + : allSavingsBenefitDetailsDeserializer(item["recommendationDetails"]), + allRecommendationDetails: !item["allRecommendationDetails"] + ? item["allRecommendationDetails"] + : allSavingsListDeserializer(item["allRecommendationDetails"]), + scope: item["scope"], + subscriptionId: item["subscriptionId"], + resourceGroup: item["resourceGroup"], + }; +} + +/** The properties of the benefit recommendation when scope is 'Shared'. */ +export interface SharedScopeBenefitRecommendationProperties extends BenefitRecommendationProperties { + /** Benefit scope. For example, Single or Shared. */ + scope: "Shared"; +} + +export function sharedScopeBenefitRecommendationPropertiesDeserializer( + item: any, +): SharedScopeBenefitRecommendationProperties { + return { + firstConsumptionDate: !item["firstConsumptionDate"] + ? item["firstConsumptionDate"] + : new Date(item["firstConsumptionDate"]), + lastConsumptionDate: !item["lastConsumptionDate"] + ? item["lastConsumptionDate"] + : new Date(item["lastConsumptionDate"]), + lookBackPeriod: item["lookBackPeriod"], + totalHours: item["totalHours"], + usage: !item["usage"] ? item["usage"] : recommendationUsageDetailsDeserializer(item["usage"]), + armSkuName: item["armSkuName"], + term: item["term"], + commitmentGranularity: item["commitmentGranularity"], + currencyCode: item["currencyCode"], + costWithoutBenefit: item["costWithoutBenefit"], + recommendationDetails: !item["recommendationDetails"] + ? item["recommendationDetails"] + : allSavingsBenefitDetailsDeserializer(item["recommendationDetails"]), + allRecommendationDetails: !item["allRecommendationDetails"] + ? item["allRecommendationDetails"] + : allSavingsListDeserializer(item["allRecommendationDetails"]), + scope: item["scope"], + }; +} + +/** The benefit resource model definition. */ +export interface BenefitResource extends Resource { + /** Reservation or SavingsPlan. */ + kind?: BenefitKind; +} + +export function benefitResourceDeserializer(item: any): BenefitResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + kind: item["kind"], + }; +} + +/** Kind/type of the benefit. */ +export enum KnownBenefitKind { + /** Benefit is IncludedQuantity. */ + IncludedQuantity = "IncludedQuantity", + /** Benefit is Reservation. */ + Reservation = "Reservation", + /** Benefit is SavingsPlan. */ + SavingsPlan = "SavingsPlan", +} + +/** + * Kind/type of the benefit. \ + * {@link KnownBenefitKind} can be used interchangeably with BenefitKind, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **IncludedQuantity**: Benefit is IncludedQuantity. \ + * **Reservation**: Benefit is Reservation. \ + * **SavingsPlan**: Benefit is SavingsPlan. + */ +export type BenefitKind = string; + +/** List of benefit utilization summaries. */ +export interface _BenefitUtilizationSummariesListResult { + /** The list of benefit utilization summaries. */ + readonly value?: BenefitUtilizationSummaryUnion[]; + /** The link (URL) to the next page of results. */ + nextLink?: string; +} + +export function _benefitUtilizationSummariesListResultDeserializer( + item: any, +): _BenefitUtilizationSummariesListResult { + return { + value: !item["value"] + ? item["value"] + : benefitUtilizationSummaryUnionArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function benefitUtilizationSummaryUnionArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return benefitUtilizationSummaryUnionDeserializer(item); + }); +} + +/** Benefit utilization summary resource. */ +export interface BenefitUtilizationSummary extends Resource { + /** Supported values: 'SavingsPlan'. */ + /** The discriminator possible values: IncludedQuantity, SavingsPlan */ + kind: BenefitKind; +} + +export function benefitUtilizationSummaryDeserializer(item: any): BenefitUtilizationSummary { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + kind: item["kind"], + }; +} + +/** Alias for BenefitUtilizationSummaryUnion */ +export type BenefitUtilizationSummaryUnion = + | IncludedQuantityUtilizationSummary + | SavingsPlanUtilizationSummary + | BenefitUtilizationSummary; + +export function benefitUtilizationSummaryUnionDeserializer( + item: any, +): BenefitUtilizationSummaryUnion { + switch (item["kind"]) { + case "IncludedQuantity": + return includedQuantityUtilizationSummaryDeserializer( + item as IncludedQuantityUtilizationSummary, + ); + + case "SavingsPlan": + return savingsPlanUtilizationSummaryDeserializer(item as SavingsPlanUtilizationSummary); + + default: + return benefitUtilizationSummaryDeserializer(item); + } +} + +/** Included Quantity utilization summary resource. */ +export interface IncludedQuantityUtilizationSummary extends BenefitUtilizationSummary { + /** Supported values: 'SavingsPlan'. */ + kind: "IncludedQuantity"; + /** ARM SKU name. For example, 'Compute_Savings_Plan' for savings plan. */ + readonly armSkuName?: string; + /** The benefit ID is the identifier of the benefit. */ + readonly benefitId?: string; + /** The benefit order ID is the identifier for a benefit purchase. */ + readonly benefitOrderId?: string; + /** The benefit type. Supported values: 'SavingsPlan'. */ + benefitType?: BenefitKind; + /** Date corresponding to the utilization summary record. If the grain of data is monthly, value for this field will be first day of the month. */ + readonly usageDate?: Date; + /** This is the utilized percentage for the benefit ID. */ + readonly utilizationPercentage?: number; +} + +export function includedQuantityUtilizationSummaryDeserializer( + item: any, +): IncludedQuantityUtilizationSummary { + return { + kind: item["kind"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : _includedQuantityUtilizationSummaryPropertiesDeserializer(item["properties"])), + }; +} + +/** Included Quantity utilization summary properties. */ +export interface IncludedQuantityUtilizationSummaryProperties extends BenefitUtilizationSummaryProperties { + /** This is the utilized percentage for the benefit ID. */ + readonly utilizationPercentage?: number; +} + +export function includedQuantityUtilizationSummaryPropertiesDeserializer( + item: any, +): IncludedQuantityUtilizationSummaryProperties { + return { + armSkuName: item["armSkuName"], + benefitId: item["benefitId"], + benefitOrderId: item["benefitOrderId"], + benefitType: item["benefitType"], + usageDate: !item["usageDate"] ? item["usageDate"] : new Date(item["usageDate"]), + utilizationPercentage: item["utilizationPercentage"], + }; +} + +/** Savings plan utilization summary resource. */ +export interface SavingsPlanUtilizationSummary extends BenefitUtilizationSummary { + /** Supported values: 'SavingsPlan'. */ + kind: "SavingsPlan"; + /** ARM SKU name. For example, 'Compute_Savings_Plan' for savings plan. */ + readonly armSkuName?: string; + /** The benefit ID is the identifier of the benefit. */ + readonly benefitId?: string; + /** The benefit order ID is the identifier for a benefit purchase. */ + readonly benefitOrderId?: string; + /** The benefit type. Supported values: 'SavingsPlan'. */ + benefitType?: BenefitKind; + /** Date corresponding to the utilization summary record. If the grain of data is monthly, value for this field will be first day of the month. */ + readonly usageDate?: Date; + /** This is the average hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2025-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the avgUtilizationPercentage value will be equal to the average of the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. */ + readonly avgUtilizationPercentage?: number; + /** This is the minimum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2025-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the minUtilizationPercentage value will be equal to the smallest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the lowest utilization percentage was 10% at hour 4, then the value for the minUtilizationPercentage in the response will be 10%. */ + readonly minUtilizationPercentage?: number; + /** This is the maximum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2025-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the maxUtilizationPercentage value will be equal to the largest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the largest utilization percentage was 90% at hour 5, then the value for the maxUtilizationPercentage in the response will be 90%. */ + readonly maxUtilizationPercentage?: number; +} + +export function savingsPlanUtilizationSummaryDeserializer( + item: any, +): SavingsPlanUtilizationSummary { + return { + kind: item["kind"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : _savingsPlanUtilizationSummaryPropertiesDeserializer(item["properties"])), + }; +} + +/** Savings plan utilization summary properties. */ +export interface SavingsPlanUtilizationSummaryProperties extends BenefitUtilizationSummaryProperties { + /** This is the average hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2025-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the avgUtilizationPercentage value will be equal to the average of the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. */ + readonly avgUtilizationPercentage?: number; + /** This is the minimum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2025-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the minUtilizationPercentage value will be equal to the smallest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the lowest utilization percentage was 10% at hour 4, then the value for the minUtilizationPercentage in the response will be 10%. */ + readonly minUtilizationPercentage?: number; + /** This is the maximum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2025-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the maxUtilizationPercentage value will be equal to the largest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the largest utilization percentage was 90% at hour 5, then the value for the maxUtilizationPercentage in the response will be 90%. */ + readonly maxUtilizationPercentage?: number; +} + +export function savingsPlanUtilizationSummaryPropertiesDeserializer( + item: any, +): SavingsPlanUtilizationSummaryProperties { + return { + armSkuName: item["armSkuName"], + benefitId: item["benefitId"], + benefitOrderId: item["benefitOrderId"], + benefitType: item["benefitType"], + usageDate: !item["usageDate"] ? item["usageDate"] : new Date(item["usageDate"]), + avgUtilizationPercentage: item["avgUtilizationPercentage"], + minUtilizationPercentage: item["minUtilizationPercentage"], + maxUtilizationPercentage: item["maxUtilizationPercentage"], + }; +} + +/** The properties of a benefit utilization summary. */ +export interface BenefitUtilizationSummaryProperties { + /** ARM SKU name. For example, 'Compute_Savings_Plan' for savings plan. */ + readonly armSkuName?: string; + /** The benefit ID is the identifier of the benefit. */ + readonly benefitId?: string; + /** The benefit order ID is the identifier for a benefit purchase. */ + readonly benefitOrderId?: string; + /** The benefit type. Supported values: 'SavingsPlan'. */ + benefitType?: BenefitKind; + /** Date corresponding to the utilization summary record. If the grain of data is monthly, value for this field will be first day of the month. */ + readonly usageDate?: Date; +} + +export function benefitUtilizationSummaryPropertiesDeserializer( + item: any, +): BenefitUtilizationSummaryProperties { + return { + armSkuName: item["armSkuName"], + benefitId: item["benefitId"], + benefitOrderId: item["benefitOrderId"], + benefitType: item["benefitType"], + usageDate: !item["usageDate"] ? item["usageDate"] : new Date(item["usageDate"]), + }; +} + +/** Properties of an async benefit utilization summaries request. */ +export interface BenefitUtilizationSummariesRequest { + /** Billing account the benefit utilization summaries report is for. Required for billing account and billing profile scopes. Not supported for any benefit scopes. */ + billingAccountId?: string; + /** Billing profile id the benefit utilization summaries report is for. Required for billing profile scope. Not supported for billing account or any benefit scopes. */ + billingProfileId?: string; + /** Benefit order id the benefit utilization summaries report is for. Required for benefit order and benefit id scopes. Not supported for any billing scopes. */ + benefitOrderId?: string; + /** Benefit id the benefit utilization summaries report is for. Required for benefit id scope. Not supported for benefit order or any billing scopes. */ + benefitId?: string; + /** The grain the summaries data is served at in the report. Accepted values are 'Daily' or 'Monthly'. */ + grain: Grain; + /** The start date of the summaries data that will be served in the report. */ + startDate: Date; + /** The end date of the summaries data that will be served in the report. */ + endDate: Date; + /** The type of benefit data requested. Required for billing account and billing profile scopes. Implied and not to be passed at benefit scopes. Supported values are Reservation and SavingsPlan */ + kind?: BenefitKind; +} + +export function benefitUtilizationSummariesRequestSerializer( + item: BenefitUtilizationSummariesRequest, +): any { + return { + billingAccountId: item["billingAccountId"], + billingProfileId: item["billingProfileId"], + benefitOrderId: item["benefitOrderId"], + benefitId: item["benefitId"], + grain: item["grain"], + startDate: item["startDate"].toISOString(), + endDate: item["endDate"].toISOString(), + kind: item["kind"], + }; +} + +export function benefitUtilizationSummariesRequestDeserializer( + item: any, +): BenefitUtilizationSummariesRequest { + return { + billingAccountId: item["billingAccountId"], + billingProfileId: item["billingProfileId"], + benefitOrderId: item["benefitOrderId"], + benefitId: item["benefitId"], + grain: item["grain"], + startDate: new Date(item["startDate"]), + endDate: new Date(item["endDate"]), + kind: item["kind"], + }; +} + +/** Status of a benefit utilization summaries report. Provides Async Benefit Utilization Summaries Request input, status, and report sas url. */ +export interface BenefitUtilizationSummariesOperationStatus { + /** Input given to create the benefit utilization summaries report. */ + input?: BenefitUtilizationSummariesRequest; + /** The status of the creation of the benefit utilization summaries report. */ + status?: OperationStatusType; + /** Contains sas url to the async benefit utilization summaries report and a date that the url is valid until. These values will be empty if the report is in a Running or Failed state */ + properties?: AsyncOperationStatusProperties; +} + +export function benefitUtilizationSummariesOperationStatusDeserializer( + item: any, +): BenefitUtilizationSummariesOperationStatus { + return { + input: !item["input"] + ? item["input"] + : benefitUtilizationSummariesRequestDeserializer(item["input"]), + status: item["status"], + properties: !item["properties"] + ? item["properties"] + : asyncOperationStatusPropertiesDeserializer(item["properties"]), + }; +} + +/** Enum representing the status of an async operation. */ +export enum KnownOperationStatusType { + /** Running */ + Running = "Running", + /** Completed */ + Completed = "Completed", + /** Failed */ + Failed = "Failed", +} + +/** + * Enum representing the status of an async operation. \ + * {@link KnownOperationStatusType} can be used interchangeably with OperationStatusType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Running** \ + * **Completed** \ + * **Failed** + */ +export type OperationStatusType = string; + +/** Object representing the report url and valid until date of the async report generated. */ +export interface AsyncOperationStatusProperties { + /** Sas url to the async benefit utilization summaries report. Will be empty if the report is in Running or Failed state. */ + reportUrl?: BenefitUtilizationSummaryReportSchema; + /** Sas url to async benefit utilization summaries report in secondary storage in case of primary outage. Will be empty if the report is in Running or Failed state. */ + secondaryReportUrl?: BenefitUtilizationSummaryReportSchema; + /** The date that the sas url provided in reportUrl expires. */ + validUntil?: Date; +} + +export function asyncOperationStatusPropertiesDeserializer( + item: any, +): AsyncOperationStatusProperties { + return { + reportUrl: item["reportUrl"], + secondaryReportUrl: item["secondaryReportUrl"], + validUntil: !item["validUntil"] ? item["validUntil"] : new Date(item["validUntil"]), + }; +} + +/** The CSV file from the reportUrl and secondaryReportUrl blob link will consist of the following columns of benefit utilization data. UtilizedPercentage will be 0 for savings plans reports and non data bricks reservations. Utilization percentages will be 0 for data bricks reservations. */ +export enum KnownBenefitUtilizationSummaryReportSchema { + /** Kind */ + Kind = "Kind", + /** AvgUtilizationPercentage */ + AvgUtilizationPercentage = "AvgUtilizationPercentage", + /** BenefitOrderId */ + BenefitOrderId = "BenefitOrderId", + /** BenefitId */ + BenefitId = "BenefitId", + /** BenefitType */ + BenefitType = "BenefitType", + /** MaxUtilizationPercentage */ + MaxUtilizationPercentage = "MaxUtilizationPercentage", + /** MinUtilizationPercentage */ + MinUtilizationPercentage = "MinUtilizationPercentage", + /** UsageDate */ + UsageDate = "UsageDate", + /** UtilizedPercentage */ + UtilizedPercentage = "UtilizedPercentage", +} + +/** + * The CSV file from the reportUrl and secondaryReportUrl blob link will consist of the following columns of benefit utilization data. UtilizedPercentage will be 0 for savings plans reports and non data bricks reservations. Utilization percentages will be 0 for data bricks reservations. \ + * {@link KnownBenefitUtilizationSummaryReportSchema} can be used interchangeably with BenefitUtilizationSummaryReportSchema, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Kind** \ + * **AvgUtilizationPercentage** \ + * **BenefitOrderId** \ + * **BenefitId** \ + * **BenefitType** \ + * **MaxUtilizationPercentage** \ + * **MinUtilizationPercentage** \ + * **UsageDate** \ + * **UtilizedPercentage** + */ +export type BenefitUtilizationSummaryReportSchema = string; + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. */ +export interface ArmErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +export function armErrorResponseDeserializer(item: any): ArmErrorResponse { + return { + error: !item["error"] ? item["error"] : errorDetailDeserializer(item["error"]), + }; +} + +/** The definition of a cost detailed report. */ +export interface GenerateDetailedCostReportDefinition { + /** The type of the detailed report. By default ActualCost is provided */ + metric?: GenerateDetailedCostReportMetricType; + /** 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; + /** 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; + /** Invoice ID for Pay-as-you-go and Microsoft Customer Agreement scopes. Can only have one of either timePeriod or invoiceId or billingPeriod parameters. If none provided current month cost is provided. */ + invoiceId?: string; + /** Customer ID for Microsoft Customer Agreement scopes (Invoice Id is also required for this). */ + customerId?: string; +} + +export function generateDetailedCostReportDefinitionSerializer( + item: GenerateDetailedCostReportDefinition, +): any { + return { + metric: item["metric"], + timePeriod: !item["timePeriod"] + ? item["timePeriod"] + : generateDetailedCostReportTimePeriodSerializer(item["timePeriod"]), + billingPeriod: item["billingPeriod"], + invoiceId: item["invoiceId"], + customerId: item["customerId"], + }; +} + +/** The type of the detailed report. By default ActualCost is provided */ +export enum KnownGenerateDetailedCostReportMetricType { + /** ActualCost */ + ActualCost = "ActualCost", + /** AmortizedCost */ + AmortizedCost = "AmortizedCost", +} + +/** + * The type of the detailed report. By default ActualCost is provided \ + * {@link KnownGenerateDetailedCostReportMetricType} can be used interchangeably with GenerateDetailedCostReportMetricType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ActualCost** \ + * **AmortizedCost** + */ +export type GenerateDetailedCostReportMetricType = string; + +/** The start and end date for pulling data for the cost detailed report. */ +export interface GenerateDetailedCostReportTimePeriod { + /** The start date to pull data from. example format 2020-03-15 */ + start: string; + /** The end date to pull data to. example format 2020-03-15 */ + end: string; +} + +export function generateDetailedCostReportTimePeriodSerializer( + item: GenerateDetailedCostReportTimePeriod, +): any { + return { start: item["start"], end: item["end"] }; +} + +/** + * 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. + */ +export interface GenerateDetailedCostReportErrorResponse { + /** The details of the error. */ + error?: ErrorDetails; +} + +export function generateDetailedCostReportErrorResponseDeserializer( + item: any, +): GenerateDetailedCostReportErrorResponse { + return { + error: !item["error"] ? item["error"] : errorDetailsDeserializer(item["error"]), + }; +} + +/** The definition of a forecast. */ +export interface ForecastDefinition { + /** The type of the forecast. */ + type: ForecastType; + /** The time frame for pulling data for the forecast. If custom, then a specific time period must be provided. */ + timeframe: ForecastTimeframe; + /** Has time period for pulling data for the forecast. */ + timePeriod?: ForecastTimePeriod; + /** Has definition for data in this forecast. */ + dataset: ForecastDataset; + /** A boolean determining if actualCost will be included. */ + includeActualCost?: boolean; + /** A boolean determining if FreshPartialCost will be included. */ + includeFreshPartialCost?: boolean; +} + +export function forecastDefinitionSerializer(item: ForecastDefinition): any { + return { + type: item["type"], + timeframe: item["timeframe"], + timePeriod: !item["timePeriod"] + ? item["timePeriod"] + : forecastTimePeriodSerializer(item["timePeriod"]), + dataset: forecastDatasetSerializer(item["dataset"]), + includeActualCost: item["includeActualCost"], + includeFreshPartialCost: item["includeFreshPartialCost"], + }; +} + +/** The type of the forecast. */ +export enum KnownForecastType { + /** Usage */ + Usage = "Usage", + /** ActualCost */ + ActualCost = "ActualCost", + /** AmortizedCost */ + AmortizedCost = "AmortizedCost", +} + +/** + * The type of the forecast. \ + * {@link KnownForecastType} can be used interchangeably with ForecastType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Usage** \ + * **ActualCost** \ + * **AmortizedCost** + */ +export type ForecastType = string; + +/** The time frame for pulling data for the forecast. */ +export enum KnownForecastTimeframe { + /** Custom */ + Custom = "Custom", +} + +/** + * The time frame for pulling data for the forecast. \ + * {@link KnownForecastTimeframe} can be used interchangeably with ForecastTimeframe, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Custom** + */ +export type ForecastTimeframe = string; + +/** Has time period for pulling data for the forecast. */ +export interface ForecastTimePeriod { + /** The start date to pull data from. */ + from: Date; + /** The end date to pull data to. */ + to: Date; +} + +export function forecastTimePeriodSerializer(item: ForecastTimePeriod): any { + return { from: item["from"].toISOString(), to: item["to"].toISOString() }; +} + +/** The definition of data present in the forecast. */ +export interface ForecastDataset { + /** The granularity of rows in the forecast. */ + granularity?: GranularityType; + /** Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided. */ + configuration?: ForecastDatasetConfiguration; + /** 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: Record; + /** Has filter expression to use in the forecast. */ + filter?: ForecastFilter; +} + +export function forecastDatasetSerializer(item: ForecastDataset): any { + return { + granularity: item["granularity"], + configuration: !item["configuration"] + ? item["configuration"] + : forecastDatasetConfigurationSerializer(item["configuration"]), + aggregation: forecastAggregationRecordSerializer(item["aggregation"]), + filter: !item["filter"] ? item["filter"] : forecastFilterSerializer(item["filter"]), + }; +} + +/** The configuration of dataset in the forecast. */ +export interface ForecastDatasetConfiguration { + /** Array of column names to be included in the forecast. Any valid forecast column name is allowed. If not provided, then forecast includes all columns. */ + columns?: string[]; +} + +export function forecastDatasetConfigurationSerializer(item: ForecastDatasetConfiguration): any { + return { + columns: !item["columns"] + ? item["columns"] + : item["columns"].map((p: any) => { + return p; + }), + }; +} + +export function forecastAggregationRecordSerializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : forecastAggregationSerializer(item[key]); + }); + return result; +} + +/** The aggregation expression to be used in the forecast. */ +export interface ForecastAggregation { + /** The name of the column to aggregate. */ + name: FunctionName; + /** The name of the aggregation function to use. */ + function: FunctionType; +} + +export function forecastAggregationSerializer(item: ForecastAggregation): any { + return { name: item["name"], function: item["function"] }; +} + +/** The name of the column to aggregate. */ +export enum KnownFunctionName { + /** PreTaxCostUSD */ + PreTaxCostUSD = "PreTaxCostUSD", + /** Cost */ + Cost = "Cost", + /** CostUSD */ + CostUSD = "CostUSD", + /** PreTaxCost */ + PreTaxCost = "PreTaxCost", +} + +/** + * The name of the column to aggregate. \ + * {@link KnownFunctionName} can be used interchangeably with FunctionName, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **PreTaxCostUSD** \ + * **Cost** \ + * **CostUSD** \ + * **PreTaxCost** + */ +export type FunctionName = string; + +/** The filter expression to be used in the export. */ +export interface ForecastFilter { + /** The logical "AND" expression. Must have at least 2 items. */ + and?: ForecastFilter[]; + /** The logical "OR" expression. Must have at least 2 items. */ + or?: ForecastFilter[]; + /** Has comparison expression for a dimension */ + dimensions?: ForecastComparisonExpression; + /** Has comparison expression for a tag */ + tags?: ForecastComparisonExpression; +} + +export function forecastFilterSerializer(item: ForecastFilter): any { + return { + and: !item["and"] ? item["and"] : forecastFilterArraySerializer(item["and"]), + or: !item["or"] ? item["or"] : forecastFilterArraySerializer(item["or"]), + dimensions: !item["dimensions"] + ? item["dimensions"] + : forecastComparisonExpressionSerializer(item["dimensions"]), + tags: !item["tags"] ? item["tags"] : forecastComparisonExpressionSerializer(item["tags"]), + }; +} + +export function forecastFilterArraySerializer(result: Array): any[] { + return result.map((item) => { + return forecastFilterSerializer(item); + }); +} + +/** The comparison expression to be used in the forecast. */ +export interface ForecastComparisonExpression { + /** The name of the column to use in comparison. */ + name: string; + /** The operator to use for comparison. */ + operator: ForecastOperatorType; + /** Array of values to use for comparison */ + values: string[]; +} + +export function forecastComparisonExpressionSerializer(item: ForecastComparisonExpression): any { + return { + name: item["name"], + operator: item["operator"], + values: item["values"].map((p: any) => { + return p; + }), + }; +} + +/** The operator to use for comparison. */ +export enum KnownForecastOperatorType { + /** In */ + In = "In", +} + +/** + * The operator to use for comparison. \ + * {@link KnownForecastOperatorType} can be used interchangeably with ForecastOperatorType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **In** + */ +export type ForecastOperatorType = string; + +/** Result of forecast. It contains all columns listed under groupings and aggregation. */ +export interface ForecastResult extends CostManagementResource { + /** The link (url) to the next page of results. */ + nextLink?: string; + /** Array of columns */ + columns?: ForecastColumn[]; + /** Array of rows */ + rows?: any[][]; +} + +export function forecastResultDeserializer(item: any): ForecastResult { + return { + id: item["id"], + name: item["name"], + type: item["type"], + location: item["location"], + sku: item["sku"], + eTag: item["eTag"], + tags: !item["tags"] + ? item["tags"] + : Object.fromEntries(Object.entries(item["tags"]).map(([k, p]: [string, any]) => [k, p])), + ...(!item["properties"] + ? item["properties"] + : _forecastResultPropertiesDeserializer(item["properties"])), + }; +} + +/** Forecast properties */ +export interface ForecastProperties { + /** The link (url) to the next page of results. */ + nextLink?: string; + /** Array of columns */ + columns?: ForecastColumn[]; + /** Array of rows */ + rows?: any[][]; +} + +export function forecastPropertiesDeserializer(item: any): ForecastProperties { + return { + nextLink: item["nextLink"], + columns: !item["columns"] ? item["columns"] : forecastColumnArrayDeserializer(item["columns"]), + rows: !item["rows"] + ? item["rows"] + : item["rows"].map((p: any) => { + return p.map((p1: any) => { + return p1; + }); + }), + }; +} + +export function forecastColumnArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return forecastColumnDeserializer(item); + }); +} + +/** Forecast column properties */ +export interface ForecastColumn { + /** The name of column. */ + name?: string; + /** The type of column. */ + type?: string; +} + +export function forecastColumnDeserializer(item: any): ForecastColumn { + return { + name: item["name"], + type: item["type"], + }; +} + +/** The Resource model definition. */ +export interface CostManagementResource { + /** Resource Id. */ + readonly id?: string; + /** Resource name. */ + readonly name?: string; + /** Resource type. */ + readonly type?: string; + /** Location of the resource. */ + readonly location?: string; + /** SKU of the resource. */ + readonly sku?: string; + /** ETag of the resource. */ + readonly eTag?: string; + /** Resource tags. */ + readonly tags?: Record; +} + +export function costManagementResourceDeserializer(item: any): CostManagementResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + location: item["location"], + sku: item["sku"], + eTag: item["eTag"], + tags: !item["tags"] + ? item["tags"] + : Object.fromEntries(Object.entries(item["tags"]).map(([k, p]: [string, any]) => [k, p])), + }; +} + +/** Result of listing dimensions. It contains a list of available dimensions. */ +export interface _DimensionsListResult { + /** The list of dimensions. */ + readonly value?: Dimension[]; + /** The link (url) to the next page of results. */ + nextLink?: string; +} + +export function _dimensionsListResultDeserializer(item: any): _DimensionsListResult { + return { + value: !item["value"] ? item["value"] : dimensionArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function dimensionArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return dimensionDeserializer(item); + }); +} + +/** List of Dimension. */ +export interface Dimension extends CostManagementResource { + /** Dimension description. */ + readonly description?: string; + /** Filter enabled. */ + readonly filterEnabled?: boolean; + /** Grouping enabled. */ + readonly groupingEnabled?: boolean; + /** Dimension data. */ + data?: string[]; + /** Total number of data for the dimension. */ + readonly total?: number; + /** Dimension category. */ + readonly category?: string; + /** Usage start. */ + readonly usageStart?: Date; + /** Usage end. */ + readonly usageEnd?: Date; + /** The link (url) to the next page of results. */ + readonly nextLink?: string; +} + +export function dimensionDeserializer(item: any): Dimension { + return { + id: item["id"], + name: item["name"], + type: item["type"], + location: item["location"], + sku: item["sku"], + eTag: item["eTag"], + tags: !item["tags"] + ? item["tags"] + : Object.fromEntries(Object.entries(item["tags"]).map(([k, p]: [string, any]) => [k, p])), + ...(!item["properties"] + ? item["properties"] + : _dimensionPropertiesDeserializer(item["properties"])), + }; +} + +/** Dimension properties. */ +export interface DimensionProperties { + /** Dimension description. */ + readonly description?: string; + /** Filter enabled. */ + readonly filterEnabled?: boolean; + /** Grouping enabled. */ + readonly groupingEnabled?: boolean; + /** Dimension data. */ + data?: string[]; + /** Total number of data for the dimension. */ + readonly total?: number; + /** Dimension category. */ + readonly category?: string; + /** Usage start. */ + readonly usageStart?: Date; + /** Usage end. */ + readonly usageEnd?: Date; + /** The link (url) to the next page of results. */ + readonly nextLink?: string; +} + +export function dimensionPropertiesDeserializer(item: any): DimensionProperties { + return { + description: item["description"], + filterEnabled: item["filterEnabled"], + groupingEnabled: item["groupingEnabled"], + data: !item["data"] + ? item["data"] + : item["data"].map((p: any) => { + return p; + }), + total: item["total"], + category: item["category"], + usageStart: !item["usageStart"] ? item["usageStart"] : new Date(item["usageStart"]), + usageEnd: !item["usageEnd"] ? item["usageEnd"] : new Date(item["usageEnd"]), + nextLink: item["nextLink"], + }; +} + +/** The definition of a query. */ +export interface QueryDefinition { + /** The type of the query. */ + type: ExportType; + /** The time frame for pulling data for the query. If custom, then a specific time period must be provided. */ + timeframe: TimeframeType; + /** Has time period for pulling data for the query. */ + timePeriod?: QueryTimePeriod; + /** Has definition for data in this query. */ + dataset: QueryDataset; +} + +export function queryDefinitionSerializer(item: QueryDefinition): any { + return { + type: item["type"], + timeframe: item["timeframe"], + timePeriod: !item["timePeriod"] + ? item["timePeriod"] + : queryTimePeriodSerializer(item["timePeriod"]), + dataset: queryDatasetSerializer(item["dataset"]), + }; +} + +/** The start and end date for pulling data for the query. */ +export interface QueryTimePeriod { + /** The start date to pull data from. */ + from: Date; + /** The end date to pull data to. */ + to: Date; +} + +export function queryTimePeriodSerializer(item: QueryTimePeriod): any { + return { from: item["from"].toISOString(), to: item["to"].toISOString() }; +} + +/** The definition of data present in the query. */ +export interface QueryDataset { + /** The granularity of rows in the query. */ + granularity?: GranularityType; + /** Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided. */ + configuration?: QueryDatasetConfiguration; + /** 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?: Record; + /** Array of group by expression to use in the query. Query can have up to 2 group by clauses. */ + grouping?: QueryGrouping[]; + /** The filter expression to use in the query. Please reference our Query API REST documentation for how to properly format the filter. */ + filter?: QueryFilter; +} + +export function queryDatasetSerializer(item: QueryDataset): any { + return { + granularity: item["granularity"], + configuration: !item["configuration"] + ? item["configuration"] + : queryDatasetConfigurationSerializer(item["configuration"]), + aggregation: !item["aggregation"] + ? item["aggregation"] + : queryAggregationRecordSerializer(item["aggregation"]), + grouping: !item["grouping"] ? item["grouping"] : queryGroupingArraySerializer(item["grouping"]), + filter: !item["filter"] ? item["filter"] : queryFilterSerializer(item["filter"]), + }; +} + +/** The configuration of dataset in the query. */ +export interface QueryDatasetConfiguration { + /** 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[]; +} + +export function queryDatasetConfigurationSerializer(item: QueryDatasetConfiguration): any { + return { + columns: !item["columns"] + ? item["columns"] + : item["columns"].map((p: any) => { + return p; + }), + }; +} + +export function queryAggregationRecordSerializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : queryAggregationSerializer(item[key]); + }); + return result; +} + +/** The aggregation expression to be used in the query. */ +export interface QueryAggregation { + /** The name of the column to aggregate. */ + name: string; + /** The name of the aggregation function to use. */ + function: FunctionType; +} + +export function queryAggregationSerializer(item: QueryAggregation): any { + return { name: item["name"], function: item["function"] }; +} + +export function queryGroupingArraySerializer(result: Array): any[] { + return result.map((item) => { + return queryGroupingSerializer(item); + }); +} + +/** The group by expression to be used in the query. */ +export interface QueryGrouping { + /** Has type of the column to group. */ + type: QueryColumnType; + /** The name of the column to group. */ + name: string; +} + +export function queryGroupingSerializer(item: QueryGrouping): any { + return { type: item["type"], name: item["name"] }; +} + +/** The filter expression to be used in the export. */ +export interface QueryFilter { + /** The logical "AND" expression. Must have at least 2 items. */ + and?: QueryFilter[]; + /** The logical "OR" expression. Must have at least 2 items. */ + or?: QueryFilter[]; + /** Has comparison expression for a dimension */ + dimensions?: QueryComparisonExpression; + /** Has comparison expression for a tag */ + tags?: QueryComparisonExpression; +} + +export function queryFilterSerializer(item: QueryFilter): any { + return { + and: !item["and"] ? item["and"] : queryFilterArraySerializer(item["and"]), + or: !item["or"] ? item["or"] : queryFilterArraySerializer(item["or"]), + dimensions: !item["dimensions"] + ? item["dimensions"] + : queryComparisonExpressionSerializer(item["dimensions"]), + tags: !item["tags"] ? item["tags"] : queryComparisonExpressionSerializer(item["tags"]), + }; +} + +export function queryFilterArraySerializer(result: Array): any[] { + return result.map((item) => { + return queryFilterSerializer(item); + }); +} + +/** The comparison expression to be used in the query. */ +export interface QueryComparisonExpression { + /** The name of the column to use in comparison. */ + name: string; + /** The operator to use for comparison. */ + operator: QueryOperatorType; + /** Array of values to use for comparison */ + values: string[]; +} + +export function queryComparisonExpressionSerializer(item: QueryComparisonExpression): any { + return { + name: item["name"], + operator: item["operator"], + values: item["values"].map((p: any) => { + return p; + }), + }; +} + +/** The operator to use for comparison. */ +export enum KnownQueryOperatorType { + /** In */ + In = "In", +} + +/** + * The operator to use for comparison. \ + * {@link KnownQueryOperatorType} can be used interchangeably with QueryOperatorType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **In** + */ +export type QueryOperatorType = string; + +/** Result of query. It contains all columns listed under groupings and aggregation. */ +export interface QueryResult extends CostManagementResource { + /** The link (url) to the next page of results. */ + nextLink?: string; + /** Array of columns */ + columns?: QueryColumn[]; + /** Array of rows */ + rows?: any[][]; +} + +export function queryResultDeserializer(item: any): QueryResult { + return { + id: item["id"], + name: item["name"], + type: item["type"], + location: item["location"], + sku: item["sku"], + eTag: item["eTag"], + tags: !item["tags"] + ? item["tags"] + : Object.fromEntries(Object.entries(item["tags"]).map(([k, p]: [string, any]) => [k, p])), + ...(!item["properties"] + ? item["properties"] + : _queryResultPropertiesDeserializer(item["properties"])), + }; +} + +/** Query properties */ +export interface QueryProperties { + /** The link (url) to the next page of results. */ + nextLink?: string; + /** Array of columns */ + columns?: QueryColumn[]; + /** Array of rows */ + rows?: any[][]; +} + +export function queryPropertiesDeserializer(item: any): QueryProperties { + return { + nextLink: item["nextLink"], + columns: !item["columns"] ? item["columns"] : queryColumnArrayDeserializer(item["columns"]), + rows: !item["rows"] + ? item["rows"] + : item["rows"].map((p: any) => { + return p.map((p1: any) => { + return p1; + }); + }), + }; +} + +export function queryColumnArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return queryColumnDeserializer(item); + }); +} + +/** QueryColumn properties */ +export interface QueryColumn { + /** The name of column. */ + name?: string; + /** The type of column. */ + type?: string; +} + +export function queryColumnDeserializer(item: any): QueryColumn { + return { + name: item["name"], + type: item["type"], + }; +} + +/** The status of the long running operation. */ +export interface OperationStatus { + /** The status of the long running operation. */ + status?: OperationStatusType; + /** The CSV file from the reportUrl blob link consists of reservation usage data with the following schema at daily granularity */ + reportUrl?: ReservationReportSchema; + /** The time at which report URL becomes invalid. */ + validUntil?: Date; +} + +export function operationStatusDeserializer(item: any): OperationStatus { + return { + status: item["status"], + ...(!item["properties"] + ? item["properties"] + : _operationStatusPropertiesDeserializer(item["properties"])), + }; +} + +/** The URL to download the generated report. */ +export interface ReportURL { + /** The CSV file from the reportUrl blob link consists of reservation usage data with the following schema at daily granularity */ + reportUrl?: ReservationReportSchema; + /** The time at which report URL becomes invalid. */ + validUntil?: Date; +} + +export function reportURLDeserializer(item: any): ReportURL { + return { + reportUrl: item["reportUrl"], + validUntil: !item["validUntil"] ? item["validUntil"] : new Date(item["validUntil"]), + }; +} + +/** The CSV file from the reportUrl blob link consists of reservation usage data with the following schema at daily granularity */ +export enum KnownReservationReportSchema { + /** InstanceFlexibilityGroup */ + InstanceFlexibilityGroup = "InstanceFlexibilityGroup", + /** InstanceFlexibilityRatio */ + InstanceFlexibilityRatio = "InstanceFlexibilityRatio", + /** InstanceId */ + InstanceId = "InstanceId", + /** Kind */ + Kind = "Kind", + /** ReservationId */ + ReservationId = "ReservationId", + /** ReservationOrderId */ + ReservationOrderId = "ReservationOrderId", + /** ReservedHours */ + ReservedHours = "ReservedHours", + /** SkuName */ + SkuName = "SkuName", + /** TotalReservedQuantity */ + TotalReservedQuantity = "TotalReservedQuantity", + /** UsageDate */ + UsageDate = "UsageDate", + /** UsedHours */ + UsedHours = "UsedHours", +} + +/** + * The CSV file from the reportUrl blob link consists of reservation usage data with the following schema at daily granularity \ + * {@link KnownReservationReportSchema} can be used interchangeably with ReservationReportSchema, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **InstanceFlexibilityGroup** \ + * **InstanceFlexibilityRatio** \ + * **InstanceId** \ + * **Kind** \ + * **ReservationId** \ + * **ReservationOrderId** \ + * **ReservedHours** \ + * **SkuName** \ + * **TotalReservedQuantity** \ + * **UsageDate** \ + * **UsedHours** + */ +export type ReservationReportSchema = string; + +/** The URL to download the generated report. */ +export interface PricesheetDownloadProperties { + /** The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. */ + readonly expiryTime?: Date; + /** The URL to download the generated report. */ + downloadUrl?: string; + /** The properties in downloaded file */ + downloadFileProperties?: MCAPriceSheetProperties; +} + +export function pricesheetDownloadPropertiesDeserializer(item: any): PricesheetDownloadProperties { + return { + expiryTime: !item["expiryTime"] ? item["expiryTime"] : new Date(item["expiryTime"]), + downloadUrl: item["downloadUrl"], + downloadFileProperties: !item["downloadFileProperties"] + ? item["downloadFileProperties"] + : mcaPriceSheetPropertiesDeserializer(item["downloadFileProperties"]), + }; +} + +/** The properties of the price sheet. */ +export interface MCAPriceSheetProperties { + /** Unique identifier for the billing account. */ + readonly billingAccountID?: string; + /** Name of the billing profile that is set up to receive invoices. The prices in the price sheet are associated with this billing profile. */ + readonly billingAccountName?: string; + /** Unique identifier for the billing profile. */ + readonly billingProfileId?: string; + /** Name of the billing profile that is set up to receive invoices. The prices in the price sheet are associated with this billing profile. */ + readonly billingProfileName?: string; + /** + * Name of the purchased product plan. Indicates if this pricing is standard Azure Plan pricing, Dev/Test pricing etc. + * + * Currently unavailable for Azure 3rd party and ReservedInstance meters. + */ + readonly productOrderName?: string; + /** Type of Azure service. For example, Compute, Analytics, and Security. */ + readonly serviceFamily?: number; + /** Name of the product accruing the charges. */ + readonly product?: string; + /** Unique identifier for the product whose meter is consumed. */ + readonly productId?: string; + /** Unique identifier of the SKU */ + readonly skuId?: string; + /** How usage is measured for the service */ + readonly unitOfMeasure?: string; + /** Unique identifier of the meter */ + readonly meterId?: string; + /** Name of the meter. The meter represents the deployable resource of an Azure service. */ + readonly meterName?: string; + /** Name of the meter type */ + readonly meterType?: string; + /** Name of the classification category for the meter. For example, Cloud services, Networking, etc. */ + readonly meterCategory?: string; + /** Name of the meter subclassification category. */ + readonly meterSubCategory?: string; + /** Name of the Azure region where the meter for the service is available. */ + readonly meterRegion?: string; + /** Defines the lower bound of the tier range for which prices are defined. For example, if the range is 0 to 100, tierMinimumUnits would be 0. */ + readonly tierMinimumUnits?: string; + /** Effective start date of the Price Sheet billing period */ + readonly effectiveStartDate?: Date; + /** Effective end date of the Price Sheet billing period */ + readonly effectiveEndDate?: Date; + /** + * The per-unit price at the time of billing for a given product or service, inclusive of any negotiated discounts on top of the market price. + * + * For PriceType ReservedInstance, unit price reflects the total cost of the 1 or 3-year commitment including discounts. + * + * Note: The unit price isn't the same as the effective price in usage details downloads when services have differential prices across tiers. + * + * If services have multi-tiered pricing, the effective price is a blended rate across the tiers and doesn't show a tier-specific unit price. The blended price or effective price is the net price for the consumed quantity spanning across the multiple tiers (where each tier has a specific unit price). + */ + readonly unitPrice?: string; + /** + * The unit price at the time the customer signs on or the unit price at the time of service meter GA launch if it is after sign-on. + * + * This is applicable for Enterprise Agreement users + */ + readonly basePrice?: string; + /** + * The current list price for a given product or service. This price is without any negotiations and is based on your Microsoft Agreement type. + * + * For PriceType Consumption, market price is reflected as the pay-as-you-go price. + * + * For PriceType Savings Plan, market price reflects the Savings plan benefit on top of pay-as-you-go price for the corresponding commitment term. + * + * For PriceType ReservedInstance, market price reflects the total price of the 1 or 3-year commitment. + */ + readonly marketPrice?: string; + /** Currency in which all the prices are reflected. */ + readonly currency?: string; + /** Currency in which charges are posted. */ + readonly billingCurrency?: string; + /** Term length for Azure Savings Plan or Reservation term – one year or three years (P1Y or P3Y) */ + readonly term?: string; + /** Price type for a product. For example, an Azure resource with a pay-as-you-go rate with priceType as Consumption. Other price types include ReservedInstance and Savings Plan. */ + readonly priceType?: string; +} + +export function mcaPriceSheetPropertiesDeserializer(item: any): MCAPriceSheetProperties { + return { + billingAccountID: item["billingAccountID"], + billingAccountName: item["billingAccountName"], + billingProfileId: item["billingProfileId"], + billingProfileName: item["billingProfileName"], + productOrderName: item["productOrderName"], + serviceFamily: item["serviceFamily"], + product: item["product"], + productId: item["productId"], + skuId: item["skuId"], + unitOfMeasure: item["unitOfMeasure"], + meterId: item["meterId"], + meterName: item["meterName"], + meterType: item["meterType"], + meterCategory: item["meterCategory"], + meterSubCategory: item["meterSubCategory"], + meterRegion: item["meterRegion"], + tierMinimumUnits: item["tierMinimumUnits"], + effectiveStartDate: !item["effectiveStartDate"] + ? item["effectiveStartDate"] + : new Date(item["effectiveStartDate"]), + effectiveEndDate: !item["effectiveEndDate"] + ? item["effectiveEndDate"] + : new Date(item["effectiveEndDate"]), + unitPrice: item["unitPrice"], + basePrice: item["basePrice"], + marketPrice: item["marketPrice"], + currency: item["currency"], + billingCurrency: item["billingCurrency"], + term: item["term"], + priceType: item["priceType"], + }; +} + +/** Known values of {@link ExternalCloudProviderType} that the service accepts. */ +export enum KnownExternalCloudProviderType { + /** externalSubscriptions */ + ExternalSubscriptions = "externalSubscriptions", + /** externalBillingAccounts */ + ExternalBillingAccounts = "externalBillingAccounts", +} + +/** Type of ExternalCloudProviderType */ +export type ExternalCloudProviderType = string; + +/** Known values of {@link GrainParameter} that the service accepts. */ +export enum KnownGrainParameter { + /** Hourly grain corresponds to value per hour. */ + Hourly = "Hourly", + /** Hourly grain corresponds to value per day. */ + Daily = "Daily", + /** Hourly grain corresponds to value per month. */ + Monthly = "Monthly", +} + +/** Type of GrainParameter */ +export type GrainParameter = string; + +/** The available API versions. */ +export enum KnownVersions { + /** The 2025-03-01 API version. */ + V20250301 = "2025-03-01", +} + +export function _generateDetailedCostReportOperationStatusesPropertiesDeserializer(item: any) { + return { + expiryTime: !item["expiryTime"] ? item["expiryTime"] : new Date(item["expiryTime"]), + validTill: !item["validTill"] ? item["validTill"] : new Date(item["validTill"]), + downloadUrl: item["downloadUrl"], + }; +} + +export function _budgetPropertiesSerializer(item: Budget): any { + return { + category: item["category"], + amount: item["amount"], + timeGrain: item["timeGrain"], + timePeriod: !item["timePeriod"] + ? item["timePeriod"] + : budgetTimePeriodSerializer(item["timePeriod"]), + filter: !item["filter"] ? item["filter"] : budgetFilterSerializer(item["filter"]), + notifications: !item["notifications"] + ? item["notifications"] + : notificationRecordSerializer(item["notifications"]), + }; +} + +export function _budgetPropertiesDeserializer(item: any) { + return { + category: item["category"], + amount: item["amount"], + timeGrain: item["timeGrain"], + timePeriod: !item["timePeriod"] + ? item["timePeriod"] + : budgetTimePeriodDeserializer(item["timePeriod"]), + filter: !item["filter"] ? item["filter"] : budgetFilterDeserializer(item["filter"]), + currentSpend: !item["currentSpend"] + ? item["currentSpend"] + : currentSpendDeserializer(item["currentSpend"]), + notifications: !item["notifications"] + ? item["notifications"] + : notificationRecordDeserializer(item["notifications"]), + forecastSpend: !item["forecastSpend"] + ? item["forecastSpend"] + : forecastSpendDeserializer(item["forecastSpend"]), + }; +} + +export function _exportPropertiesSerializer(item: Export): any { + return { + format: item["format"], + deliveryInfo: !item["deliveryInfo"] + ? item["deliveryInfo"] + : exportDeliveryInfoSerializer(item["deliveryInfo"]), + definition: !item["definition"] + ? item["definition"] + : exportDefinitionSerializer(item["definition"]), + runHistory: !item["runHistory"] + ? item["runHistory"] + : exportExecutionListResultSerializer(item["runHistory"]), + partitionData: item["partitionData"], + dataOverwriteBehavior: item["dataOverwriteBehavior"], + compressionMode: item["compressionMode"], + exportDescription: item["exportDescription"], + schedule: !item["schedule"] ? item["schedule"] : exportScheduleSerializer(item["schedule"]), + }; +} + +export function _exportPropertiesDeserializer(item: any) { + return { + format: item["format"], + deliveryInfo: !item["deliveryInfo"] + ? item["deliveryInfo"] + : exportDeliveryInfoDeserializer(item["deliveryInfo"]), + definition: !item["definition"] + ? item["definition"] + : exportDefinitionDeserializer(item["definition"]), + runHistory: !item["runHistory"] + ? item["runHistory"] + : exportExecutionListResultDeserializer(item["runHistory"]), + partitionData: item["partitionData"], + dataOverwriteBehavior: item["dataOverwriteBehavior"], + compressionMode: item["compressionMode"], + exportDescription: item["exportDescription"], + nextRunTimeEstimate: !item["nextRunTimeEstimate"] + ? item["nextRunTimeEstimate"] + : new Date(item["nextRunTimeEstimate"]), + systemSuspensionContext: !item["systemSuspensionContext"] + ? item["systemSuspensionContext"] + : exportSuspensionContextDeserializer(item["systemSuspensionContext"]), + schedule: !item["schedule"] ? item["schedule"] : exportScheduleDeserializer(item["schedule"]), + }; +} + +export function _exportRunPropertiesDeserializer(item: any) { + return { + executionType: item["executionType"], + status: item["status"], + submittedBy: item["submittedBy"], + submittedTime: !item["submittedTime"] ? item["submittedTime"] : new Date(item["submittedTime"]), + processingStartTime: !item["processingStartTime"] + ? item["processingStartTime"] + : new Date(item["processingStartTime"]), + processingEndTime: !item["processingEndTime"] + ? item["processingEndTime"] + : new Date(item["processingEndTime"]), + startDate: !item["startDate"] ? item["startDate"] : new Date(item["startDate"]), + endDate: !item["endDate"] ? item["endDate"] : new Date(item["endDate"]), + fileName: item["fileName"], + manifestFile: item["manifestFile"], + runSettings: !item["runSettings"] + ? item["runSettings"] + : commonExportPropertiesDeserializer(item["runSettings"]), + error: !item["error"] ? item["error"] : errorDetailsDeserializer(item["error"]), + }; +} + +export function _generateDetailedCostReportOperationResultPropertiesDeserializer(item: any) { + return { + expiryTime: !item["expiryTime"] ? item["expiryTime"] : new Date(item["expiryTime"]), + validTill: !item["validTill"] ? item["validTill"] : new Date(item["validTill"]), + downloadUrl: item["downloadUrl"], + }; +} + +export function _viewPropertiesQuerySerializer(item: ViewProperties): any { + return { + type: item["type"], + timeframe: item["timeframe"], + timePeriod: !item["timePeriod"] + ? item["timePeriod"] + : reportConfigTimePeriodSerializer(item["timePeriod"]), + dataSet: !item["dataSet"] ? item["dataSet"] : reportConfigDatasetSerializer(item["dataSet"]), + includeMonetaryCommitment: item["includeMonetaryCommitment"], + }; +} + +export function _viewPropertiesQueryDeserializer(item: any) { + return { + type: item["type"], + timeframe: item["timeframe"], + timePeriod: !item["timePeriod"] + ? item["timePeriod"] + : reportConfigTimePeriodDeserializer(item["timePeriod"]), + dataSet: !item["dataSet"] ? item["dataSet"] : reportConfigDatasetDeserializer(item["dataSet"]), + includeMonetaryCommitment: item["includeMonetaryCommitment"], + }; +} + +export function _viewPropertiesSerializer(item: View): any { + return { + displayName: item["displayName"], + scope: item["scope"], + modifiedOn: !item["modifiedOn"] ? item["modifiedOn"] : item["modifiedOn"].toISOString(), + dateRange: item["dateRange"], + query: !item["query"] ? item["query"] : reportConfigDefinitionSerializer(item["query"]), + chart: item["chart"], + accumulated: item["accumulated"], + metric: item["metric"], + kpis: !item["kpis"] ? item["kpis"] : kpiPropertiesArraySerializer(item["kpis"]), + pivots: !item["pivots"] ? item["pivots"] : pivotPropertiesArraySerializer(item["pivots"]), + }; +} + +export function _viewPropertiesDeserializer(item: any) { + return { + displayName: item["displayName"], + scope: item["scope"], + createdOn: !item["createdOn"] ? item["createdOn"] : new Date(item["createdOn"]), + modifiedOn: !item["modifiedOn"] ? item["modifiedOn"] : new Date(item["modifiedOn"]), + dateRange: item["dateRange"], + currency: item["currency"], + query: !item["query"] ? item["query"] : reportConfigDefinitionDeserializer(item["query"]), + chart: item["chart"], + accumulated: item["accumulated"], + metric: item["metric"], + kpis: !item["kpis"] ? item["kpis"] : kpiPropertiesArrayDeserializer(item["kpis"]), + pivots: !item["pivots"] ? item["pivots"] : pivotPropertiesArrayDeserializer(item["pivots"]), + }; +} + +export function _alertPropertiesSerializer(item: Alert): any { + return { + definition: !item["definition"] + ? item["definition"] + : alertPropertiesDefinitionSerializer(item["definition"]), + description: item["description"], + source: item["source"], + details: !item["details"] ? item["details"] : alertPropertiesDetailsSerializer(item["details"]), + costEntityId: item["costEntityId"], + status: item["status"], + creationTime: item["creationTime"], + closeTime: item["closeTime"], + modificationTime: item["modificationTime"], + statusModificationUserName: item["statusModificationUserName"], + statusModificationTime: item["statusModificationTime"], + }; +} + +export function _alertPropertiesDeserializer(item: any) { + return { + definition: !item["definition"] + ? item["definition"] + : alertPropertiesDefinitionDeserializer(item["definition"]), + description: item["description"], + source: item["source"], + details: !item["details"] + ? item["details"] + : alertPropertiesDetailsDeserializer(item["details"]), + costEntityId: item["costEntityId"], + status: item["status"], + creationTime: item["creationTime"], + closeTime: item["closeTime"], + modificationTime: item["modificationTime"], + statusModificationUserName: item["statusModificationUserName"], + statusModificationTime: item["statusModificationTime"], + }; +} + +export function _dismissAlertPayloadPropertiesSerializer(item: DismissAlertPayload): any { + return { + definition: !item["definition"] + ? item["definition"] + : alertPropertiesDefinitionSerializer(item["definition"]), + description: item["description"], + source: item["source"], + details: !item["details"] ? item["details"] : alertPropertiesDetailsSerializer(item["details"]), + costEntityId: item["costEntityId"], + status: item["status"], + creationTime: item["creationTime"], + closeTime: item["closeTime"], + modificationTime: item["modificationTime"], + statusModificationUserName: item["statusModificationUserName"], + statusModificationTime: item["statusModificationTime"], + }; +} + +export function _dismissAlertPayloadPropertiesDeserializer(item: any) { + return { + definition: !item["definition"] + ? item["definition"] + : alertPropertiesDefinitionDeserializer(item["definition"]), + description: item["description"], + source: item["source"], + details: !item["details"] + ? item["details"] + : alertPropertiesDetailsDeserializer(item["details"]), + costEntityId: item["costEntityId"], + status: item["status"], + creationTime: item["creationTime"], + closeTime: item["closeTime"], + modificationTime: item["modificationTime"], + statusModificationUserName: item["statusModificationUserName"], + statusModificationTime: item["statusModificationTime"], + }; +} + +export function _scheduledActionPropertiesSerializer(item: ScheduledAction): any { + return { + displayName: item["displayName"], + fileDestination: !item["fileDestination"] + ? item["fileDestination"] + : fileDestinationSerializer(item["fileDestination"]), + notification: !item["notification"] + ? item["notification"] + : notificationPropertiesSerializer(item["notification"]), + notificationEmail: item["notificationEmail"], + schedule: !item["schedule"] ? item["schedule"] : schedulePropertiesSerializer(item["schedule"]), + scope: item["scope"], + status: item["status"], + viewId: item["viewId"], + }; +} + +export function _scheduledActionPropertiesDeserializer(item: any) { + return { + displayName: item["displayName"], + fileDestination: !item["fileDestination"] + ? item["fileDestination"] + : fileDestinationDeserializer(item["fileDestination"]), + notification: !item["notification"] + ? item["notification"] + : notificationPropertiesDeserializer(item["notification"]), + notificationEmail: item["notificationEmail"], + schedule: !item["schedule"] + ? item["schedule"] + : schedulePropertiesDeserializer(item["schedule"]), + scope: item["scope"], + status: item["status"], + viewId: item["viewId"], + }; +} + +export function _reportManifestRequestContextDeserializer(item: any) { + return { + requestScope: item["requestScope"], + requestBody: !item["requestBody"] + ? item["requestBody"] + : generateCostDetailsReportRequestDefinitionDeserializer(item["requestBody"]), + }; +} + +export function _costDetailsOperationResultsManifestDeserializer(item: any) { + return { + manifestVersion: item["manifestVersion"], + dataFormat: item["dataFormat"], + byteCount: item["byteCount"], + blobCount: item["blobCount"], + compressData: item["compressData"], + requestContext: !item["requestContext"] + ? item["requestContext"] + : requestContextDeserializer(item["requestContext"]), + blobs: !item["blobs"] ? item["blobs"] : blobInfoArrayDeserializer(item["blobs"]), + }; +} + +export function _includedQuantityUtilizationSummaryPropertiesDeserializer(item: any) { + return { + armSkuName: item["armSkuName"], + benefitId: item["benefitId"], + benefitOrderId: item["benefitOrderId"], + benefitType: item["benefitType"], + usageDate: !item["usageDate"] ? item["usageDate"] : new Date(item["usageDate"]), + utilizationPercentage: item["utilizationPercentage"], + }; +} + +export function _savingsPlanUtilizationSummaryPropertiesDeserializer(item: any) { + return { + armSkuName: item["armSkuName"], + benefitId: item["benefitId"], + benefitOrderId: item["benefitOrderId"], + benefitType: item["benefitType"], + usageDate: !item["usageDate"] ? item["usageDate"] : new Date(item["usageDate"]), + avgUtilizationPercentage: item["avgUtilizationPercentage"], + minUtilizationPercentage: item["minUtilizationPercentage"], + maxUtilizationPercentage: item["maxUtilizationPercentage"], + }; +} + +export function _forecastResultPropertiesDeserializer(item: any) { + return { + nextLink: item["nextLink"], + columns: !item["columns"] ? item["columns"] : forecastColumnArrayDeserializer(item["columns"]), + rows: !item["rows"] + ? item["rows"] + : item["rows"].map((p: any) => { + return p.map((p1: any) => { + return p1; + }); + }), + }; +} + +export function _dimensionPropertiesDeserializer(item: any) { + return { + description: item["description"], + filterEnabled: item["filterEnabled"], + groupingEnabled: item["groupingEnabled"], + data: !item["data"] + ? item["data"] + : item["data"].map((p: any) => { + return p; + }), + total: item["total"], + category: item["category"], + usageStart: !item["usageStart"] ? item["usageStart"] : new Date(item["usageStart"]), + usageEnd: !item["usageEnd"] ? item["usageEnd"] : new Date(item["usageEnd"]), + nextLink: item["nextLink"], + }; +} + +export function _queryResultPropertiesDeserializer(item: any) { + return { + nextLink: item["nextLink"], + columns: !item["columns"] ? item["columns"] : queryColumnArrayDeserializer(item["columns"]), + rows: !item["rows"] + ? item["rows"] + : item["rows"].map((p: any) => { + return p.map((p1: any) => { + return p1; + }); + }), + }; +} + +export function _operationStatusPropertiesDeserializer(item: any) { + return { + reportUrl: item["reportUrl"], + validUntil: !item["validUntil"] ? item["validUntil"] : new Date(item["validUntil"]), + }; +} diff --git a/sdk/cost-management/arm-costmanagement/src/models/parameters.ts b/sdk/cost-management/arm-costmanagement/src/models/parameters.ts deleted file mode 100644 index 5e55343632f2..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/models/parameters.ts +++ /dev/null @@ -1,436 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { - OperationParameter, - OperationURLParameter, - OperationQueryParameter -} from "@azure/core-client"; -import { - View as ViewMapper, - DismissAlertPayload as DismissAlertPayloadMapper, - ForecastDefinition as ForecastDefinitionMapper, - QueryDefinition as QueryDefinitionMapper, - Export as ExportMapper, - GenerateCostDetailsReportRequestDefinition as GenerateCostDetailsReportRequestDefinitionMapper, - GenerateDetailedCostReportDefinition as GenerateDetailedCostReportDefinitionMapper, - ScheduledAction as ScheduledActionMapper, - CheckNameAvailabilityRequest as CheckNameAvailabilityRequestMapper -} from "../models/mappers.js"; - -export const accept: OperationParameter = { - parameterPath: "accept", - mapper: { - defaultValue: "application/json", - isConstant: true, - serializedName: "Accept", - type: { - name: "String" - } - } -}; - -export const $host: OperationURLParameter = { - parameterPath: "$host", - mapper: { - serializedName: "$host", - required: true, - type: { - name: "String" - } - }, - skipEncoding: true -}; - -export const apiVersion: OperationQueryParameter = { - parameterPath: "apiVersion", - mapper: { - defaultValue: "2022-10-01", - isConstant: true, - serializedName: "api-version", - type: { - name: "String" - } - } -}; - -export const nextLink: OperationURLParameter = { - parameterPath: "nextLink", - mapper: { - serializedName: "nextLink", - required: true, - type: { - name: "String" - } - }, - skipEncoding: true -}; - -export const scope: OperationURLParameter = { - parameterPath: "scope", - mapper: { - serializedName: "scope", - required: true, - type: { - name: "String" - } - } -}; - -export const viewName: OperationURLParameter = { - parameterPath: "viewName", - mapper: { - serializedName: "viewName", - required: true, - type: { - name: "String" - } - } -}; - -export const contentType: OperationParameter = { - parameterPath: ["options", "contentType"], - mapper: { - defaultValue: "application/json", - isConstant: true, - serializedName: "Content-Type", - type: { - name: "String" - } - } -}; - -export const parameters: OperationParameter = { - parameterPath: "parameters", - mapper: ViewMapper -}; - -export const scope1: OperationURLParameter = { - parameterPath: "scope", - mapper: { - serializedName: "scope", - required: true, - type: { - name: "String" - } - }, - skipEncoding: true -}; - -export const alertId: OperationURLParameter = { - parameterPath: "alertId", - mapper: { - serializedName: "alertId", - required: true, - type: { - name: "String" - } - }, - skipEncoding: true -}; - -export const parameters1: OperationParameter = { - parameterPath: "parameters", - mapper: DismissAlertPayloadMapper -}; - -export const externalCloudProviderType: OperationURLParameter = { - parameterPath: "externalCloudProviderType", - mapper: { - serializedName: "externalCloudProviderType", - required: true, - type: { - name: "String" - } - } -}; - -export const externalCloudProviderId: OperationURLParameter = { - parameterPath: "externalCloudProviderId", - mapper: { - serializedName: "externalCloudProviderId", - required: true, - type: { - name: "String" - } - } -}; - -export const parameters2: OperationParameter = { - parameterPath: "parameters", - mapper: ForecastDefinitionMapper -}; - -export const filter: OperationQueryParameter = { - parameterPath: ["options", "filter"], - mapper: { - serializedName: "$filter", - type: { - name: "String" - } - } -}; - -export const expand: OperationQueryParameter = { - parameterPath: ["options", "expand"], - mapper: { - serializedName: "$expand", - type: { - name: "String" - } - } -}; - -export const skiptoken: OperationQueryParameter = { - parameterPath: ["options", "skiptoken"], - mapper: { - serializedName: "$skiptoken", - type: { - name: "String" - } - } -}; - -export const top: OperationQueryParameter = { - parameterPath: ["options", "top"], - mapper: { - constraints: { - InclusiveMaximum: 1000, - InclusiveMinimum: 1 - }, - serializedName: "$top", - type: { - name: "Number" - } - } -}; - -export const parameters3: OperationParameter = { - parameterPath: "parameters", - mapper: QueryDefinitionMapper -}; - -export const billingAccountId: OperationURLParameter = { - parameterPath: "billingAccountId", - mapper: { - serializedName: "billingAccountId", - required: true, - type: { - name: "String" - } - } -}; - -export const startDate: OperationQueryParameter = { - parameterPath: "startDate", - mapper: { - serializedName: "startDate", - required: true, - type: { - name: "String" - } - } -}; - -export const endDate: OperationQueryParameter = { - parameterPath: "endDate", - mapper: { - serializedName: "endDate", - required: true, - type: { - name: "String" - } - } -}; - -export const billingProfileId: OperationURLParameter = { - parameterPath: "billingProfileId", - mapper: { - serializedName: "billingProfileId", - required: true, - type: { - name: "String" - } - } -}; - -export const exportName: OperationURLParameter = { - parameterPath: "exportName", - mapper: { - serializedName: "exportName", - required: true, - type: { - name: "String" - } - } -}; - -export const parameters4: OperationParameter = { - parameterPath: "parameters", - mapper: ExportMapper -}; - -export const parameters5: OperationParameter = { - parameterPath: "parameters", - mapper: GenerateCostDetailsReportRequestDefinitionMapper -}; - -export const operationId: OperationURLParameter = { - parameterPath: "operationId", - mapper: { - serializedName: "operationId", - required: true, - type: { - name: "String" - } - } -}; - -export const parameters6: OperationParameter = { - parameterPath: "parameters", - mapper: GenerateDetailedCostReportDefinitionMapper -}; - -export const billingAccountName: OperationURLParameter = { - parameterPath: "billingAccountName", - mapper: { - constraints: { - Pattern: new RegExp( - "([A-Za-z0-9]+(-[A-Za-z0-9]+)+):([A-Za-z0-9]+(-[A-Za-z0-9]+)+)_[0-9]{4}-[0-9]{2}-[0-9]{2}" - ) - }, - serializedName: "billingAccountName", - required: true, - type: { - name: "String" - } - } -}; - -export const billingProfileName: OperationURLParameter = { - parameterPath: "billingProfileName", - mapper: { - constraints: { - Pattern: new RegExp("([A-Za-z0-9]+(-[A-Za-z0-9]+)+)") - }, - serializedName: "billingProfileName", - required: true, - type: { - name: "String" - } - } -}; - -export const invoiceName: OperationURLParameter = { - parameterPath: "invoiceName", - mapper: { - constraints: { - Pattern: new RegExp("[A-Za-z0-9]+") - }, - serializedName: "invoiceName", - required: true, - type: { - name: "String" - } - } -}; - -export const scheduledAction: OperationParameter = { - parameterPath: "scheduledAction", - mapper: ScheduledActionMapper -}; - -export const name: OperationURLParameter = { - parameterPath: "name", - mapper: { - serializedName: "name", - required: true, - type: { - name: "String" - } - } -}; - -export const ifMatch: OperationParameter = { - parameterPath: ["options", "ifMatch"], - mapper: { - serializedName: "If-Match", - type: { - name: "String" - } - } -}; - -export const checkNameAvailabilityRequest: OperationParameter = { - parameterPath: "checkNameAvailabilityRequest", - mapper: CheckNameAvailabilityRequestMapper -}; - -export const orderby: OperationQueryParameter = { - parameterPath: ["options", "orderby"], - mapper: { - serializedName: "$orderby", - type: { - name: "String" - } - } -}; - -export const billingScope: OperationURLParameter = { - parameterPath: "billingScope", - mapper: { - serializedName: "billingScope", - required: true, - type: { - name: "String" - } - }, - skipEncoding: true -}; - -export const grainParameter: OperationQueryParameter = { - parameterPath: ["options", "grainParameter"], - mapper: { - serializedName: "grainParameter", - type: { - name: "String" - } - } -}; - -export const filter1: OperationQueryParameter = { - parameterPath: ["options", "filter"], - mapper: { - serializedName: "filter", - type: { - name: "String" - } - } -}; - -export const savingsPlanOrderId: OperationURLParameter = { - parameterPath: "savingsPlanOrderId", - mapper: { - serializedName: "savingsPlanOrderId", - required: true, - type: { - name: "String" - } - } -}; - -export const savingsPlanId: OperationURLParameter = { - parameterPath: "savingsPlanId", - mapper: { - serializedName: "savingsPlanId", - required: true, - type: { - name: "String" - } - } -}; diff --git a/sdk/cost-management/arm-costmanagement/src/operations/alerts.ts b/sdk/cost-management/arm-costmanagement/src/operations/alerts.ts deleted file mode 100644 index ccfef807d91d..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operations/alerts.ts +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { Alerts } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { CostManagementClient } from "../costManagementClient.js"; -import { - AlertsListOptionalParams, - AlertsListResponse, - AlertsGetOptionalParams, - AlertsGetResponse, - DismissAlertPayload, - AlertsDismissOptionalParams, - AlertsDismissResponse, - ExternalCloudProviderType, - AlertsListExternalOptionalParams, - AlertsListExternalResponse -} from "../models/index.js"; - -/** Class containing Alerts operations. */ -export class AlertsImpl implements Alerts { - private readonly client: CostManagementClient; - - /** - * Initialize a new instance of the class Alerts class. - * @param client Reference to the service client - */ - constructor(client: CostManagementClient) { - this.client = client; - } - - /** - * Lists the alerts for scope defined. - * @param 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. - * @param options The options parameters. - */ - list( - scope: string, - options?: AlertsListOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, options }, - listOperationSpec - ); - } - - /** - * Gets the alert for the scope by alert ID. - * @param 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. - * @param alertId Alert ID - * @param options The options parameters. - */ - get( - scope: string, - alertId: string, - options?: AlertsGetOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, alertId, options }, - getOperationSpec - ); - } - - /** - * Dismisses the specified alert - * @param 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. - * @param alertId Alert ID - * @param parameters Parameters supplied to the Dismiss Alert operation. - * @param options The options parameters. - */ - dismiss( - scope: string, - alertId: string, - parameters: DismissAlertPayload, - options?: AlertsDismissOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, alertId, parameters, options }, - dismissOperationSpec - ); - } - - /** - * Lists the Alerts for external cloud provider type defined. - * @param externalCloudProviderType The external cloud provider type associated with dimension/query - * operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' - * for consolidated account. - * @param externalCloudProviderId This can be '{externalSubscriptionId}' for linked account or - * '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - * @param options The options parameters. - */ - listExternal( - externalCloudProviderType: ExternalCloudProviderType, - externalCloudProviderId: string, - options?: AlertsListExternalOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { externalCloudProviderType, externalCloudProviderId, options }, - listExternalOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/{scope}/providers/Microsoft.CostManagement/alerts", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.AlertsResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope1], - headerParameters: [Parameters.accept], - serializer -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.Alert - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope1, Parameters.alertId], - headerParameters: [Parameters.accept], - serializer -}; -const dismissOperationSpec: coreClient.OperationSpec = { - path: "/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}", - httpMethod: "PATCH", - responses: { - 200: { - bodyMapper: Mappers.Alert - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - requestBody: Parameters.parameters1, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope1, Parameters.alertId], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; -const listExternalOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.AlertsResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.externalCloudProviderType, - Parameters.externalCloudProviderId - ], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/cost-management/arm-costmanagement/src/operations/benefitRecommendations.ts b/sdk/cost-management/arm-costmanagement/src/operations/benefitRecommendations.ts deleted file mode 100644 index b4c08bf06bf7..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operations/benefitRecommendations.ts +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { BenefitRecommendations } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { CostManagementClient } from "../costManagementClient.js"; -import { - BenefitRecommendationModel, - BenefitRecommendationsListNextOptionalParams, - BenefitRecommendationsListOptionalParams, - BenefitRecommendationsListResponse, - BenefitRecommendationsListNextResponse -} from "../models/index.js"; - -/// -/** Class containing BenefitRecommendations operations. */ -export class BenefitRecommendationsImpl implements BenefitRecommendations { - private readonly client: CostManagementClient; - - /** - * Initialize a new instance of the class BenefitRecommendations class. - * @param client Reference to the service client - */ - constructor(client: CostManagementClient) { - this.client = client; - } - - /** - * List of recommendations for purchasing savings plan. - * @param billingScope The scope associated with benefit recommendation operations. This includes - * '/subscriptions/{subscriptionId}/' for subscription scope, - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, - * /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for enterprise agreement scope, and - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' - * for billing profile scope - * @param options The options parameters. - */ - public list( - billingScope: string, - options?: BenefitRecommendationsListOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(billingScope, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage(billingScope, options, settings); - } - }; - } - - private async *listPagingPage( - billingScope: string, - options?: BenefitRecommendationsListOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: BenefitRecommendationsListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(billingScope, options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext(billingScope, continuationToken, options); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - billingScope: string, - options?: BenefitRecommendationsListOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listPagingPage(billingScope, options)) { - yield* page; - } - } - - /** - * List of recommendations for purchasing savings plan. - * @param billingScope The scope associated with benefit recommendation operations. This includes - * '/subscriptions/{subscriptionId}/' for subscription scope, - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, - * /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for enterprise agreement scope, and - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' - * for billing profile scope - * @param options The options parameters. - */ - private _list( - billingScope: string, - options?: BenefitRecommendationsListOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { billingScope, options }, - listOperationSpec - ); - } - - /** - * ListNext - * @param billingScope The scope associated with benefit recommendation operations. This includes - * '/subscriptions/{subscriptionId}/' for subscription scope, - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, - * /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for enterprise agreement scope, and - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' - * for billing profile scope - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - billingScope: string, - nextLink: string, - options?: BenefitRecommendationsListNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { billingScope, nextLink, options }, - listNextOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: - "/{billingScope}/providers/Microsoft.CostManagement/benefitRecommendations", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.BenefitRecommendationsListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.expand, - Parameters.orderby - ], - urlParameters: [Parameters.$host, Parameters.billingScope], - headerParameters: [Parameters.accept], - serializer -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.BenefitRecommendationsListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.billingScope - ], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/cost-management/arm-costmanagement/src/operations/benefitUtilizationSummaries.ts b/sdk/cost-management/arm-costmanagement/src/operations/benefitUtilizationSummaries.ts deleted file mode 100644 index 3155fe58a0db..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operations/benefitUtilizationSummaries.ts +++ /dev/null @@ -1,674 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { BenefitUtilizationSummaries } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { CostManagementClient } from "../costManagementClient.js"; -import { - BenefitUtilizationSummaryUnion, - BenefitUtilizationSummariesListByBillingAccountIdNextOptionalParams, - BenefitUtilizationSummariesListByBillingAccountIdOptionalParams, - BenefitUtilizationSummariesListByBillingAccountIdResponse, - BenefitUtilizationSummariesListByBillingProfileIdNextOptionalParams, - BenefitUtilizationSummariesListByBillingProfileIdOptionalParams, - BenefitUtilizationSummariesListByBillingProfileIdResponse, - BenefitUtilizationSummariesListBySavingsPlanOrderNextOptionalParams, - BenefitUtilizationSummariesListBySavingsPlanOrderOptionalParams, - BenefitUtilizationSummariesListBySavingsPlanOrderResponse, - BenefitUtilizationSummariesListBySavingsPlanIdNextOptionalParams, - BenefitUtilizationSummariesListBySavingsPlanIdOptionalParams, - BenefitUtilizationSummariesListBySavingsPlanIdResponse, - BenefitUtilizationSummariesListByBillingAccountIdNextResponse, - BenefitUtilizationSummariesListByBillingProfileIdNextResponse, - BenefitUtilizationSummariesListBySavingsPlanOrderNextResponse, - BenefitUtilizationSummariesListBySavingsPlanIdNextResponse -} from "../models/index.js"; - -/// -/** Class containing BenefitUtilizationSummaries operations. */ -export class BenefitUtilizationSummariesImpl - implements BenefitUtilizationSummaries { - private readonly client: CostManagementClient; - - /** - * Initialize a new instance of the class BenefitUtilizationSummaries class. - * @param client Reference to the service client - */ - constructor(client: CostManagementClient) { - this.client = client; - } - - /** - * Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain - * values: 'Daily' and 'Monthly'. - * @param billingAccountId Billing account ID - * @param options The options parameters. - */ - public listByBillingAccountId( - billingAccountId: string, - options?: BenefitUtilizationSummariesListByBillingAccountIdOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listByBillingAccountIdPagingAll( - billingAccountId, - options - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByBillingAccountIdPagingPage( - billingAccountId, - options, - settings - ); - } - }; - } - - private async *listByBillingAccountIdPagingPage( - billingAccountId: string, - options?: BenefitUtilizationSummariesListByBillingAccountIdOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: BenefitUtilizationSummariesListByBillingAccountIdResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByBillingAccountId(billingAccountId, options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByBillingAccountIdNext( - billingAccountId, - continuationToken, - options - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByBillingAccountIdPagingAll( - billingAccountId: string, - options?: BenefitUtilizationSummariesListByBillingAccountIdOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listByBillingAccountIdPagingPage( - billingAccountId, - options - )) { - yield* page; - } - } - - /** - * Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and - * 'Monthly'. - * @param billingAccountId Billing account ID - * @param billingProfileId Billing profile ID. - * @param options The options parameters. - */ - public listByBillingProfileId( - billingAccountId: string, - billingProfileId: string, - options?: BenefitUtilizationSummariesListByBillingProfileIdOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listByBillingProfileIdPagingAll( - billingAccountId, - billingProfileId, - options - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByBillingProfileIdPagingPage( - billingAccountId, - billingProfileId, - options, - settings - ); - } - }; - } - - private async *listByBillingProfileIdPagingPage( - billingAccountId: string, - billingProfileId: string, - options?: BenefitUtilizationSummariesListByBillingProfileIdOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: BenefitUtilizationSummariesListByBillingProfileIdResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByBillingProfileId( - billingAccountId, - billingProfileId, - options - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByBillingProfileIdNext( - billingAccountId, - billingProfileId, - continuationToken, - options - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByBillingProfileIdPagingAll( - billingAccountId: string, - billingProfileId: string, - options?: BenefitUtilizationSummariesListByBillingProfileIdOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listByBillingProfileIdPagingPage( - billingAccountId, - billingProfileId, - options - )) { - yield* page; - } - } - - /** - * Lists the savings plan utilization summaries for daily or monthly grain. - * @param savingsPlanOrderId Savings plan order ID. - * @param options The options parameters. - */ - public listBySavingsPlanOrder( - savingsPlanOrderId: string, - options?: BenefitUtilizationSummariesListBySavingsPlanOrderOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listBySavingsPlanOrderPagingAll( - savingsPlanOrderId, - options - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listBySavingsPlanOrderPagingPage( - savingsPlanOrderId, - options, - settings - ); - } - }; - } - - private async *listBySavingsPlanOrderPagingPage( - savingsPlanOrderId: string, - options?: BenefitUtilizationSummariesListBySavingsPlanOrderOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: BenefitUtilizationSummariesListBySavingsPlanOrderResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listBySavingsPlanOrder(savingsPlanOrderId, options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listBySavingsPlanOrderNext( - savingsPlanOrderId, - continuationToken, - options - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listBySavingsPlanOrderPagingAll( - savingsPlanOrderId: string, - options?: BenefitUtilizationSummariesListBySavingsPlanOrderOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listBySavingsPlanOrderPagingPage( - savingsPlanOrderId, - options - )) { - yield* page; - } - } - - /** - * Lists the savings plan utilization summaries for daily or monthly grain. - * @param savingsPlanOrderId Savings plan order ID. - * @param savingsPlanId Savings plan ID. - * @param options The options parameters. - */ - public listBySavingsPlanId( - savingsPlanOrderId: string, - savingsPlanId: string, - options?: BenefitUtilizationSummariesListBySavingsPlanIdOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listBySavingsPlanIdPagingAll( - savingsPlanOrderId, - savingsPlanId, - options - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listBySavingsPlanIdPagingPage( - savingsPlanOrderId, - savingsPlanId, - options, - settings - ); - } - }; - } - - private async *listBySavingsPlanIdPagingPage( - savingsPlanOrderId: string, - savingsPlanId: string, - options?: BenefitUtilizationSummariesListBySavingsPlanIdOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: BenefitUtilizationSummariesListBySavingsPlanIdResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listBySavingsPlanId( - savingsPlanOrderId, - savingsPlanId, - options - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listBySavingsPlanIdNext( - savingsPlanOrderId, - savingsPlanId, - continuationToken, - options - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listBySavingsPlanIdPagingAll( - savingsPlanOrderId: string, - savingsPlanId: string, - options?: BenefitUtilizationSummariesListBySavingsPlanIdOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listBySavingsPlanIdPagingPage( - savingsPlanOrderId, - savingsPlanId, - options - )) { - yield* page; - } - } - - /** - * Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain - * values: 'Daily' and 'Monthly'. - * @param billingAccountId Billing account ID - * @param options The options parameters. - */ - private _listByBillingAccountId( - billingAccountId: string, - options?: BenefitUtilizationSummariesListByBillingAccountIdOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { billingAccountId, options }, - listByBillingAccountIdOperationSpec - ); - } - - /** - * Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and - * 'Monthly'. - * @param billingAccountId Billing account ID - * @param billingProfileId Billing profile ID. - * @param options The options parameters. - */ - private _listByBillingProfileId( - billingAccountId: string, - billingProfileId: string, - options?: BenefitUtilizationSummariesListByBillingProfileIdOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { billingAccountId, billingProfileId, options }, - listByBillingProfileIdOperationSpec - ); - } - - /** - * Lists the savings plan utilization summaries for daily or monthly grain. - * @param savingsPlanOrderId Savings plan order ID. - * @param options The options parameters. - */ - private _listBySavingsPlanOrder( - savingsPlanOrderId: string, - options?: BenefitUtilizationSummariesListBySavingsPlanOrderOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { savingsPlanOrderId, options }, - listBySavingsPlanOrderOperationSpec - ); - } - - /** - * Lists the savings plan utilization summaries for daily or monthly grain. - * @param savingsPlanOrderId Savings plan order ID. - * @param savingsPlanId Savings plan ID. - * @param options The options parameters. - */ - private _listBySavingsPlanId( - savingsPlanOrderId: string, - savingsPlanId: string, - options?: BenefitUtilizationSummariesListBySavingsPlanIdOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { savingsPlanOrderId, savingsPlanId, options }, - listBySavingsPlanIdOperationSpec - ); - } - - /** - * ListByBillingAccountIdNext - * @param billingAccountId Billing account ID - * @param nextLink The nextLink from the previous successful call to the ListByBillingAccountId method. - * @param options The options parameters. - */ - private _listByBillingAccountIdNext( - billingAccountId: string, - nextLink: string, - options?: BenefitUtilizationSummariesListByBillingAccountIdNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { billingAccountId, nextLink, options }, - listByBillingAccountIdNextOperationSpec - ); - } - - /** - * ListByBillingProfileIdNext - * @param billingAccountId Billing account ID - * @param billingProfileId Billing profile ID. - * @param nextLink The nextLink from the previous successful call to the ListByBillingProfileId method. - * @param options The options parameters. - */ - private _listByBillingProfileIdNext( - billingAccountId: string, - billingProfileId: string, - nextLink: string, - options?: BenefitUtilizationSummariesListByBillingProfileIdNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { billingAccountId, billingProfileId, nextLink, options }, - listByBillingProfileIdNextOperationSpec - ); - } - - /** - * ListBySavingsPlanOrderNext - * @param savingsPlanOrderId Savings plan order ID. - * @param nextLink The nextLink from the previous successful call to the ListBySavingsPlanOrder method. - * @param options The options parameters. - */ - private _listBySavingsPlanOrderNext( - savingsPlanOrderId: string, - nextLink: string, - options?: BenefitUtilizationSummariesListBySavingsPlanOrderNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { savingsPlanOrderId, nextLink, options }, - listBySavingsPlanOrderNextOperationSpec - ); - } - - /** - * ListBySavingsPlanIdNext - * @param savingsPlanOrderId Savings plan order ID. - * @param savingsPlanId Savings plan ID. - * @param nextLink The nextLink from the previous successful call to the ListBySavingsPlanId method. - * @param options The options parameters. - */ - private _listBySavingsPlanIdNext( - savingsPlanOrderId: string, - savingsPlanId: string, - nextLink: string, - options?: BenefitUtilizationSummariesListBySavingsPlanIdNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { savingsPlanOrderId, savingsPlanId, nextLink, options }, - listBySavingsPlanIdNextOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listByBillingAccountIdOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.BenefitUtilizationSummariesListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [ - Parameters.apiVersion, - Parameters.grainParameter, - Parameters.filter1 - ], - urlParameters: [Parameters.$host, Parameters.billingAccountId], - headerParameters: [Parameters.accept], - serializer -}; -const listByBillingProfileIdOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.BenefitUtilizationSummariesListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [ - Parameters.apiVersion, - Parameters.grainParameter, - Parameters.filter1 - ], - urlParameters: [ - Parameters.$host, - Parameters.billingAccountId, - Parameters.billingProfileId - ], - headerParameters: [Parameters.accept], - serializer -}; -const listBySavingsPlanOrderOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.BenefitUtilizationSummariesListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.grainParameter - ], - urlParameters: [Parameters.$host, Parameters.savingsPlanOrderId], - headerParameters: [Parameters.accept], - serializer -}; -const listBySavingsPlanIdOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.BenefitUtilizationSummariesListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.grainParameter - ], - urlParameters: [ - Parameters.$host, - Parameters.savingsPlanOrderId, - Parameters.savingsPlanId - ], - headerParameters: [Parameters.accept], - serializer -}; -const listByBillingAccountIdNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.BenefitUtilizationSummariesListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.billingAccountId - ], - headerParameters: [Parameters.accept], - serializer -}; -const listByBillingProfileIdNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.BenefitUtilizationSummariesListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.billingAccountId, - Parameters.billingProfileId - ], - headerParameters: [Parameters.accept], - serializer -}; -const listBySavingsPlanOrderNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.BenefitUtilizationSummariesListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.savingsPlanOrderId - ], - headerParameters: [Parameters.accept], - serializer -}; -const listBySavingsPlanIdNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.BenefitUtilizationSummariesListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.savingsPlanOrderId, - Parameters.savingsPlanId - ], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/cost-management/arm-costmanagement/src/operations/dimensions.ts b/sdk/cost-management/arm-costmanagement/src/operations/dimensions.ts deleted file mode 100644 index b34d0f219ff6..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operations/dimensions.ts +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { Dimensions } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { CostManagementClient } from "../costManagementClient.js"; -import { - Dimension, - DimensionsListOptionalParams, - DimensionsListResponse, - ExternalCloudProviderType, - DimensionsByExternalCloudProviderTypeOptionalParams, - DimensionsByExternalCloudProviderTypeResponse -} from "../models/index.js"; - -/// -/** Class containing Dimensions operations. */ -export class DimensionsImpl implements Dimensions { - private readonly client: CostManagementClient; - - /** - * Initialize a new instance of the class Dimensions class. - * @param client Reference to the service client - */ - constructor(client: CostManagementClient) { - this.client = client; - } - - /** - * Lists the dimensions by the defined scope. - * @param 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. - * @param options The options parameters. - */ - public list( - scope: string, - options?: DimensionsListOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(scope, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage(scope, options, settings); - } - }; - } - - private async *listPagingPage( - scope: string, - options?: DimensionsListOptionalParams, - _settings?: PageSettings - ): AsyncIterableIterator { - let result: DimensionsListResponse; - result = await this._list(scope, options); - yield result.value || []; - } - - private async *listPagingAll( - scope: string, - options?: DimensionsListOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listPagingPage(scope, options)) { - yield* page; - } - } - - /** - * Lists the dimensions by the external cloud provider type. - * @param externalCloudProviderType The external cloud provider type associated with dimension/query - * operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' - * for consolidated account. - * @param externalCloudProviderId This can be '{externalSubscriptionId}' for linked account or - * '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - * @param options The options parameters. - */ - public listByExternalCloudProviderType( - externalCloudProviderType: ExternalCloudProviderType, - externalCloudProviderId: string, - options?: DimensionsByExternalCloudProviderTypeOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.byExternalCloudProviderTypePagingAll( - externalCloudProviderType, - externalCloudProviderId, - options - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.byExternalCloudProviderTypePagingPage( - externalCloudProviderType, - externalCloudProviderId, - options, - settings - ); - } - }; - } - - private async *byExternalCloudProviderTypePagingPage( - externalCloudProviderType: ExternalCloudProviderType, - externalCloudProviderId: string, - options?: DimensionsByExternalCloudProviderTypeOptionalParams, - _settings?: PageSettings - ): AsyncIterableIterator { - let result: DimensionsByExternalCloudProviderTypeResponse; - result = await this._byExternalCloudProviderType( - externalCloudProviderType, - externalCloudProviderId, - options - ); - yield result.value || []; - } - - private async *byExternalCloudProviderTypePagingAll( - externalCloudProviderType: ExternalCloudProviderType, - externalCloudProviderId: string, - options?: DimensionsByExternalCloudProviderTypeOptionalParams - ): AsyncIterableIterator { - for await (const page of this.byExternalCloudProviderTypePagingPage( - externalCloudProviderType, - externalCloudProviderId, - options - )) { - yield* page; - } - } - - /** - * Lists the dimensions by the defined scope. - * @param 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. - * @param options The options parameters. - */ - private _list( - scope: string, - options?: DimensionsListOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, options }, - listOperationSpec - ); - } - - /** - * Lists the dimensions by the external cloud provider type. - * @param externalCloudProviderType The external cloud provider type associated with dimension/query - * operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' - * for consolidated account. - * @param externalCloudProviderId This can be '{externalSubscriptionId}' for linked account or - * '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - * @param options The options parameters. - */ - private _byExternalCloudProviderType( - externalCloudProviderType: ExternalCloudProviderType, - externalCloudProviderId: string, - options?: DimensionsByExternalCloudProviderTypeOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { externalCloudProviderType, externalCloudProviderId, options }, - byExternalCloudProviderTypeOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/{scope}/providers/Microsoft.CostManagement/dimensions", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DimensionsListResult - }, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.expand, - Parameters.skiptoken, - Parameters.top - ], - urlParameters: [Parameters.$host, Parameters.scope1], - headerParameters: [Parameters.accept], - serializer -}; -const byExternalCloudProviderTypeOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DimensionsListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.expand, - Parameters.skiptoken, - Parameters.top - ], - urlParameters: [ - Parameters.$host, - Parameters.externalCloudProviderType, - Parameters.externalCloudProviderId - ], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/cost-management/arm-costmanagement/src/operations/exports.ts b/sdk/cost-management/arm-costmanagement/src/operations/exports.ts deleted file mode 100644 index c1416ad56603..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operations/exports.ts +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { Exports } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { CostManagementClient } from "../costManagementClient.js"; -import { - ExportsListOptionalParams, - ExportsListResponse, - ExportsGetOptionalParams, - ExportsGetResponse, - Export, - ExportsCreateOrUpdateOptionalParams, - ExportsCreateOrUpdateResponse, - ExportsDeleteOptionalParams, - ExportsExecuteOptionalParams, - ExportsGetExecutionHistoryOptionalParams, - ExportsGetExecutionHistoryResponse -} from "../models/index.js"; - -/** Class containing Exports operations. */ -export class ExportsImpl implements Exports { - private readonly client: CostManagementClient; - - /** - * Initialize a new instance of the class Exports class. - * @param client Reference to the service client - */ - constructor(client: CostManagementClient) { - this.client = client; - } - - /** - * The operation to list all exports at the given scope. - * @param 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. - * @param options The options parameters. - */ - list( - scope: string, - options?: ExportsListOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, options }, - listOperationSpec - ); - } - - /** - * The operation to get the export for the defined scope by export name. - * @param 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. - * @param exportName Export Name. - * @param options The options parameters. - */ - get( - scope: string, - exportName: string, - options?: ExportsGetOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, exportName, options }, - getOperationSpec - ); - } - - /** - * 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. - * @param 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. - * @param exportName Export Name. - * @param parameters Parameters supplied to the CreateOrUpdate Export operation. - * @param options The options parameters. - */ - createOrUpdate( - scope: string, - exportName: string, - parameters: Export, - options?: ExportsCreateOrUpdateOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, exportName, parameters, options }, - createOrUpdateOperationSpec - ); - } - - /** - * The operation to delete a export. - * @param 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. - * @param exportName Export Name. - * @param options The options parameters. - */ - delete( - scope: string, - exportName: string, - options?: ExportsDeleteOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, exportName, options }, - deleteOperationSpec - ); - } - - /** - * The operation to run an export. - * @param 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. - * @param exportName Export Name. - * @param options The options parameters. - */ - execute( - scope: string, - exportName: string, - options?: ExportsExecuteOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, exportName, options }, - executeOperationSpec - ); - } - - /** - * The operation to get the run history of an export for the defined scope and export name. - * @param 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. - * @param exportName Export Name. - * @param options The options parameters. - */ - getExecutionHistory( - scope: string, - exportName: string, - options?: ExportsGetExecutionHistoryOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, exportName, options }, - getExecutionHistoryOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/{scope}/providers/Microsoft.CostManagement/exports", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ExportListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion, Parameters.expand], - urlParameters: [Parameters.$host, Parameters.scope1], - headerParameters: [Parameters.accept], - serializer -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.Export - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion, Parameters.expand], - urlParameters: [Parameters.$host, Parameters.scope1, Parameters.exportName], - headerParameters: [Parameters.accept], - serializer -}; -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.Export - }, - 201: { - bodyMapper: Mappers.Export - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - requestBody: Parameters.parameters4, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope1, Parameters.exportName], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}", - httpMethod: "DELETE", - responses: { - 200: {}, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope1, Parameters.exportName], - headerParameters: [Parameters.accept], - serializer -}; -const executeOperationSpec: coreClient.OperationSpec = { - path: "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/run", - httpMethod: "POST", - responses: { - 200: {}, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope1, Parameters.exportName], - headerParameters: [Parameters.accept], - serializer -}; -const getExecutionHistoryOperationSpec: coreClient.OperationSpec = { - path: - "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/runHistory", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ExportExecutionListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope1, Parameters.exportName], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/cost-management/arm-costmanagement/src/operations/forecast.ts b/sdk/cost-management/arm-costmanagement/src/operations/forecast.ts deleted file mode 100644 index a98bb8e4d909..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operations/forecast.ts +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { Forecast } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { CostManagementClient } from "../costManagementClient.js"; -import { - ForecastDefinition, - ForecastUsageOptionalParams, - ForecastUsageResponse, - ExternalCloudProviderType, - ForecastExternalCloudProviderUsageOptionalParams, - ForecastExternalCloudProviderUsageResponse -} from "../models/index.js"; - -/** Class containing Forecast operations. */ -export class ForecastImpl implements Forecast { - private readonly client: CostManagementClient; - - /** - * Initialize a new instance of the class Forecast class. - * @param client Reference to the service client - */ - constructor(client: CostManagementClient) { - this.client = client; - } - - /** - * Lists the forecast charges for scope defined. - * @param 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. - * @param parameters Parameters supplied to the CreateOrUpdate Forecast Config operation. - * @param options The options parameters. - */ - usage( - scope: string, - parameters: ForecastDefinition, - options?: ForecastUsageOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, parameters, options }, - usageOperationSpec - ); - } - - /** - * Lists the forecast charges for external cloud provider type defined. - * @param externalCloudProviderType The external cloud provider type associated with dimension/query - * operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' - * for consolidated account. - * @param externalCloudProviderId This can be '{externalSubscriptionId}' for linked account or - * '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - * @param parameters Parameters supplied to the CreateOrUpdate Forecast Config operation. - * @param options The options parameters. - */ - externalCloudProviderUsage( - externalCloudProviderType: ExternalCloudProviderType, - externalCloudProviderId: string, - parameters: ForecastDefinition, - options?: ForecastExternalCloudProviderUsageOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { - externalCloudProviderType, - externalCloudProviderId, - parameters, - options - }, - externalCloudProviderUsageOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const usageOperationSpec: coreClient.OperationSpec = { - path: "/{scope}/providers/Microsoft.CostManagement/forecast", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.ForecastResult - }, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - requestBody: Parameters.parameters2, - queryParameters: [Parameters.apiVersion, Parameters.filter], - urlParameters: [Parameters.$host, Parameters.scope1], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; -const externalCloudProviderUsageOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.ForecastResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - requestBody: Parameters.parameters2, - queryParameters: [Parameters.apiVersion, Parameters.filter], - urlParameters: [ - Parameters.$host, - Parameters.externalCloudProviderType, - Parameters.externalCloudProviderId - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; diff --git a/sdk/cost-management/arm-costmanagement/src/operations/generateCostDetailsReport.ts b/sdk/cost-management/arm-costmanagement/src/operations/generateCostDetailsReport.ts deleted file mode 100644 index c7771550c583..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operations/generateCostDetailsReport.ts +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { GenerateCostDetailsReport } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { CostManagementClient } from "../costManagementClient.js"; -import { - SimplePollerLike, - OperationState, - createHttpPoller -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import { - GenerateCostDetailsReportRequestDefinition, - GenerateCostDetailsReportCreateOperationOptionalParams, - GenerateCostDetailsReportCreateOperationResponse, - GenerateCostDetailsReportGetOperationResultsOptionalParams, - GenerateCostDetailsReportGetOperationResultsResponse -} from "../models/index.js"; - -/** Class containing GenerateCostDetailsReport operations. */ -export class GenerateCostDetailsReportImpl - implements GenerateCostDetailsReport { - private readonly client: CostManagementClient; - - /** - * Initialize a new instance of the class GenerateCostDetailsReport class. - * @param client Reference to the service client - */ - constructor(client: CostManagementClient) { - this.client = client; - } - - /** - * This API is the replacement for all previously release Usage Details APIs. Request to generate a - * cost details report for the provided date range, billing period (Only enterprise customers) or - * Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 - * with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll - * to get the result of the report generation. The 'Retry-After' provides the duration to wait before - * polling for the generated report. A call to poll the report operation will provide a 202 response - * with a 'Location' header if the operation is still in progress. Once the report generation operation - * completes, the polling endpoint will provide a 200 response along with details on the report blob(s) - * that are available for download. The details on the file(s) available for download will be available - * in the polling response body. To Understand cost details (formerly known as usage details) fields - * found in files ,see - * https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * @param scope The ARM Resource ID for subscription, resource group, billing account, or other billing - * scopes. For details, see https://aka.ms/costmgmt/scopes. - * @param parameters Parameters supplied to the Create cost details operation. - * @param options The options parameters. - */ - async beginCreateOperation( - scope: string, - parameters: GenerateCostDetailsReportRequestDefinition, - options?: GenerateCostDetailsReportCreateOperationOptionalParams - ): Promise< - SimplePollerLike< - OperationState, - GenerateCostDetailsReportCreateOperationResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ) => { - let currentRawResponse: - | coreClient.FullOperationResponse - | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback - } - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON() - } - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { scope, parameters, options }, - spec: createOperationOperationSpec - }); - const poller = await createHttpPoller< - GenerateCostDetailsReportCreateOperationResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location" - }); - await poller.poll(); - return poller; - } - - /** - * This API is the replacement for all previously release Usage Details APIs. Request to generate a - * cost details report for the provided date range, billing period (Only enterprise customers) or - * Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 - * with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll - * to get the result of the report generation. The 'Retry-After' provides the duration to wait before - * polling for the generated report. A call to poll the report operation will provide a 202 response - * with a 'Location' header if the operation is still in progress. Once the report generation operation - * completes, the polling endpoint will provide a 200 response along with details on the report blob(s) - * that are available for download. The details on the file(s) available for download will be available - * in the polling response body. To Understand cost details (formerly known as usage details) fields - * found in files ,see - * https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * @param scope The ARM Resource ID for subscription, resource group, billing account, or other billing - * scopes. For details, see https://aka.ms/costmgmt/scopes. - * @param parameters Parameters supplied to the Create cost details operation. - * @param options The options parameters. - */ - async beginCreateOperationAndWait( - scope: string, - parameters: GenerateCostDetailsReportRequestDefinition, - options?: GenerateCostDetailsReportCreateOperationOptionalParams - ): Promise { - const poller = await this.beginCreateOperation(scope, parameters, options); - return poller.pollUntilDone(); - } - - /** - * Get the result of the specified operation. This link is provided in the CostDetails creation request - * response Location header. - * @param scope The ARM Resource ID for subscription, resource group, billing account, or other billing - * scopes. For details, see https://aka.ms/costmgmt/scopes. - * @param operationId The target operation Id. - * @param options The options parameters. - */ - async beginGetOperationResults( - scope: string, - operationId: string, - options?: GenerateCostDetailsReportGetOperationResultsOptionalParams - ): Promise< - SimplePollerLike< - OperationState, - GenerateCostDetailsReportGetOperationResultsResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ) => { - let currentRawResponse: - | coreClient.FullOperationResponse - | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback - } - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON() - } - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { scope, operationId, options }, - spec: getOperationResultsOperationSpec - }); - const poller = await createHttpPoller< - GenerateCostDetailsReportGetOperationResultsResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location" - }); - await poller.poll(); - return poller; - } - - /** - * Get the result of the specified operation. This link is provided in the CostDetails creation request - * response Location header. - * @param scope The ARM Resource ID for subscription, resource group, billing account, or other billing - * scopes. For details, see https://aka.ms/costmgmt/scopes. - * @param operationId The target operation Id. - * @param options The options parameters. - */ - async beginGetOperationResultsAndWait( - scope: string, - operationId: string, - options?: GenerateCostDetailsReportGetOperationResultsOptionalParams - ): Promise { - const poller = await this.beginGetOperationResults( - scope, - operationId, - options - ); - return poller.pollUntilDone(); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const createOperationOperationSpec: coreClient.OperationSpec = { - path: "/{scope}/providers/Microsoft.CostManagement/generateCostDetailsReport", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.CostDetailsOperationResults - }, - 201: { - bodyMapper: Mappers.CostDetailsOperationResults - }, - 202: { - bodyMapper: Mappers.CostDetailsOperationResults - }, - 204: { - bodyMapper: Mappers.CostDetailsOperationResults - }, - default: { - bodyMapper: Mappers.GenerateCostDetailsReportErrorResponse - } - }, - requestBody: Parameters.parameters5, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope1], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; -const getOperationResultsOperationSpec: coreClient.OperationSpec = { - path: - "/{scope}/providers/Microsoft.CostManagement/costDetailsOperationResults/{operationId}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.CostDetailsOperationResults - }, - 201: { - bodyMapper: Mappers.CostDetailsOperationResults - }, - 202: { - bodyMapper: Mappers.CostDetailsOperationResults - }, - 204: { - bodyMapper: Mappers.CostDetailsOperationResults - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope1, Parameters.operationId], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/cost-management/arm-costmanagement/src/operations/generateDetailedCostReport.ts b/sdk/cost-management/arm-costmanagement/src/operations/generateDetailedCostReport.ts deleted file mode 100644 index a3661356cf35..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operations/generateDetailedCostReport.ts +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { GenerateDetailedCostReport } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { CostManagementClient } from "../costManagementClient.js"; -import { - SimplePollerLike, - OperationState, - createHttpPoller -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import { - GenerateDetailedCostReportDefinition, - GenerateDetailedCostReportCreateOperationOptionalParams, - GenerateDetailedCostReportCreateOperationResponse -} from "../models/index.js"; - -/** Class containing GenerateDetailedCostReport operations. */ -export class GenerateDetailedCostReportImpl - implements GenerateDetailedCostReport { - private readonly client: CostManagementClient; - - /** - * Initialize a new instance of the class GenerateDetailedCostReport class. - * @param client Reference to the service client - */ - constructor(client: CostManagementClient) { - this.client = client; - } - - /** - * 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. - * @param scope The ARM Resource ID for subscription, resource group, billing account, or other billing - * scopes. For details, see https://aka.ms/costmgmt/scopes. - * @param parameters Parameters supplied to the Create detailed cost report operation. - * @param options The options parameters. - */ - async beginCreateOperation( - scope: string, - parameters: GenerateDetailedCostReportDefinition, - options?: GenerateDetailedCostReportCreateOperationOptionalParams - ): Promise< - SimplePollerLike< - OperationState, - GenerateDetailedCostReportCreateOperationResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ) => { - let currentRawResponse: - | coreClient.FullOperationResponse - | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback - } - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON() - } - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { scope, parameters, options }, - spec: createOperationOperationSpec - }); - const poller = await createHttpPoller< - GenerateDetailedCostReportCreateOperationResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location" - }); - await poller.poll(); - return poller; - } - - /** - * 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. - * @param scope The ARM Resource ID for subscription, resource group, billing account, or other billing - * scopes. For details, see https://aka.ms/costmgmt/scopes. - * @param parameters Parameters supplied to the Create detailed cost report operation. - * @param options The options parameters. - */ - async beginCreateOperationAndWait( - scope: string, - parameters: GenerateDetailedCostReportDefinition, - options?: GenerateDetailedCostReportCreateOperationOptionalParams - ): Promise { - const poller = await this.beginCreateOperation(scope, parameters, options); - return poller.pollUntilDone(); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const createOperationOperationSpec: coreClient.OperationSpec = { - path: - "/{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.GenerateDetailedCostReportOperationResult - }, - 201: { - bodyMapper: Mappers.GenerateDetailedCostReportOperationResult - }, - 202: { - bodyMapper: Mappers.GenerateDetailedCostReportOperationResult - }, - 204: { - bodyMapper: Mappers.GenerateDetailedCostReportOperationResult - }, - default: { - bodyMapper: Mappers.GenerateDetailedCostReportErrorResponse - } - }, - requestBody: Parameters.parameters6, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope1], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; diff --git a/sdk/cost-management/arm-costmanagement/src/operations/generateDetailedCostReportOperationResults.ts b/sdk/cost-management/arm-costmanagement/src/operations/generateDetailedCostReportOperationResults.ts deleted file mode 100644 index 35f808db70e9..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operations/generateDetailedCostReportOperationResults.ts +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { GenerateDetailedCostReportOperationResults } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { CostManagementClient } from "../costManagementClient.js"; -import { - SimplePollerLike, - OperationState, - createHttpPoller -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import { - GenerateDetailedCostReportOperationResultsGetOptionalParams, - GenerateDetailedCostReportOperationResultsGetResponse -} from "../models/index.js"; - -/** Class containing GenerateDetailedCostReportOperationResults operations. */ -export class GenerateDetailedCostReportOperationResultsImpl - implements GenerateDetailedCostReportOperationResults { - private readonly client: CostManagementClient; - - /** - * Initialize a new instance of the class GenerateDetailedCostReportOperationResults class. - * @param client Reference to the service client - */ - constructor(client: CostManagementClient) { - this.client = client; - } - - /** - * Gets the result of the specified operation. The link with this operationId is provided as a response - * header of the initial request. - * @param operationId The target operation Id. - * @param scope The ARM Resource ID for subscription, resource group, billing account, or other billing - * scopes. For details, see https://aka.ms/costmgmt/scopes. - * @param options The options parameters. - */ - async beginGet( - operationId: string, - scope: string, - options?: GenerateDetailedCostReportOperationResultsGetOptionalParams - ): Promise< - SimplePollerLike< - OperationState, - GenerateDetailedCostReportOperationResultsGetResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ) => { - let currentRawResponse: - | coreClient.FullOperationResponse - | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback - } - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON() - } - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { operationId, scope, options }, - spec: getOperationSpec - }); - const poller = await createHttpPoller< - GenerateDetailedCostReportOperationResultsGetResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs - }); - await poller.poll(); - return poller; - } - - /** - * Gets the result of the specified operation. The link with this operationId is provided as a response - * header of the initial request. - * @param operationId The target operation Id. - * @param scope The ARM Resource ID for subscription, resource group, billing account, or other billing - * scopes. For details, see https://aka.ms/costmgmt/scopes. - * @param options The options parameters. - */ - async beginGetAndWait( - operationId: string, - scope: string, - options?: GenerateDetailedCostReportOperationResultsGetOptionalParams - ): Promise { - const poller = await this.beginGet(operationId, scope, options); - return poller.pollUntilDone(); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const getOperationSpec: coreClient.OperationSpec = { - path: - "/{scope}/providers/Microsoft.CostManagement/operationResults/{operationId}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.GenerateDetailedCostReportOperationResult - }, - 201: { - bodyMapper: Mappers.GenerateDetailedCostReportOperationResult - }, - 202: { - bodyMapper: Mappers.GenerateDetailedCostReportOperationResult - }, - 204: { - bodyMapper: Mappers.GenerateDetailedCostReportOperationResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope1, Parameters.operationId], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/cost-management/arm-costmanagement/src/operations/generateDetailedCostReportOperationStatus.ts b/sdk/cost-management/arm-costmanagement/src/operations/generateDetailedCostReportOperationStatus.ts deleted file mode 100644 index 8a5bb42ba145..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operations/generateDetailedCostReportOperationStatus.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { GenerateDetailedCostReportOperationStatus } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { CostManagementClient } from "../costManagementClient.js"; -import { - GenerateDetailedCostReportOperationStatusGetOptionalParams, - GenerateDetailedCostReportOperationStatusGetResponse -} from "../models/index.js"; - -/** Class containing GenerateDetailedCostReportOperationStatus operations. */ -export class GenerateDetailedCostReportOperationStatusImpl - implements GenerateDetailedCostReportOperationStatus { - private readonly client: CostManagementClient; - - /** - * Initialize a new instance of the class GenerateDetailedCostReportOperationStatus class. - * @param client Reference to the service client - */ - constructor(client: CostManagementClient) { - this.client = client; - } - - /** - * Get the status of the specified operation. This link is provided in the GenerateDetailedCostReport - * creation request response header. - * @param operationId The target operation Id. - * @param scope The ARM Resource ID for subscription, resource group, billing account, or other billing - * scopes. For details, see https://aka.ms/costmgmt/scopes. - * @param options The options parameters. - */ - get( - operationId: string, - scope: string, - options?: GenerateDetailedCostReportOperationStatusGetOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { operationId, scope, options }, - getOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const getOperationSpec: coreClient.OperationSpec = { - path: - "/{scope}/providers/Microsoft.CostManagement/operationStatus/{operationId}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.GenerateDetailedCostReportOperationStatuses - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope1, Parameters.operationId], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/cost-management/arm-costmanagement/src/operations/generateReservationDetailsReport.ts b/sdk/cost-management/arm-costmanagement/src/operations/generateReservationDetailsReport.ts deleted file mode 100644 index c3c70f36710a..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operations/generateReservationDetailsReport.ts +++ /dev/null @@ -1,319 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { GenerateReservationDetailsReport } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { CostManagementClient } from "../costManagementClient.js"; -import { - SimplePollerLike, - OperationState, - createHttpPoller -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import { - GenerateReservationDetailsReportByBillingAccountIdOptionalParams, - GenerateReservationDetailsReportByBillingAccountIdResponse, - GenerateReservationDetailsReportByBillingProfileIdOptionalParams, - GenerateReservationDetailsReportByBillingProfileIdResponse -} from "../models/index.js"; - -/** Class containing GenerateReservationDetailsReport operations. */ -export class GenerateReservationDetailsReportImpl - implements GenerateReservationDetailsReport { - private readonly client: CostManagementClient; - - /** - * Initialize a new instance of the class GenerateReservationDetailsReport class. - * @param client Reference to the service client - */ - constructor(client: CostManagementClient) { - this.client = client; - } - - /** - * 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/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role - * @param billingAccountId Enrollment ID (Legacy BillingAccount ID) - * @param startDate Start Date - * @param endDate End Date - * @param options The options parameters. - */ - async beginByBillingAccountId( - billingAccountId: string, - startDate: string, - endDate: string, - options?: GenerateReservationDetailsReportByBillingAccountIdOptionalParams - ): Promise< - SimplePollerLike< - OperationState< - GenerateReservationDetailsReportByBillingAccountIdResponse - >, - GenerateReservationDetailsReportByBillingAccountIdResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ) => { - let currentRawResponse: - | coreClient.FullOperationResponse - | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback - } - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON() - } - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { billingAccountId, startDate, endDate, options }, - spec: byBillingAccountIdOperationSpec - }); - const poller = await createHttpPoller< - GenerateReservationDetailsReportByBillingAccountIdResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location" - }); - await poller.poll(); - return poller; - } - - /** - * 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/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role - * @param billingAccountId Enrollment ID (Legacy BillingAccount ID) - * @param startDate Start Date - * @param endDate End Date - * @param options The options parameters. - */ - async beginByBillingAccountIdAndWait( - billingAccountId: string, - startDate: string, - endDate: string, - options?: GenerateReservationDetailsReportByBillingAccountIdOptionalParams - ): Promise { - const poller = await this.beginByBillingAccountId( - billingAccountId, - startDate, - endDate, - options - ); - return poller.pollUntilDone(); - } - - /** - * 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/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access - * @param billingAccountId Billing account ID - * @param billingProfileId Billing profile ID. - * @param startDate Start Date - * @param endDate End Date - * @param options The options parameters. - */ - async beginByBillingProfileId( - billingAccountId: string, - billingProfileId: string, - startDate: string, - endDate: string, - options?: GenerateReservationDetailsReportByBillingProfileIdOptionalParams - ): Promise< - SimplePollerLike< - OperationState< - GenerateReservationDetailsReportByBillingProfileIdResponse - >, - GenerateReservationDetailsReportByBillingProfileIdResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ) => { - let currentRawResponse: - | coreClient.FullOperationResponse - | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback - } - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON() - } - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { billingAccountId, billingProfileId, startDate, endDate, options }, - spec: byBillingProfileIdOperationSpec - }); - const poller = await createHttpPoller< - GenerateReservationDetailsReportByBillingProfileIdResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location" - }); - await poller.poll(); - return poller; - } - - /** - * 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/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access - * @param billingAccountId Billing account ID - * @param billingProfileId Billing profile ID. - * @param startDate Start Date - * @param endDate End Date - * @param options The options parameters. - */ - async beginByBillingProfileIdAndWait( - billingAccountId: string, - billingProfileId: string, - startDate: string, - endDate: string, - options?: GenerateReservationDetailsReportByBillingProfileIdOptionalParams - ): Promise { - const poller = await this.beginByBillingProfileId( - billingAccountId, - billingProfileId, - startDate, - endDate, - options - ); - return poller.pollUntilDone(); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const byBillingAccountIdOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.OperationStatus - }, - 201: { - bodyMapper: Mappers.OperationStatus - }, - 202: { - bodyMapper: Mappers.OperationStatus - }, - 204: { - bodyMapper: Mappers.OperationStatus - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [ - Parameters.apiVersion, - Parameters.startDate, - Parameters.endDate - ], - urlParameters: [Parameters.$host, Parameters.billingAccountId], - headerParameters: [Parameters.accept], - serializer -}; -const byBillingProfileIdOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.OperationStatus - }, - 201: { - bodyMapper: Mappers.OperationStatus - }, - 202: { - bodyMapper: Mappers.OperationStatus - }, - 204: { - bodyMapper: Mappers.OperationStatus - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [ - Parameters.apiVersion, - Parameters.startDate, - Parameters.endDate - ], - urlParameters: [ - Parameters.$host, - Parameters.billingAccountId, - Parameters.billingProfileId - ], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/cost-management/arm-costmanagement/src/operations/index.ts b/sdk/cost-management/arm-costmanagement/src/operations/index.ts deleted file mode 100644 index c448e99f0693..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operations/index.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export * from "./operations.js"; -export * from "./views.js"; -export * from "./alerts.js"; -export * from "./forecast.js"; -export * from "./dimensions.js"; -export * from "./query.js"; -export * from "./generateReservationDetailsReport.js"; -export * from "./exports.js"; -export * from "./generateCostDetailsReport.js"; -export * from "./generateDetailedCostReport.js"; -export * from "./generateDetailedCostReportOperationResults.js"; -export * from "./generateDetailedCostReportOperationStatus.js"; -export * from "./priceSheet.js"; -export * from "./scheduledActions.js"; -export * from "./benefitRecommendations.js"; -export * from "./benefitUtilizationSummaries.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/operations/operations.ts b/sdk/cost-management/arm-costmanagement/src/operations/operations.ts deleted file mode 100644 index eb39a05a435e..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operations/operations.ts +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { Operations } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { CostManagementClient } from "../costManagementClient.js"; -import { - CostManagementOperation, - OperationsListNextOptionalParams, - OperationsListOptionalParams, - OperationsListResponse, - OperationsListNextResponse -} from "../models/index.js"; - -/// -/** Class containing Operations operations. */ -export class OperationsImpl implements Operations { - private readonly client: CostManagementClient; - - /** - * Initialize a new instance of the class Operations class. - * @param client Reference to the service client - */ - constructor(client: CostManagementClient) { - this.client = client; - } - - /** - * Lists all of the available cost management REST API operations. - * @param options The options parameters. - */ - public list( - options?: OperationsListOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage(options, settings); - } - }; - } - - private async *listPagingPage( - options?: OperationsListOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: OperationsListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext(continuationToken, options); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - options?: OperationsListOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listPagingPage(options)) { - yield* page; - } - } - - /** - * Lists all of the available cost management REST API operations. - * @param options The options parameters. - */ - private _list( - options?: OperationsListOptionalParams - ): Promise { - return this.client.sendOperationRequest({ options }, listOperationSpec); - } - - /** - * ListNext - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - nextLink: string, - options?: OperationsListNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { nextLink, options }, - listNextOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.CostManagement/operations", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.OperationListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host], - headerParameters: [Parameters.accept], - serializer -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.OperationListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - urlParameters: [Parameters.$host, Parameters.nextLink], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/cost-management/arm-costmanagement/src/operations/priceSheet.ts b/sdk/cost-management/arm-costmanagement/src/operations/priceSheet.ts deleted file mode 100644 index 53def3f22b65..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operations/priceSheet.ts +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PriceSheet } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { CostManagementClient } from "../costManagementClient.js"; -import { - SimplePollerLike, - OperationState, - createHttpPoller -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import { - PriceSheetDownloadOptionalParams, - PriceSheetDownloadResponse, - PriceSheetDownloadByBillingProfileOptionalParams, - PriceSheetDownloadByBillingProfileResponse -} from "../models/index.js"; - -/** Class containing PriceSheet operations. */ -export class PriceSheetImpl implements PriceSheet { - private readonly client: CostManagementClient; - - /** - * Initialize a new instance of the class PriceSheet class. - * @param client Reference to the service client - */ - constructor(client: CostManagementClient) { - this.client = client; - } - - /** - * 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. - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param invoiceName The ID that uniquely identifies an invoice. - * @param options The options parameters. - */ - async beginDownload( - billingAccountName: string, - billingProfileName: string, - invoiceName: string, - options?: PriceSheetDownloadOptionalParams - ): Promise< - SimplePollerLike< - OperationState, - PriceSheetDownloadResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ) => { - let currentRawResponse: - | coreClient.FullOperationResponse - | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback - } - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON() - } - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { billingAccountName, billingProfileName, invoiceName, options }, - spec: downloadOperationSpec - }); - const poller = await createHttpPoller< - PriceSheetDownloadResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location" - }); - await poller.poll(); - return poller; - } - - /** - * 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. - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param invoiceName The ID that uniquely identifies an invoice. - * @param options The options parameters. - */ - async beginDownloadAndWait( - billingAccountName: string, - billingProfileName: string, - invoiceName: string, - options?: PriceSheetDownloadOptionalParams - ): Promise { - const poller = await this.beginDownload( - billingAccountName, - billingProfileName, - invoiceName, - options - ); - return poller.pollUntilDone(); - } - - /** - * 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. - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param options The options parameters. - */ - async beginDownloadByBillingProfile( - billingAccountName: string, - billingProfileName: string, - options?: PriceSheetDownloadByBillingProfileOptionalParams - ): Promise< - SimplePollerLike< - OperationState, - PriceSheetDownloadByBillingProfileResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ) => { - let currentRawResponse: - | coreClient.FullOperationResponse - | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback - } - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON() - } - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { billingAccountName, billingProfileName, options }, - spec: downloadByBillingProfileOperationSpec - }); - const poller = await createHttpPoller< - PriceSheetDownloadByBillingProfileResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location" - }); - await poller.poll(); - return poller; - } - - /** - * 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. - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param options The options parameters. - */ - async beginDownloadByBillingProfileAndWait( - billingAccountName: string, - billingProfileName: string, - options?: PriceSheetDownloadByBillingProfileOptionalParams - ): Promise { - const poller = await this.beginDownloadByBillingProfile( - billingAccountName, - billingProfileName, - options - ); - return poller.pollUntilDone(); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const downloadOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.DownloadURL - }, - 201: { - bodyMapper: Mappers.DownloadURL - }, - 202: { - bodyMapper: Mappers.DownloadURL - }, - 204: { - bodyMapper: Mappers.DownloadURL - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.billingAccountName, - Parameters.billingProfileName, - Parameters.invoiceName - ], - headerParameters: [Parameters.accept], - serializer -}; -const downloadByBillingProfileOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.DownloadURL - }, - 201: { - bodyMapper: Mappers.DownloadURL - }, - 202: { - bodyMapper: Mappers.DownloadURL - }, - 204: { - bodyMapper: Mappers.DownloadURL - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.billingAccountName, - Parameters.billingProfileName - ], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/cost-management/arm-costmanagement/src/operations/query.ts b/sdk/cost-management/arm-costmanagement/src/operations/query.ts deleted file mode 100644 index d67b7c2dae0f..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operations/query.ts +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { Query } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { CostManagementClient } from "../costManagementClient.js"; -import { - QueryDefinition, - QueryUsageOptionalParams, - QueryUsageResponse, - ExternalCloudProviderType, - QueryUsageByExternalCloudProviderTypeOptionalParams, - QueryUsageByExternalCloudProviderTypeResponse -} from "../models/index.js"; - -/** Class containing Query operations. */ -export class QueryImpl implements Query { - private readonly client: CostManagementClient; - - /** - * Initialize a new instance of the class Query class. - * @param client Reference to the service client - */ - constructor(client: CostManagementClient) { - this.client = client; - } - - /** - * Query the usage data for scope defined. - * @param 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. - * @param parameters Parameters supplied to the CreateOrUpdate Query Config operation. - * @param options The options parameters. - */ - usage( - scope: string, - parameters: QueryDefinition, - options?: QueryUsageOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, parameters, options }, - usageOperationSpec - ); - } - - /** - * Query the usage data for external cloud provider type defined. - * @param externalCloudProviderType The external cloud provider type associated with dimension/query - * operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' - * for consolidated account. - * @param externalCloudProviderId This can be '{externalSubscriptionId}' for linked account or - * '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - * @param parameters Parameters supplied to the CreateOrUpdate Query Config operation. - * @param options The options parameters. - */ - usageByExternalCloudProviderType( - externalCloudProviderType: ExternalCloudProviderType, - externalCloudProviderId: string, - parameters: QueryDefinition, - options?: QueryUsageByExternalCloudProviderTypeOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { - externalCloudProviderType, - externalCloudProviderId, - parameters, - options - }, - usageByExternalCloudProviderTypeOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const usageOperationSpec: coreClient.OperationSpec = { - path: "/{scope}/providers/Microsoft.CostManagement/query", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.QueryResult - }, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - requestBody: Parameters.parameters3, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope1], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; -const usageByExternalCloudProviderTypeOperationSpec: coreClient.OperationSpec = { - path: - "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.QueryResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - requestBody: Parameters.parameters3, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.externalCloudProviderType, - Parameters.externalCloudProviderId - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; diff --git a/sdk/cost-management/arm-costmanagement/src/operations/scheduledActions.ts b/sdk/cost-management/arm-costmanagement/src/operations/scheduledActions.ts deleted file mode 100644 index bba2e055e02f..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operations/scheduledActions.ts +++ /dev/null @@ -1,752 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { ScheduledActions } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { CostManagementClient } from "../costManagementClient.js"; -import { - ScheduledAction, - ScheduledActionsListNextOptionalParams, - ScheduledActionsListOptionalParams, - ScheduledActionsListResponse, - ScheduledActionsListByScopeNextOptionalParams, - ScheduledActionsListByScopeOptionalParams, - ScheduledActionsListByScopeResponse, - ScheduledActionsCreateOrUpdateOptionalParams, - ScheduledActionsCreateOrUpdateResponse, - ScheduledActionsGetOptionalParams, - ScheduledActionsGetResponse, - ScheduledActionsDeleteOptionalParams, - ScheduledActionsCreateOrUpdateByScopeOptionalParams, - ScheduledActionsCreateOrUpdateByScopeResponse, - ScheduledActionsGetByScopeOptionalParams, - ScheduledActionsGetByScopeResponse, - ScheduledActionsDeleteByScopeOptionalParams, - ScheduledActionsRunOptionalParams, - ScheduledActionsRunByScopeOptionalParams, - CheckNameAvailabilityRequest, - ScheduledActionsCheckNameAvailabilityOptionalParams, - ScheduledActionsCheckNameAvailabilityResponse, - ScheduledActionsCheckNameAvailabilityByScopeOptionalParams, - ScheduledActionsCheckNameAvailabilityByScopeResponse, - ScheduledActionsListNextResponse, - ScheduledActionsListByScopeNextResponse -} from "../models/index.js"; - -/// -/** Class containing ScheduledActions operations. */ -export class ScheduledActionsImpl implements ScheduledActions { - private readonly client: CostManagementClient; - - /** - * Initialize a new instance of the class ScheduledActions class. - * @param client Reference to the service client - */ - constructor(client: CostManagementClient) { - this.client = client; - } - - /** - * List all private scheduled actions. - * @param options The options parameters. - */ - public list( - options?: ScheduledActionsListOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage(options, settings); - } - }; - } - - private async *listPagingPage( - options?: ScheduledActionsListOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: ScheduledActionsListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext(continuationToken, options); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - options?: ScheduledActionsListOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listPagingPage(options)) { - yield* page; - } - } - - /** - * List all shared scheduled actions within the given scope. - * @param 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. - * @param options The options parameters. - */ - public listByScope( - scope: string, - options?: ScheduledActionsListByScopeOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listByScopePagingAll(scope, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByScopePagingPage(scope, options, settings); - } - }; - } - - private async *listByScopePagingPage( - scope: string, - options?: ScheduledActionsListByScopeOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: ScheduledActionsListByScopeResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByScope(scope, options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByScopeNext(scope, continuationToken, options); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByScopePagingAll( - scope: string, - options?: ScheduledActionsListByScopeOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listByScopePagingPage(scope, options)) { - yield* page; - } - } - - /** - * List all private scheduled actions. - * @param options The options parameters. - */ - private _list( - options?: ScheduledActionsListOptionalParams - ): Promise { - return this.client.sendOperationRequest({ options }, listOperationSpec); - } - - /** - * List all shared scheduled actions within the given scope. - * @param 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. - * @param options The options parameters. - */ - private _listByScope( - scope: string, - options?: ScheduledActionsListByScopeOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, options }, - listByScopeOperationSpec - ); - } - - /** - * Create or update a private scheduled action. - * @param name Scheduled action name. - * @param scheduledAction Scheduled action to be created or updated. - * @param options The options parameters. - */ - createOrUpdate( - name: string, - scheduledAction: ScheduledAction, - options?: ScheduledActionsCreateOrUpdateOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { name, scheduledAction, options }, - createOrUpdateOperationSpec - ); - } - - /** - * Get the private scheduled action by name. - * @param name Scheduled action name. - * @param options The options parameters. - */ - get( - name: string, - options?: ScheduledActionsGetOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { name, options }, - getOperationSpec - ); - } - - /** - * Delete a private scheduled action. - * @param name Scheduled action name. - * @param options The options parameters. - */ - delete( - name: string, - options?: ScheduledActionsDeleteOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { name, options }, - deleteOperationSpec - ); - } - - /** - * Create or update a shared scheduled action within the given scope. - * @param 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. - * @param name Scheduled action name. - * @param scheduledAction Scheduled action to be created or updated. - * @param options The options parameters. - */ - createOrUpdateByScope( - scope: string, - name: string, - scheduledAction: ScheduledAction, - options?: ScheduledActionsCreateOrUpdateByScopeOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, name, scheduledAction, options }, - createOrUpdateByScopeOperationSpec - ); - } - - /** - * Get the shared scheduled action from the given scope by name. - * @param 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. - * @param name Scheduled action name. - * @param options The options parameters. - */ - getByScope( - scope: string, - name: string, - options?: ScheduledActionsGetByScopeOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, name, options }, - getByScopeOperationSpec - ); - } - - /** - * Delete a scheduled action within the given scope. - * @param 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. - * @param name Scheduled action name. - * @param options The options parameters. - */ - deleteByScope( - scope: string, - name: string, - options?: ScheduledActionsDeleteByScopeOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, name, options }, - deleteByScopeOperationSpec - ); - } - - /** - * Processes a private scheduled action. - * @param name Scheduled action name. - * @param options The options parameters. - */ - run( - name: string, - options?: ScheduledActionsRunOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { name, options }, - runOperationSpec - ); - } - - /** - * Runs a shared scheduled action within the given scope. - * @param 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. - * @param name Scheduled action name. - * @param options The options parameters. - */ - runByScope( - scope: string, - name: string, - options?: ScheduledActionsRunByScopeOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, name, options }, - runByScopeOperationSpec - ); - } - - /** - * Checks availability and correctness of the name for a scheduled action. - * @param checkNameAvailabilityRequest Scheduled action to be created or updated. - * @param options The options parameters. - */ - checkNameAvailability( - checkNameAvailabilityRequest: CheckNameAvailabilityRequest, - options?: ScheduledActionsCheckNameAvailabilityOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { checkNameAvailabilityRequest, options }, - checkNameAvailabilityOperationSpec - ); - } - - /** - * Checks availability and correctness of the name for a scheduled action within the given scope. - * @param 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. - * @param checkNameAvailabilityRequest Scheduled action to be created or updated. - * @param options The options parameters. - */ - checkNameAvailabilityByScope( - scope: string, - checkNameAvailabilityRequest: CheckNameAvailabilityRequest, - options?: ScheduledActionsCheckNameAvailabilityByScopeOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, checkNameAvailabilityRequest, options }, - checkNameAvailabilityByScopeOperationSpec - ); - } - - /** - * ListNext - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - nextLink: string, - options?: ScheduledActionsListNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { nextLink, options }, - listNextOperationSpec - ); - } - - /** - * ListByScopeNext - * @param 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. - * @param nextLink The nextLink from the previous successful call to the ListByScope method. - * @param options The options parameters. - */ - private _listByScopeNext( - scope: string, - nextLink: string, - options?: ScheduledActionsListByScopeNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, nextLink, options }, - listByScopeNextOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.CostManagement/scheduledActions", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ScheduledActionListResult - }, - default: { - bodyMapper: Mappers.ErrorResponseWithNestedDetails - } - }, - queryParameters: [Parameters.apiVersion, Parameters.filter], - urlParameters: [Parameters.$host], - headerParameters: [Parameters.accept], - serializer -}; -const listByScopeOperationSpec: coreClient.OperationSpec = { - path: "/{scope}/providers/Microsoft.CostManagement/scheduledActions", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ScheduledActionListResult - }, - default: { - bodyMapper: Mappers.ErrorResponseWithNestedDetails - } - }, - queryParameters: [Parameters.apiVersion, Parameters.filter], - urlParameters: [Parameters.$host, Parameters.scope], - headerParameters: [Parameters.accept], - serializer -}; -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.CostManagement/scheduledActions/{name}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.ScheduledAction - }, - 201: { - bodyMapper: Mappers.ScheduledAction - }, - default: { - bodyMapper: Mappers.ErrorResponseWithNestedDetails - } - }, - requestBody: Parameters.scheduledAction, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.name], - headerParameters: [ - Parameters.accept, - Parameters.contentType, - Parameters.ifMatch - ], - mediaType: "json", - serializer -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.CostManagement/scheduledActions/{name}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ScheduledAction - }, - default: { - bodyMapper: Mappers.ErrorResponseWithNestedDetails - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.name], - headerParameters: [Parameters.accept], - serializer -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.CostManagement/scheduledActions/{name}", - httpMethod: "DELETE", - responses: { - 200: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponseWithNestedDetails - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.name], - headerParameters: [Parameters.accept], - serializer -}; -const createOrUpdateByScopeOperationSpec: coreClient.OperationSpec = { - path: "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.ScheduledAction - }, - 201: { - bodyMapper: Mappers.ScheduledAction - }, - default: { - bodyMapper: Mappers.ErrorResponseWithNestedDetails - } - }, - requestBody: Parameters.scheduledAction, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope, Parameters.name], - headerParameters: [ - Parameters.accept, - Parameters.contentType, - Parameters.ifMatch - ], - mediaType: "json", - serializer -}; -const getByScopeOperationSpec: coreClient.OperationSpec = { - path: "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ScheduledAction - }, - default: { - bodyMapper: Mappers.ErrorResponseWithNestedDetails - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope, Parameters.name], - headerParameters: [Parameters.accept], - serializer -}; -const deleteByScopeOperationSpec: coreClient.OperationSpec = { - path: "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}", - httpMethod: "DELETE", - responses: { - 200: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponseWithNestedDetails - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope, Parameters.name], - headerParameters: [Parameters.accept], - serializer -}; -const runOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.CostManagement/scheduledActions/{name}/execute", - httpMethod: "POST", - responses: { - 200: {}, - default: { - bodyMapper: Mappers.ErrorResponseWithNestedDetails - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.name], - headerParameters: [Parameters.accept], - serializer -}; -const runByScopeOperationSpec: coreClient.OperationSpec = { - path: - "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}/execute", - httpMethod: "POST", - responses: { - 200: {}, - default: { - bodyMapper: Mappers.ErrorResponseWithNestedDetails - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope, Parameters.name], - headerParameters: [Parameters.accept], - serializer -}; -const checkNameAvailabilityOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.CostManagement/checkNameAvailability", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.CheckNameAvailabilityResponse - }, - default: { - bodyMapper: Mappers.ErrorResponseWithNestedDetails - } - }, - requestBody: Parameters.checkNameAvailabilityRequest, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; -const checkNameAvailabilityByScopeOperationSpec: coreClient.OperationSpec = { - path: "/{scope}/providers/Microsoft.CostManagement/checkNameAvailability", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.CheckNameAvailabilityResponse - }, - default: { - bodyMapper: Mappers.ErrorResponseWithNestedDetails - } - }, - requestBody: Parameters.checkNameAvailabilityRequest, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ScheduledActionListResult - }, - default: { - bodyMapper: Mappers.ErrorResponseWithNestedDetails - } - }, - urlParameters: [Parameters.$host, Parameters.nextLink], - headerParameters: [Parameters.accept], - serializer -}; -const listByScopeNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ScheduledActionListResult - }, - default: { - bodyMapper: Mappers.ErrorResponseWithNestedDetails - } - }, - urlParameters: [Parameters.$host, Parameters.nextLink, Parameters.scope], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/cost-management/arm-costmanagement/src/operations/views.ts b/sdk/cost-management/arm-costmanagement/src/operations/views.ts deleted file mode 100644 index 5b40950560a9..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operations/views.ts +++ /dev/null @@ -1,583 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { Views } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { CostManagementClient } from "../costManagementClient.js"; -import { - View, - ViewsListNextOptionalParams, - ViewsListOptionalParams, - ViewsListResponse, - ViewsListByScopeNextOptionalParams, - ViewsListByScopeOptionalParams, - ViewsListByScopeResponse, - ViewsGetOptionalParams, - ViewsGetResponse, - ViewsCreateOrUpdateOptionalParams, - ViewsCreateOrUpdateResponse, - ViewsDeleteOptionalParams, - ViewsGetByScopeOptionalParams, - ViewsGetByScopeResponse, - ViewsCreateOrUpdateByScopeOptionalParams, - ViewsCreateOrUpdateByScopeResponse, - ViewsDeleteByScopeOptionalParams, - ViewsListNextResponse, - ViewsListByScopeNextResponse -} from "../models/index.js"; - -/// -/** Class containing Views operations. */ -export class ViewsImpl implements Views { - private readonly client: CostManagementClient; - - /** - * Initialize a new instance of the class Views class. - * @param client Reference to the service client - */ - constructor(client: CostManagementClient) { - this.client = client; - } - - /** - * Lists all views by tenant and object. - * @param options The options parameters. - */ - public list( - options?: ViewsListOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage(options, settings); - } - }; - } - - private async *listPagingPage( - options?: ViewsListOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: ViewsListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext(continuationToken, options); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - options?: ViewsListOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listPagingPage(options)) { - yield* page; - } - } - - /** - * Lists all views at the given scope. - * @param 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. - * @param options The options parameters. - */ - public listByScope( - scope: string, - options?: ViewsListByScopeOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listByScopePagingAll(scope, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByScopePagingPage(scope, options, settings); - } - }; - } - - private async *listByScopePagingPage( - scope: string, - options?: ViewsListByScopeOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: ViewsListByScopeResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByScope(scope, options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByScopeNext(scope, continuationToken, options); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByScopePagingAll( - scope: string, - options?: ViewsListByScopeOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listByScopePagingPage(scope, options)) { - yield* page; - } - } - - /** - * Lists all views by tenant and object. - * @param options The options parameters. - */ - private _list(options?: ViewsListOptionalParams): Promise { - return this.client.sendOperationRequest({ options }, listOperationSpec); - } - - /** - * Lists all views at the given scope. - * @param 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. - * @param options The options parameters. - */ - private _listByScope( - scope: string, - options?: ViewsListByScopeOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, options }, - listByScopeOperationSpec - ); - } - - /** - * Gets the view by view name. - * @param viewName View name - * @param options The options parameters. - */ - get( - viewName: string, - options?: ViewsGetOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { viewName, options }, - getOperationSpec - ); - } - - /** - * 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. - * @param viewName View name - * @param parameters Parameters supplied to the CreateOrUpdate View operation. - * @param options The options parameters. - */ - createOrUpdate( - viewName: string, - parameters: View, - options?: ViewsCreateOrUpdateOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { viewName, parameters, options }, - createOrUpdateOperationSpec - ); - } - - /** - * The operation to delete a view. - * @param viewName View name - * @param options The options parameters. - */ - delete(viewName: string, options?: ViewsDeleteOptionalParams): Promise { - return this.client.sendOperationRequest( - { viewName, options }, - deleteOperationSpec - ); - } - - /** - * Gets the view for the defined scope by view name. - * @param 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. - * @param viewName View name - * @param options The options parameters. - */ - getByScope( - scope: string, - viewName: string, - options?: ViewsGetByScopeOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, viewName, options }, - getByScopeOperationSpec - ); - } - - /** - * 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. - * @param 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. - * @param viewName View name - * @param parameters Parameters supplied to the CreateOrUpdate View operation. - * @param options The options parameters. - */ - createOrUpdateByScope( - scope: string, - viewName: string, - parameters: View, - options?: ViewsCreateOrUpdateByScopeOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, viewName, parameters, options }, - createOrUpdateByScopeOperationSpec - ); - } - - /** - * The operation to delete a view. - * @param 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. - * @param viewName View name - * @param options The options parameters. - */ - deleteByScope( - scope: string, - viewName: string, - options?: ViewsDeleteByScopeOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, viewName, options }, - deleteByScopeOperationSpec - ); - } - - /** - * ListNext - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - nextLink: string, - options?: ViewsListNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { nextLink, options }, - listNextOperationSpec - ); - } - - /** - * ListByScopeNext - * @param 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. - * @param nextLink The nextLink from the previous successful call to the ListByScope method. - * @param options The options parameters. - */ - private _listByScopeNext( - scope: string, - nextLink: string, - options?: ViewsListByScopeNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, nextLink, options }, - listByScopeNextOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.CostManagement/views", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ViewListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host], - headerParameters: [Parameters.accept], - serializer -}; -const listByScopeOperationSpec: coreClient.OperationSpec = { - path: "/{scope}/providers/Microsoft.CostManagement/views", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ViewListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope], - headerParameters: [Parameters.accept], - serializer -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.CostManagement/views/{viewName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.View - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.viewName], - headerParameters: [Parameters.accept], - serializer -}; -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.CostManagement/views/{viewName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.View - }, - 201: { - bodyMapper: Mappers.View - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - requestBody: Parameters.parameters, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.viewName], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.CostManagement/views/{viewName}", - httpMethod: "DELETE", - responses: { - 200: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.viewName], - headerParameters: [Parameters.accept], - serializer -}; -const getByScopeOperationSpec: coreClient.OperationSpec = { - path: "/{scope}/providers/Microsoft.CostManagement/views/{viewName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.View - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope, Parameters.viewName], - headerParameters: [Parameters.accept], - serializer -}; -const createOrUpdateByScopeOperationSpec: coreClient.OperationSpec = { - path: "/{scope}/providers/Microsoft.CostManagement/views/{viewName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.View - }, - 201: { - bodyMapper: Mappers.View - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - requestBody: Parameters.parameters, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope, Parameters.viewName], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; -const deleteByScopeOperationSpec: coreClient.OperationSpec = { - path: "/{scope}/providers/Microsoft.CostManagement/views/{viewName}", - httpMethod: "DELETE", - responses: { - 200: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.scope, Parameters.viewName], - headerParameters: [Parameters.accept], - serializer -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ViewListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - urlParameters: [Parameters.$host, Parameters.nextLink], - headerParameters: [Parameters.accept], - serializer -}; -const listByScopeNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ViewListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - urlParameters: [Parameters.$host, Parameters.nextLink, Parameters.scope], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/alerts.ts b/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/alerts.ts deleted file mode 100644 index 850cf7dba43f..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/alerts.ts +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { - AlertsListOptionalParams, - AlertsListResponse, - AlertsGetOptionalParams, - AlertsGetResponse, - DismissAlertPayload, - AlertsDismissOptionalParams, - AlertsDismissResponse, - ExternalCloudProviderType, - AlertsListExternalOptionalParams, - AlertsListExternalResponse -} from "../models/index.js"; - -/** Interface representing a Alerts. */ -export interface Alerts { - /** - * Lists the alerts for scope defined. - * @param 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. - * @param options The options parameters. - */ - list( - scope: string, - options?: AlertsListOptionalParams - ): Promise; - /** - * Gets the alert for the scope by alert ID. - * @param 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. - * @param alertId Alert ID - * @param options The options parameters. - */ - get( - scope: string, - alertId: string, - options?: AlertsGetOptionalParams - ): Promise; - /** - * Dismisses the specified alert - * @param 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. - * @param alertId Alert ID - * @param parameters Parameters supplied to the Dismiss Alert operation. - * @param options The options parameters. - */ - dismiss( - scope: string, - alertId: string, - parameters: DismissAlertPayload, - options?: AlertsDismissOptionalParams - ): Promise; - /** - * Lists the Alerts for external cloud provider type defined. - * @param externalCloudProviderType The external cloud provider type associated with dimension/query - * operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' - * for consolidated account. - * @param externalCloudProviderId This can be '{externalSubscriptionId}' for linked account or - * '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - * @param options The options parameters. - */ - listExternal( - externalCloudProviderType: ExternalCloudProviderType, - externalCloudProviderId: string, - options?: AlertsListExternalOptionalParams - ): Promise; -} diff --git a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/benefitRecommendations.ts b/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/benefitRecommendations.ts deleted file mode 100644 index b8e6b915cdc3..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/benefitRecommendations.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { - BenefitRecommendationModel, - BenefitRecommendationsListOptionalParams -} from "../models/index.js"; - -/// -/** Interface representing a BenefitRecommendations. */ -export interface BenefitRecommendations { - /** - * List of recommendations for purchasing savings plan. - * @param billingScope The scope associated with benefit recommendation operations. This includes - * '/subscriptions/{subscriptionId}/' for subscription scope, - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, - * /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for enterprise agreement scope, and - * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' - * for billing profile scope - * @param options The options parameters. - */ - list( - billingScope: string, - options?: BenefitRecommendationsListOptionalParams - ): PagedAsyncIterableIterator; -} diff --git a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/benefitUtilizationSummaries.ts b/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/benefitUtilizationSummaries.ts deleted file mode 100644 index 588a1d8cd1f6..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/benefitUtilizationSummaries.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { - BenefitUtilizationSummaryUnion, - BenefitUtilizationSummariesListByBillingAccountIdOptionalParams, - BenefitUtilizationSummariesListByBillingProfileIdOptionalParams, - BenefitUtilizationSummariesListBySavingsPlanOrderOptionalParams, - BenefitUtilizationSummariesListBySavingsPlanIdOptionalParams -} from "../models/index.js"; - -/// -/** Interface representing a BenefitUtilizationSummaries. */ -export interface BenefitUtilizationSummaries { - /** - * Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain - * values: 'Daily' and 'Monthly'. - * @param billingAccountId Billing account ID - * @param options The options parameters. - */ - listByBillingAccountId( - billingAccountId: string, - options?: BenefitUtilizationSummariesListByBillingAccountIdOptionalParams - ): PagedAsyncIterableIterator; - /** - * Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and - * 'Monthly'. - * @param billingAccountId Billing account ID - * @param billingProfileId Billing profile ID. - * @param options The options parameters. - */ - listByBillingProfileId( - billingAccountId: string, - billingProfileId: string, - options?: BenefitUtilizationSummariesListByBillingProfileIdOptionalParams - ): PagedAsyncIterableIterator; - /** - * Lists the savings plan utilization summaries for daily or monthly grain. - * @param savingsPlanOrderId Savings plan order ID. - * @param options The options parameters. - */ - listBySavingsPlanOrder( - savingsPlanOrderId: string, - options?: BenefitUtilizationSummariesListBySavingsPlanOrderOptionalParams - ): PagedAsyncIterableIterator; - /** - * Lists the savings plan utilization summaries for daily or monthly grain. - * @param savingsPlanOrderId Savings plan order ID. - * @param savingsPlanId Savings plan ID. - * @param options The options parameters. - */ - listBySavingsPlanId( - savingsPlanOrderId: string, - savingsPlanId: string, - options?: BenefitUtilizationSummariesListBySavingsPlanIdOptionalParams - ): PagedAsyncIterableIterator; -} diff --git a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/dimensions.ts b/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/dimensions.ts deleted file mode 100644 index 6ef04456b09a..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/dimensions.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { - Dimension, - DimensionsListOptionalParams, - ExternalCloudProviderType, - DimensionsByExternalCloudProviderTypeOptionalParams -} from "../models/index.js"; - -/// -/** Interface representing a Dimensions. */ -export interface Dimensions { - /** - * Lists the dimensions by the defined scope. - * @param 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. - * @param options The options parameters. - */ - list( - scope: string, - options?: DimensionsListOptionalParams - ): PagedAsyncIterableIterator; - /** - * Lists the dimensions by the external cloud provider type. - * @param externalCloudProviderType The external cloud provider type associated with dimension/query - * operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' - * for consolidated account. - * @param externalCloudProviderId This can be '{externalSubscriptionId}' for linked account or - * '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - * @param options The options parameters. - */ - listByExternalCloudProviderType( - externalCloudProviderType: ExternalCloudProviderType, - externalCloudProviderId: string, - options?: DimensionsByExternalCloudProviderTypeOptionalParams - ): PagedAsyncIterableIterator; -} diff --git a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/exports.ts b/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/exports.ts deleted file mode 100644 index 085ca31616b8..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/exports.ts +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { - ExportsListOptionalParams, - ExportsListResponse, - ExportsGetOptionalParams, - ExportsGetResponse, - Export, - ExportsCreateOrUpdateOptionalParams, - ExportsCreateOrUpdateResponse, - ExportsDeleteOptionalParams, - ExportsExecuteOptionalParams, - ExportsGetExecutionHistoryOptionalParams, - ExportsGetExecutionHistoryResponse -} from "../models/index.js"; - -/** Interface representing a Exports. */ -export interface Exports { - /** - * The operation to list all exports at the given scope. - * @param 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. - * @param options The options parameters. - */ - list( - scope: string, - options?: ExportsListOptionalParams - ): Promise; - /** - * The operation to get the export for the defined scope by export name. - * @param 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. - * @param exportName Export Name. - * @param options The options parameters. - */ - get( - scope: string, - exportName: string, - options?: ExportsGetOptionalParams - ): Promise; - /** - * 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. - * @param 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. - * @param exportName Export Name. - * @param parameters Parameters supplied to the CreateOrUpdate Export operation. - * @param options The options parameters. - */ - createOrUpdate( - scope: string, - exportName: string, - parameters: Export, - options?: ExportsCreateOrUpdateOptionalParams - ): Promise; - /** - * The operation to delete a export. - * @param 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. - * @param exportName Export Name. - * @param options The options parameters. - */ - delete( - scope: string, - exportName: string, - options?: ExportsDeleteOptionalParams - ): Promise; - /** - * The operation to run an export. - * @param 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. - * @param exportName Export Name. - * @param options The options parameters. - */ - execute( - scope: string, - exportName: string, - options?: ExportsExecuteOptionalParams - ): Promise; - /** - * The operation to get the run history of an export for the defined scope and export name. - * @param 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. - * @param exportName Export Name. - * @param options The options parameters. - */ - getExecutionHistory( - scope: string, - exportName: string, - options?: ExportsGetExecutionHistoryOptionalParams - ): Promise; -} diff --git a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/forecast.ts b/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/forecast.ts deleted file mode 100644 index 3fb49b86d262..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/forecast.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { - ForecastDefinition, - ForecastUsageOptionalParams, - ForecastUsageResponse, - ExternalCloudProviderType, - ForecastExternalCloudProviderUsageOptionalParams, - ForecastExternalCloudProviderUsageResponse -} from "../models/index.js"; - -/** Interface representing a Forecast. */ -export interface Forecast { - /** - * Lists the forecast charges for scope defined. - * @param 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. - * @param parameters Parameters supplied to the CreateOrUpdate Forecast Config operation. - * @param options The options parameters. - */ - usage( - scope: string, - parameters: ForecastDefinition, - options?: ForecastUsageOptionalParams - ): Promise; - /** - * Lists the forecast charges for external cloud provider type defined. - * @param externalCloudProviderType The external cloud provider type associated with dimension/query - * operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' - * for consolidated account. - * @param externalCloudProviderId This can be '{externalSubscriptionId}' for linked account or - * '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - * @param parameters Parameters supplied to the CreateOrUpdate Forecast Config operation. - * @param options The options parameters. - */ - externalCloudProviderUsage( - externalCloudProviderType: ExternalCloudProviderType, - externalCloudProviderId: string, - parameters: ForecastDefinition, - options?: ForecastExternalCloudProviderUsageOptionalParams - ): Promise; -} diff --git a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/generateCostDetailsReport.ts b/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/generateCostDetailsReport.ts deleted file mode 100644 index dc108befee13..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/generateCostDetailsReport.ts +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { - GenerateCostDetailsReportRequestDefinition, - GenerateCostDetailsReportCreateOperationOptionalParams, - GenerateCostDetailsReportCreateOperationResponse, - GenerateCostDetailsReportGetOperationResultsOptionalParams, - GenerateCostDetailsReportGetOperationResultsResponse -} from "../models/index.js"; - -/** Interface representing a GenerateCostDetailsReport. */ -export interface GenerateCostDetailsReport { - /** - * This API is the replacement for all previously release Usage Details APIs. Request to generate a - * cost details report for the provided date range, billing period (Only enterprise customers) or - * Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 - * with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll - * to get the result of the report generation. The 'Retry-After' provides the duration to wait before - * polling for the generated report. A call to poll the report operation will provide a 202 response - * with a 'Location' header if the operation is still in progress. Once the report generation operation - * completes, the polling endpoint will provide a 200 response along with details on the report blob(s) - * that are available for download. The details on the file(s) available for download will be available - * in the polling response body. To Understand cost details (formerly known as usage details) fields - * found in files ,see - * https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * @param scope The ARM Resource ID for subscription, resource group, billing account, or other billing - * scopes. For details, see https://aka.ms/costmgmt/scopes. - * @param parameters Parameters supplied to the Create cost details operation. - * @param options The options parameters. - */ - beginCreateOperation( - scope: string, - parameters: GenerateCostDetailsReportRequestDefinition, - options?: GenerateCostDetailsReportCreateOperationOptionalParams - ): Promise< - SimplePollerLike< - OperationState, - GenerateCostDetailsReportCreateOperationResponse - > - >; - /** - * This API is the replacement for all previously release Usage Details APIs. Request to generate a - * cost details report for the provided date range, billing period (Only enterprise customers) or - * Invoice Id asynchronously at a certain scope. The initial call to request a report will return a 202 - * with a 'Location' and 'Retry-After' header. The 'Location' header will provide the endpoint to poll - * to get the result of the report generation. The 'Retry-After' provides the duration to wait before - * polling for the generated report. A call to poll the report operation will provide a 202 response - * with a 'Location' header if the operation is still in progress. Once the report generation operation - * completes, the polling endpoint will provide a 200 response along with details on the report blob(s) - * that are available for download. The details on the file(s) available for download will be available - * in the polling response body. To Understand cost details (formerly known as usage details) fields - * found in files ,see - * https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields - * @param scope The ARM Resource ID for subscription, resource group, billing account, or other billing - * scopes. For details, see https://aka.ms/costmgmt/scopes. - * @param parameters Parameters supplied to the Create cost details operation. - * @param options The options parameters. - */ - beginCreateOperationAndWait( - scope: string, - parameters: GenerateCostDetailsReportRequestDefinition, - options?: GenerateCostDetailsReportCreateOperationOptionalParams - ): Promise; - /** - * Get the result of the specified operation. This link is provided in the CostDetails creation request - * response Location header. - * @param scope The ARM Resource ID for subscription, resource group, billing account, or other billing - * scopes. For details, see https://aka.ms/costmgmt/scopes. - * @param operationId The target operation Id. - * @param options The options parameters. - */ - beginGetOperationResults( - scope: string, - operationId: string, - options?: GenerateCostDetailsReportGetOperationResultsOptionalParams - ): Promise< - SimplePollerLike< - OperationState, - GenerateCostDetailsReportGetOperationResultsResponse - > - >; - /** - * Get the result of the specified operation. This link is provided in the CostDetails creation request - * response Location header. - * @param scope The ARM Resource ID for subscription, resource group, billing account, or other billing - * scopes. For details, see https://aka.ms/costmgmt/scopes. - * @param operationId The target operation Id. - * @param options The options parameters. - */ - beginGetOperationResultsAndWait( - scope: string, - operationId: string, - options?: GenerateCostDetailsReportGetOperationResultsOptionalParams - ): Promise; -} diff --git a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/generateDetailedCostReport.ts b/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/generateDetailedCostReport.ts deleted file mode 100644 index cfc3973de2ef..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/generateDetailedCostReport.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { - GenerateDetailedCostReportDefinition, - GenerateDetailedCostReportCreateOperationOptionalParams, - GenerateDetailedCostReportCreateOperationResponse -} from "../models/index.js"; - -/** Interface representing a GenerateDetailedCostReport. */ -export interface GenerateDetailedCostReport { - /** - * 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. - * @param scope The ARM Resource ID for subscription, resource group, billing account, or other billing - * scopes. For details, see https://aka.ms/costmgmt/scopes. - * @param parameters Parameters supplied to the Create detailed cost report operation. - * @param options The options parameters. - */ - beginCreateOperation( - scope: string, - parameters: GenerateDetailedCostReportDefinition, - options?: GenerateDetailedCostReportCreateOperationOptionalParams - ): Promise< - SimplePollerLike< - OperationState, - GenerateDetailedCostReportCreateOperationResponse - > - >; - /** - * 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. - * @param scope The ARM Resource ID for subscription, resource group, billing account, or other billing - * scopes. For details, see https://aka.ms/costmgmt/scopes. - * @param parameters Parameters supplied to the Create detailed cost report operation. - * @param options The options parameters. - */ - beginCreateOperationAndWait( - scope: string, - parameters: GenerateDetailedCostReportDefinition, - options?: GenerateDetailedCostReportCreateOperationOptionalParams - ): Promise; -} diff --git a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/generateDetailedCostReportOperationResults.ts b/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/generateDetailedCostReportOperationResults.ts deleted file mode 100644 index 5d95b86042f3..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/generateDetailedCostReportOperationResults.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { - GenerateDetailedCostReportOperationResultsGetOptionalParams, - GenerateDetailedCostReportOperationResultsGetResponse -} from "../models/index.js"; - -/** Interface representing a GenerateDetailedCostReportOperationResults. */ -export interface GenerateDetailedCostReportOperationResults { - /** - * Gets the result of the specified operation. The link with this operationId is provided as a response - * header of the initial request. - * @param operationId The target operation Id. - * @param scope The ARM Resource ID for subscription, resource group, billing account, or other billing - * scopes. For details, see https://aka.ms/costmgmt/scopes. - * @param options The options parameters. - */ - beginGet( - operationId: string, - scope: string, - options?: GenerateDetailedCostReportOperationResultsGetOptionalParams - ): Promise< - SimplePollerLike< - OperationState, - GenerateDetailedCostReportOperationResultsGetResponse - > - >; - /** - * Gets the result of the specified operation. The link with this operationId is provided as a response - * header of the initial request. - * @param operationId The target operation Id. - * @param scope The ARM Resource ID for subscription, resource group, billing account, or other billing - * scopes. For details, see https://aka.ms/costmgmt/scopes. - * @param options The options parameters. - */ - beginGetAndWait( - operationId: string, - scope: string, - options?: GenerateDetailedCostReportOperationResultsGetOptionalParams - ): Promise; -} diff --git a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/generateDetailedCostReportOperationStatus.ts b/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/generateDetailedCostReportOperationStatus.ts deleted file mode 100644 index 28d74057b885..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/generateDetailedCostReportOperationStatus.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { - GenerateDetailedCostReportOperationStatusGetOptionalParams, - GenerateDetailedCostReportOperationStatusGetResponse -} from "../models/index.js"; - -/** Interface representing a GenerateDetailedCostReportOperationStatus. */ -export interface GenerateDetailedCostReportOperationStatus { - /** - * Get the status of the specified operation. This link is provided in the GenerateDetailedCostReport - * creation request response header. - * @param operationId The target operation Id. - * @param scope The ARM Resource ID for subscription, resource group, billing account, or other billing - * scopes. For details, see https://aka.ms/costmgmt/scopes. - * @param options The options parameters. - */ - get( - operationId: string, - scope: string, - options?: GenerateDetailedCostReportOperationStatusGetOptionalParams - ): Promise; -} diff --git a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/generateReservationDetailsReport.ts b/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/generateReservationDetailsReport.ts deleted file mode 100644 index 7423fe054f46..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/generateReservationDetailsReport.ts +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { - GenerateReservationDetailsReportByBillingAccountIdOptionalParams, - GenerateReservationDetailsReportByBillingAccountIdResponse, - GenerateReservationDetailsReportByBillingProfileIdOptionalParams, - GenerateReservationDetailsReportByBillingProfileIdResponse -} from "../models/index.js"; - -/** Interface representing a GenerateReservationDetailsReport. */ -export interface GenerateReservationDetailsReport { - /** - * 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/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role - * @param billingAccountId Enrollment ID (Legacy BillingAccount ID) - * @param startDate Start Date - * @param endDate End Date - * @param options The options parameters. - */ - beginByBillingAccountId( - billingAccountId: string, - startDate: string, - endDate: string, - options?: GenerateReservationDetailsReportByBillingAccountIdOptionalParams - ): Promise< - SimplePollerLike< - OperationState< - GenerateReservationDetailsReportByBillingAccountIdResponse - >, - GenerateReservationDetailsReportByBillingAccountIdResponse - > - >; - /** - * 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/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role - * @param billingAccountId Enrollment ID (Legacy BillingAccount ID) - * @param startDate Start Date - * @param endDate End Date - * @param options The options parameters. - */ - beginByBillingAccountIdAndWait( - billingAccountId: string, - startDate: string, - endDate: string, - options?: GenerateReservationDetailsReportByBillingAccountIdOptionalParams - ): Promise; - /** - * 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/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access - * @param billingAccountId Billing account ID - * @param billingProfileId Billing profile ID. - * @param startDate Start Date - * @param endDate End Date - * @param options The options parameters. - */ - beginByBillingProfileId( - billingAccountId: string, - billingProfileId: string, - startDate: string, - endDate: string, - options?: GenerateReservationDetailsReportByBillingProfileIdOptionalParams - ): Promise< - SimplePollerLike< - OperationState< - GenerateReservationDetailsReportByBillingProfileIdResponse - >, - GenerateReservationDetailsReportByBillingProfileIdResponse - > - >; - /** - * 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/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access - * @param billingAccountId Billing account ID - * @param billingProfileId Billing profile ID. - * @param startDate Start Date - * @param endDate End Date - * @param options The options parameters. - */ - beginByBillingProfileIdAndWait( - billingAccountId: string, - billingProfileId: string, - startDate: string, - endDate: string, - options?: GenerateReservationDetailsReportByBillingProfileIdOptionalParams - ): Promise; -} diff --git a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/index.ts b/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/index.ts deleted file mode 100644 index c448e99f0693..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/index.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export * from "./operations.js"; -export * from "./views.js"; -export * from "./alerts.js"; -export * from "./forecast.js"; -export * from "./dimensions.js"; -export * from "./query.js"; -export * from "./generateReservationDetailsReport.js"; -export * from "./exports.js"; -export * from "./generateCostDetailsReport.js"; -export * from "./generateDetailedCostReport.js"; -export * from "./generateDetailedCostReportOperationResults.js"; -export * from "./generateDetailedCostReportOperationStatus.js"; -export * from "./priceSheet.js"; -export * from "./scheduledActions.js"; -export * from "./benefitRecommendations.js"; -export * from "./benefitUtilizationSummaries.js"; diff --git a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/operations.ts b/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/operations.ts deleted file mode 100644 index 7808104a71fe..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/operations.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { - CostManagementOperation, - OperationsListOptionalParams -} from "../models/index.js"; - -/// -/** Interface representing a Operations. */ -export interface Operations { - /** - * Lists all of the available cost management REST API operations. - * @param options The options parameters. - */ - list( - options?: OperationsListOptionalParams - ): PagedAsyncIterableIterator; -} diff --git a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/priceSheet.ts b/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/priceSheet.ts deleted file mode 100644 index 0eb5d616612a..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/priceSheet.ts +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { - PriceSheetDownloadOptionalParams, - PriceSheetDownloadResponse, - PriceSheetDownloadByBillingProfileOptionalParams, - PriceSheetDownloadByBillingProfileResponse -} from "../models/index.js"; - -/** Interface representing a PriceSheet. */ -export interface PriceSheet { - /** - * 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. - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param invoiceName The ID that uniquely identifies an invoice. - * @param options The options parameters. - */ - beginDownload( - billingAccountName: string, - billingProfileName: string, - invoiceName: string, - options?: PriceSheetDownloadOptionalParams - ): Promise< - SimplePollerLike< - OperationState, - PriceSheetDownloadResponse - > - >; - /** - * 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. - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param invoiceName The ID that uniquely identifies an invoice. - * @param options The options parameters. - */ - beginDownloadAndWait( - billingAccountName: string, - billingProfileName: string, - invoiceName: string, - options?: PriceSheetDownloadOptionalParams - ): Promise; - /** - * 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. - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param options The options parameters. - */ - beginDownloadByBillingProfile( - billingAccountName: string, - billingProfileName: string, - options?: PriceSheetDownloadByBillingProfileOptionalParams - ): Promise< - SimplePollerLike< - OperationState, - PriceSheetDownloadByBillingProfileResponse - > - >; - /** - * 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. - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param options The options parameters. - */ - beginDownloadByBillingProfileAndWait( - billingAccountName: string, - billingProfileName: string, - options?: PriceSheetDownloadByBillingProfileOptionalParams - ): Promise; -} diff --git a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/query.ts b/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/query.ts deleted file mode 100644 index 6b163e9b7627..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/query.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { - QueryDefinition, - QueryUsageOptionalParams, - QueryUsageResponse, - ExternalCloudProviderType, - QueryUsageByExternalCloudProviderTypeOptionalParams, - QueryUsageByExternalCloudProviderTypeResponse -} from "../models/index.js"; - -/** Interface representing a Query. */ -export interface Query { - /** - * Query the usage data for scope defined. - * @param 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. - * @param parameters Parameters supplied to the CreateOrUpdate Query Config operation. - * @param options The options parameters. - */ - usage( - scope: string, - parameters: QueryDefinition, - options?: QueryUsageOptionalParams - ): Promise; - /** - * Query the usage data for external cloud provider type defined. - * @param externalCloudProviderType The external cloud provider type associated with dimension/query - * operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' - * for consolidated account. - * @param externalCloudProviderId This can be '{externalSubscriptionId}' for linked account or - * '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - * @param parameters Parameters supplied to the CreateOrUpdate Query Config operation. - * @param options The options parameters. - */ - usageByExternalCloudProviderType( - externalCloudProviderType: ExternalCloudProviderType, - externalCloudProviderId: string, - parameters: QueryDefinition, - options?: QueryUsageByExternalCloudProviderTypeOptionalParams - ): Promise; -} diff --git a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/scheduledActions.ts b/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/scheduledActions.ts deleted file mode 100644 index 2680a72fd9d6..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/scheduledActions.ts +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { - ScheduledAction, - ScheduledActionsListOptionalParams, - ScheduledActionsListByScopeOptionalParams, - ScheduledActionsCreateOrUpdateOptionalParams, - ScheduledActionsCreateOrUpdateResponse, - ScheduledActionsGetOptionalParams, - ScheduledActionsGetResponse, - ScheduledActionsDeleteOptionalParams, - ScheduledActionsCreateOrUpdateByScopeOptionalParams, - ScheduledActionsCreateOrUpdateByScopeResponse, - ScheduledActionsGetByScopeOptionalParams, - ScheduledActionsGetByScopeResponse, - ScheduledActionsDeleteByScopeOptionalParams, - ScheduledActionsRunOptionalParams, - ScheduledActionsRunByScopeOptionalParams, - CheckNameAvailabilityRequest, - ScheduledActionsCheckNameAvailabilityOptionalParams, - ScheduledActionsCheckNameAvailabilityResponse, - ScheduledActionsCheckNameAvailabilityByScopeOptionalParams, - ScheduledActionsCheckNameAvailabilityByScopeResponse -} from "../models/index.js"; - -/// -/** Interface representing a ScheduledActions. */ -export interface ScheduledActions { - /** - * List all private scheduled actions. - * @param options The options parameters. - */ - list( - options?: ScheduledActionsListOptionalParams - ): PagedAsyncIterableIterator; - /** - * List all shared scheduled actions within the given scope. - * @param 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. - * @param options The options parameters. - */ - listByScope( - scope: string, - options?: ScheduledActionsListByScopeOptionalParams - ): PagedAsyncIterableIterator; - /** - * Create or update a private scheduled action. - * @param name Scheduled action name. - * @param scheduledAction Scheduled action to be created or updated. - * @param options The options parameters. - */ - createOrUpdate( - name: string, - scheduledAction: ScheduledAction, - options?: ScheduledActionsCreateOrUpdateOptionalParams - ): Promise; - /** - * Get the private scheduled action by name. - * @param name Scheduled action name. - * @param options The options parameters. - */ - get( - name: string, - options?: ScheduledActionsGetOptionalParams - ): Promise; - /** - * Delete a private scheduled action. - * @param name Scheduled action name. - * @param options The options parameters. - */ - delete( - name: string, - options?: ScheduledActionsDeleteOptionalParams - ): Promise; - /** - * Create or update a shared scheduled action within the given scope. - * @param 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. - * @param name Scheduled action name. - * @param scheduledAction Scheduled action to be created or updated. - * @param options The options parameters. - */ - createOrUpdateByScope( - scope: string, - name: string, - scheduledAction: ScheduledAction, - options?: ScheduledActionsCreateOrUpdateByScopeOptionalParams - ): Promise; - /** - * Get the shared scheduled action from the given scope by name. - * @param 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. - * @param name Scheduled action name. - * @param options The options parameters. - */ - getByScope( - scope: string, - name: string, - options?: ScheduledActionsGetByScopeOptionalParams - ): Promise; - /** - * Delete a scheduled action within the given scope. - * @param 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. - * @param name Scheduled action name. - * @param options The options parameters. - */ - deleteByScope( - scope: string, - name: string, - options?: ScheduledActionsDeleteByScopeOptionalParams - ): Promise; - /** - * Processes a private scheduled action. - * @param name Scheduled action name. - * @param options The options parameters. - */ - run(name: string, options?: ScheduledActionsRunOptionalParams): Promise; - /** - * Runs a shared scheduled action within the given scope. - * @param 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. - * @param name Scheduled action name. - * @param options The options parameters. - */ - runByScope( - scope: string, - name: string, - options?: ScheduledActionsRunByScopeOptionalParams - ): Promise; - /** - * Checks availability and correctness of the name for a scheduled action. - * @param checkNameAvailabilityRequest Scheduled action to be created or updated. - * @param options The options parameters. - */ - checkNameAvailability( - checkNameAvailabilityRequest: CheckNameAvailabilityRequest, - options?: ScheduledActionsCheckNameAvailabilityOptionalParams - ): Promise; - /** - * Checks availability and correctness of the name for a scheduled action within the given scope. - * @param 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. - * @param checkNameAvailabilityRequest Scheduled action to be created or updated. - * @param options The options parameters. - */ - checkNameAvailabilityByScope( - scope: string, - checkNameAvailabilityRequest: CheckNameAvailabilityRequest, - options?: ScheduledActionsCheckNameAvailabilityByScopeOptionalParams - ): Promise; -} diff --git a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/views.ts b/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/views.ts deleted file mode 100644 index db6f7f0fa28f..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/operationsInterfaces/views.ts +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { - View, - ViewsListOptionalParams, - ViewsListByScopeOptionalParams, - ViewsGetOptionalParams, - ViewsGetResponse, - ViewsCreateOrUpdateOptionalParams, - ViewsCreateOrUpdateResponse, - ViewsDeleteOptionalParams, - ViewsGetByScopeOptionalParams, - ViewsGetByScopeResponse, - ViewsCreateOrUpdateByScopeOptionalParams, - ViewsCreateOrUpdateByScopeResponse, - ViewsDeleteByScopeOptionalParams -} from "../models/index.js"; - -/// -/** Interface representing a Views. */ -export interface Views { - /** - * Lists all views by tenant and object. - * @param options The options parameters. - */ - list(options?: ViewsListOptionalParams): PagedAsyncIterableIterator; - /** - * Lists all views at the given scope. - * @param 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. - * @param options The options parameters. - */ - listByScope( - scope: string, - options?: ViewsListByScopeOptionalParams - ): PagedAsyncIterableIterator; - /** - * Gets the view by view name. - * @param viewName View name - * @param options The options parameters. - */ - get( - viewName: string, - options?: ViewsGetOptionalParams - ): Promise; - /** - * 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. - * @param viewName View name - * @param parameters Parameters supplied to the CreateOrUpdate View operation. - * @param options The options parameters. - */ - createOrUpdate( - viewName: string, - parameters: View, - options?: ViewsCreateOrUpdateOptionalParams - ): Promise; - /** - * The operation to delete a view. - * @param viewName View name - * @param options The options parameters. - */ - delete(viewName: string, options?: ViewsDeleteOptionalParams): Promise; - /** - * Gets the view for the defined scope by view name. - * @param 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. - * @param viewName View name - * @param options The options parameters. - */ - getByScope( - scope: string, - viewName: string, - options?: ViewsGetByScopeOptionalParams - ): Promise; - /** - * 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. - * @param 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. - * @param viewName View name - * @param parameters Parameters supplied to the CreateOrUpdate View operation. - * @param options The options parameters. - */ - createOrUpdateByScope( - scope: string, - viewName: string, - parameters: View, - options?: ViewsCreateOrUpdateByScopeOptionalParams - ): Promise; - /** - * The operation to delete a view. - * @param 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. - * @param viewName View name - * @param options The options parameters. - */ - deleteByScope( - scope: string, - viewName: string, - options?: ViewsDeleteByScopeOptionalParams - ): Promise; -} diff --git a/sdk/cost-management/arm-costmanagement/src/pagingHelper.ts b/sdk/cost-management/arm-costmanagement/src/pagingHelper.ts deleted file mode 100644 index 269a2b9814b5..000000000000 --- a/sdk/cost-management/arm-costmanagement/src/pagingHelper.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export interface PageInfo { - continuationToken?: string; -} - -const pageMap = new WeakMap(); - -/** - * Given the last `.value` produced by the `byPage` iterator, - * returns a continuation token that can be used to begin paging from - * that point later. - * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. - * @returns The continuation token that can be passed into byPage() during future calls. - */ -export function getContinuationToken(page: unknown): string | undefined { - if (typeof page !== "object" || page === null) { - return undefined; - } - return pageMap.get(page)?.continuationToken; -} - -export function setContinuationToken( - page: unknown, - continuationToken: string | undefined -): void { - if (typeof page !== "object" || page === null || !continuationToken) { - return; - } - const pageInfo = pageMap.get(page) ?? {}; - pageInfo.continuationToken = continuationToken; - pageMap.set(page, pageInfo); -} diff --git a/sdk/cost-management/arm-costmanagement/src/restorePollerHelpers.ts b/sdk/cost-management/arm-costmanagement/src/restorePollerHelpers.ts new file mode 100644 index 000000000000..8dc77d2191b2 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/restorePollerHelpers.ts @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CostManagementClient } from "./costManagementClient.js"; +import { + _downloadByBillingAccountDeserialize, + _downloadByBillingProfileDeserialize, + _downloadByInvoiceDeserialize, +} from "./api/priceSheet/operations.js"; +import { + _byBillingProfileIdDeserialize, + _byBillingAccountIdDeserialize, +} from "./api/generateReservationDetailsReport/operations.js"; +import { _createOperationDeserialize } from "./api/generateDetailedCostReport/operations.js"; +import { + _generateBySavingsPlanIdDeserialize, + _generateBySavingsPlanOrderIdDeserialize, + _generateByReservationIdDeserialize, + _generateByReservationOrderIdDeserialize, + _generateByBillingProfileDeserialize, + _generateByBillingAccountDeserialize, +} from "./api/generateBenefitUtilizationSummariesReport/operations.js"; +import { + _createOperationDeserialize as _createOperationDeserializeGenerateCostDetailsReport, + _getOperationResultsDeserialize, +} from "./api/generateCostDetailsReport/operations.js"; +import { _getDeserialize } from "./api/generateDetailedCostReportOperationResults/operations.js"; +import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js"; +import type { OperationOptions, PathUncheckedResponse } from "@azure-rest/core-client"; +import type { AbortSignalLike } from "@azure/abort-controller"; +import type { PollerLike, OperationState, ResourceLocationConfig } from "@azure/core-lro"; +import { deserializeState } from "@azure/core-lro"; + +export interface RestorePollerOptions< + TResult, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +> extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** Deserialization function for raw response body */ + processResponseBody?: (result: TResponse) => Promise; +} + +/** + * Creates a poller from the serialized state of another poller. This can be + * useful when you want to create pollers on a different host or a poller + * needs to be constructed after the original one is not in scope. + */ +export function restorePoller( + client: CostManagementClient, + serializedState: string, + sourceOperation: (...args: any[]) => PollerLike, TResult>, + options?: RestorePollerOptions, +): PollerLike, TResult> { + const pollerConfig = deserializeState(serializedState).config; + const { initialRequestUrl, requestMethod, metadata } = pollerConfig; + if (!initialRequestUrl || !requestMethod) { + throw new Error( + `Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`, + ); + } + const resourceLocationConfig = metadata?.["resourceLocationConfig"] as + | ResourceLocationConfig + | undefined; + const { deserializer, expectedStatuses = [] } = + getDeserializationHelper(initialRequestUrl, requestMethod) ?? {}; + const deserializeHelper = options?.processResponseBody ?? deserializer; + if (!deserializeHelper) { + throw new Error( + `Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`, + ); + } + const apiVersion = getApiVersionFromUrl(initialRequestUrl); + return getLongRunningPoller( + (client as any)["_client"] ?? client, + deserializeHelper as (result: TResponse) => Promise, + expectedStatuses, + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + resourceLocationConfig, + restoreFrom: serializedState, + initialRequestUrl, + apiVersion, + }, + ); +} + +interface DeserializationHelper { + deserializer: (result: PathUncheckedResponse) => Promise; + expectedStatuses: string[]; +} + +const deserializeMap: Record = { + "POST /providers/microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.CostManagement/pricesheets/default/download": + { deserializer: _downloadByBillingAccountDeserialize, expectedStatuses: ["200", "202", "201"] }, + "POST /providers/microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download": + { deserializer: _downloadByBillingProfileDeserialize, expectedStatuses: ["200", "202", "201"] }, + "POST /providers/microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download": + { deserializer: _downloadByInvoiceDeserialize, expectedStatuses: ["200", "202", "201"] }, + "POST /providers/microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport": + { deserializer: _byBillingProfileIdDeserialize, expectedStatuses: ["200", "202", "201"] }, + "POST /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport": + { deserializer: _byBillingAccountIdDeserialize, expectedStatuses: ["200", "202", "201"] }, + "POST /{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport": { + deserializer: _createOperationDeserialize, + expectedStatuses: ["200", "202", "201"], + }, + "POST /providers/microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport": + { deserializer: _generateBySavingsPlanIdDeserialize, expectedStatuses: ["200", "202", "201"] }, + "POST /providers/microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport": + { + deserializer: _generateBySavingsPlanOrderIdDeserialize, + expectedStatuses: ["200", "202", "201"], + }, + "POST /providers/microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport": + { deserializer: _generateByReservationIdDeserialize, expectedStatuses: ["200", "202", "201"] }, + "POST /providers/microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport": + { + deserializer: _generateByReservationOrderIdDeserialize, + expectedStatuses: ["200", "202", "201"], + }, + "POST /providers/microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport": + { deserializer: _generateByBillingProfileDeserialize, expectedStatuses: ["200", "202", "201"] }, + "POST /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport": + { deserializer: _generateByBillingAccountDeserialize, expectedStatuses: ["200", "202", "201"] }, + "POST /{scope}/providers/Microsoft.CostManagement/generateCostDetailsReport": { + deserializer: _createOperationDeserializeGenerateCostDetailsReport, + expectedStatuses: ["200", "202", "204", "201"], + }, + "GET /{scope}/providers/Microsoft.CostManagement/costDetailsOperationResults/{operationId}": { + deserializer: _getOperationResultsDeserialize, + expectedStatuses: ["200", "202"], + }, + "GET /{scope}/providers/Microsoft.CostManagement/operationResults/{operationId}": { + deserializer: _getDeserialize, + expectedStatuses: ["200", "202"], + }, +}; + +function getDeserializationHelper( + urlStr: string, + method: string, +): DeserializationHelper | undefined { + const path = new URL(urlStr).pathname; + const pathParts = path.split("/"); + + // Traverse list to match the longest candidate + // matchedLen: the length of candidate path + // matchedValue: the matched status code array + let matchedLen = -1, + matchedValue: DeserializationHelper | undefined; + + // Iterate the responseMap to find a match + for (const [key, value] of Object.entries(deserializeMap)) { + // Extracting the path from the map key which is in format + // GET /path/foo + if (!key.startsWith(method)) { + continue; + } + const candidatePath = getPathFromMapKey(key); + // Get each part of the url path + const candidateParts = candidatePath.split("/"); + + // track if we have found a match to return the values found. + let found = true; + for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) { + if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) { + const start = candidateParts[i]!.indexOf("}") + 1, + end = candidateParts[i]?.length; + // If the current part of the candidate is a "template" part + // Try to use the suffix of pattern to match the path + // {guid} ==> $ + // {guid}:export ==> :export$ + const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test( + pathParts[j] || "", + ); + + if (!isMatched) { + found = false; + break; + } + continue; + } + + // If the candidate part is not a template and + // the parts don't match mark the candidate as not found + // to move on with the next candidate path. + if (candidateParts[i] !== pathParts[j]) { + found = false; + break; + } + } + + // We finished evaluating the current candidate parts + // Update the matched value if and only if we found the longer pattern + if (found && candidatePath.length > matchedLen) { + matchedLen = candidatePath.length; + matchedValue = value; + } + } + + return matchedValue; +} + +function getPathFromMapKey(mapKey: string): string { + const pathStart = mapKey.indexOf("/"); + return mapKey.slice(pathStart); +} + +function getApiVersionFromUrl(urlStr: string): string | undefined { + const url = new URL(urlStr); + return url.searchParams.get("api-version") ?? undefined; +} diff --git a/sdk/cost-management/arm-costmanagement/src/static-helpers/cloudSettingHelpers.ts b/sdk/cost-management/arm-costmanagement/src/static-helpers/cloudSettingHelpers.ts new file mode 100644 index 000000000000..613112c6e397 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/static-helpers/cloudSettingHelpers.ts @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * An enum to describe Azure Cloud environments. + * @enum {string} + */ +export enum AzureClouds { + /** Azure public cloud, which is the default cloud for Azure SDKs. */ + AZURE_PUBLIC_CLOUD = "AZURE_PUBLIC_CLOUD", + /** Azure China cloud */ + AZURE_CHINA_CLOUD = "AZURE_CHINA_CLOUD", + /** Azure US government cloud */ + AZURE_US_GOVERNMENT = "AZURE_US_GOVERNMENT", +} + +/** The supported values for cloud setting as a string literal type */ +export type AzureSupportedClouds = `${AzureClouds}`; + +/** + * Gets the Azure Resource Manager endpoint URL for the specified cloud setting. + * @param cloudSetting - The Azure cloud environment setting. Use one of the AzureClouds enum values. + * @returns The ARM endpoint URL for the specified cloud, or undefined if cloudSetting is undefined. + * @throws {Error} Throws an error if an unknown cloud setting is provided. + */ +export function getArmEndpoint(cloudSetting?: AzureSupportedClouds): string | undefined { + if (cloudSetting === undefined) { + return undefined; + } + const cloudEndpoints: Record = { + AZURE_CHINA_CLOUD: "https://management.chinacloudapi.cn/", + AZURE_US_GOVERNMENT: "https://management.usgovcloudapi.net/", + AZURE_PUBLIC_CLOUD: "https://management.azure.com/", + }; + if (cloudSetting in cloudEndpoints) { + return cloudEndpoints[cloudSetting]; + } else { + throw new Error( + `Unknown cloud setting: ${cloudSetting}. Please refer to the enum AzureClouds for possible values.`, + ); + } +} diff --git a/sdk/cost-management/arm-costmanagement/src/static-helpers/pagingHelpers.ts b/sdk/cost-management/arm-costmanagement/src/static-helpers/pagingHelpers.ts new file mode 100644 index 000000000000..4b0ff077dafd --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/static-helpers/pagingHelpers.ts @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError } from "@azure-rest/core-client"; +import { RestError } from "@azure/core-rest-pipeline"; + +/** + * Options for the byPage method + */ +export interface PageSettings { + /** + * A reference to a specific page to start iterating from. + */ + continuationToken?: string; +} + +/** + * An interface that describes a page of results. + */ +export type ContinuablePage = TPage & { + /** + * The token that keeps track of where to continue the iterator + */ + continuationToken?: string; +}; + +/** + * An interface that allows async iterable iteration both to completion and by page. + */ +export interface PagedAsyncIterableIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + /** + * Return an AsyncIterableIterator that works a page at a time + */ + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; +} + +/** + * An interface that describes how to communicate with the service. + */ +export interface PagedResult< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * Link to the first page of results. + */ + firstPageLink?: string; + /** + * A method that returns a page of results. + */ + getPage: (pageLink?: string) => Promise<{ page: TPage; nextPageLink?: string } | undefined>; + /** + * a function to implement the `byPage` method on the paged async iterator. + */ + byPage?: (settings?: TPageSettings) => AsyncIterableIterator>; + + /** + * A function to extract elements from a page. + */ + toElements?: (page: TPage) => TElement[]; +} + +/** + * Options for the paging helper + */ +export interface BuildPagedAsyncIteratorOptions { + itemName?: string; + nextLinkName?: string; + nextLinkMethod?: "GET" | "POST"; + apiVersion?: string; +} + +/** + * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator + */ +export function buildPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +>( + client: Client, + getInitialResponse: () => PromiseLike, + processResponseBody: (result: TResponse) => PromiseLike, + expectedStatuses: string[], + options: BuildPagedAsyncIteratorOptions = {}, +): PagedAsyncIterableIterator { + const itemName = options.itemName ?? "value"; + const nextLinkName = options.nextLinkName ?? "nextLink"; + const nextLinkMethod = options.nextLinkMethod ?? "GET"; + const apiVersion = options.apiVersion; + const pagedResult: PagedResult = { + getPage: async (pageLink?: string) => { + let result; + if (pageLink === undefined) { + result = await getInitialResponse(); + } else { + const resolvedPageLink = apiVersion ? addApiVersionToUrl(pageLink, apiVersion) : pageLink; + result = + nextLinkMethod === "POST" + ? await client.pathUnchecked(resolvedPageLink).post() + : await client.pathUnchecked(resolvedPageLink).get(); + } + checkPagingRequest(result, expectedStatuses); + const results = await processResponseBody(result as TResponse); + const nextLink = getNextLink(results, nextLinkName); + const values = getElements(results, itemName) as TPage; + return { + page: values, + nextPageLink: nextLink, + }; + }, + byPage: (settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }, + }; + return getPagedAsyncIterator(pagedResult); +} + +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ + +function getPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +>( + pagedResult: PagedResult, +): PagedAsyncIterableIterator { + const iter = getItemAsyncIterator(pagedResult); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: + pagedResult?.byPage ?? + ((settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }), + }; +} + +async function* getItemAsyncIterator( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + for await (const page of pages) { + yield* page as unknown as TElement[]; + } +} + +async function* getPageAsyncIterator( + pagedResult: PagedResult, + options: { + pageLink?: string; + } = {}, +): AsyncIterableIterator> { + const { pageLink } = options; + let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink); + if (!response) { + return; + } + let result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink); + if (!response) { + return; + } + result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + } +} + +/** + * Gets for the value of nextLink in the body + */ +function getNextLink(body: unknown, nextLinkName?: string): string | undefined { + if (!nextLinkName) { + return undefined; + } + + const nextLink = (body as Record)[nextLinkName]; + + if (typeof nextLink !== "string" && typeof nextLink !== "undefined" && nextLink !== null) { + throw new RestError( + `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`, + ); + } + + if (nextLink === null) { + return undefined; + } + + return nextLink; +} + +/** + * Gets the elements of the current request in the body. + */ +function getElements(body: unknown, itemName: string): T[] { + const value = (body as Record)[itemName] as T[]; + if (!Array.isArray(value)) { + throw new RestError( + `Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`, + ); + } + + return value ?? []; +} + +/** + * Checks if a request failed + */ +function checkPagingRequest(response: PathUncheckedResponse, expectedStatuses: string[]): void { + if (!expectedStatuses.includes(response.status)) { + throw createRestError( + `Pagination failed with unexpected statusCode ${response.status}`, + response, + ); + } +} + +/** + * Adds the api-version query parameter on a URL if it's not present. + * @param url - the URL to modify + * @param apiVersion - the API version to set + * @returns - the URL with the api-version query parameter set + */ +function addApiVersionToUrl(url: string, apiVersion: string): string { + // The base URL is only used for parsing and won't appear in the returned URL + const urlObj = new URL(url, "https://microsoft.com"); + if (!urlObj.searchParams.get("api-version")) { + // Append one if there is no apiVersion + return `${url}${urlObj.search ? "&" : "?"}api-version=${apiVersion}`; + } + return url; +} diff --git a/sdk/cost-management/arm-costmanagement/src/static-helpers/pollingHelpers.ts b/sdk/cost-management/arm-costmanagement/src/static-helpers/pollingHelpers.ts new file mode 100644 index 000000000000..05306f6ec10c --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/static-helpers/pollingHelpers.ts @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { + OperationResponse, + OperationState, + PollerLike, + ResourceLocationConfig, + RunningOperation, +} from "@azure/core-lro"; +import { createHttpPoller } from "@azure/core-lro"; + +import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError } from "@azure-rest/core-client"; +import type { AbortSignalLike } from "@azure/abort-controller"; + +export interface GetLongRunningPollerOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** + * The potential location of the result of the LRO if specified by the LRO extension in the swagger. + */ + resourceLocationConfig?: ResourceLocationConfig; + /** + * The original url of the LRO + * Should not be null when restoreFrom is set + */ + initialRequestUrl?: string; + /** + * A serialized poller which can be used to resume an existing paused Long-Running-Operation. + */ + restoreFrom?: string; + /** + * The function to get the initial response + */ + getInitialResponse?: () => PromiseLike; + /** + * The api-version of the LRO + */ + apiVersion?: string; +} +export function getLongRunningPoller( + client: Client, + processResponseBody: (result: TResponse) => Promise, + expectedStatuses: string[], + options: GetLongRunningPollerOptions, +): PollerLike, TResult> { + const { restoreFrom, getInitialResponse, apiVersion } = options; + if (!restoreFrom && !getInitialResponse) { + throw new Error("Either restoreFrom or getInitialResponse must be specified"); + } + let initialResponse: TResponse | undefined = undefined; + const pollAbortController = new AbortController(); + const poller: RunningOperation = { + sendInitialRequest: async () => { + if (!getInitialResponse) { + throw new Error("getInitialResponse is required when initializing a new poller"); + } + initialResponse = await getInitialResponse(); + return getLroResponse(initialResponse, expectedStatuses); + }, + sendPollRequest: async ( + path: string, + pollOptions?: { + abortSignal?: AbortSignalLike; + }, + ) => { + // The poll request would both listen to the user provided abort signal and the poller's own abort signal + function abortListener(): void { + pollAbortController.abort(); + } + const abortSignal = pollAbortController.signal; + if (options.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (pollOptions?.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (!abortSignal.aborted) { + options.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + pollOptions?.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + } + let response; + try { + const pollingPath = apiVersion ? addApiVersionToUrl(path, apiVersion) : path; + response = await client.pathUnchecked(pollingPath).get({ abortSignal }); + } finally { + options.abortSignal?.removeEventListener("abort", abortListener); + pollOptions?.abortSignal?.removeEventListener("abort", abortListener); + } + + return getLroResponse(response as TResponse, expectedStatuses); + }, + }; + return createHttpPoller(poller, { + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: options?.resourceLocationConfig, + restoreFrom: options?.restoreFrom, + processResult: (result: unknown) => { + return processResponseBody(result as TResponse); + }, + }); +} +/** + * Converts a Rest Client response to a response that the LRO implementation understands + * @param response - a rest client http response + * @param deserializeFn - deserialize function to convert Rest response to modular output + * @returns - An LRO response that the LRO implementation understands + */ +function getLroResponse( + response: TResponse, + expectedStatuses: string[], +): OperationResponse { + if (!expectedStatuses.includes(response.status)) { + throw createRestError(response); + } + + return { + flatResponse: response, + rawResponse: { + ...response, + statusCode: Number.parseInt(response.status), + body: response.body, + }, + }; +} + +/** + * Adds the api-version query parameter on a URL if it's not present. + * @param url - the URL to modify + * @param apiVersion - the API version to set + * @returns - the URL with the api-version query parameter set + */ +function addApiVersionToUrl(url: string, apiVersion: string): string { + // The base URL is only used for parsing and won't appear in the returned URL + const urlObj = new URL(url, "https://microsoft.com"); + if (!urlObj.searchParams.get("api-version")) { + // Append one if there is no apiVersion + return `${url}${urlObj.search ? "&" : "?"}api-version=${apiVersion}`; + } + return url; +} diff --git a/sdk/cost-management/arm-costmanagement/src/static-helpers/serialization/check-prop-undefined.ts b/sdk/cost-management/arm-costmanagement/src/static-helpers/serialization/check-prop-undefined.ts new file mode 100644 index 000000000000..50f78829e491 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/static-helpers/serialization/check-prop-undefined.ts @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * Returns true if all specified properties of the item are undefined. + * @param item The object to check. + * @param properties The list of property names to check on the item. + * @returns True if all specified properties are undefined, otherwise false. + */ +export function areAllPropsUndefined(item: Record, properties: string[]): boolean { + for (const property of properties) { + if (item[property] !== undefined) { + return false; + } + } + return true; +} diff --git a/sdk/cost-management/arm-costmanagement/src/static-helpers/urlTemplate.ts b/sdk/cost-management/arm-costmanagement/src/static-helpers/urlTemplate.ts new file mode 100644 index 000000000000..e8af8cd3ab73 --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/src/static-helpers/urlTemplate.ts @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +// --------------------- +// interfaces +// --------------------- +interface ValueOptions { + isFirst: boolean; // is first value in the expression + op?: string; // operator + varValue?: any; // variable value + varName?: string; // variable name + modifier?: string; // modifier e.g * + reserved?: boolean; // if true we'll keep reserved words with not encoding +} + +export interface UrlTemplateOptions { + // if set to true, reserved characters will not be encoded + allowReserved?: boolean; +} + +// --------------------- +// helpers +// --------------------- +function encodeComponent(val: string, reserved?: boolean, op?: string): string { + return (reserved ?? op === "+") || op === "#" + ? encodeReservedComponent(val) + : encodeRFC3986URIComponent(val); +} + +function encodeReservedComponent(str: string): string { + return str + .split(/(%[0-9A-Fa-f]{2})/g) + .map((part) => (!/%[0-9A-Fa-f]/.test(part) ? encodeURI(part) : part)) + .join(""); +} + +function encodeRFC3986URIComponent(str: string): string { + return encodeURIComponent(str).replace( + /[!'()*]/g, + (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`, + ); +} + +function isDefined(val: any): boolean { + return val !== undefined && val !== null; +} + +function getNamedAndIfEmpty(op?: string): [boolean, string] { + return [!!op && [";", "?", "&"].includes(op), !!op && ["?", "&"].includes(op) ? "=" : ""]; +} + +function getFirstOrSep(op?: string, isFirst = false): string { + if (isFirst) { + return !op || op === "+" ? "" : op; + } else if (!op || op === "+" || op === "#") { + return ","; + } else if (op === "?") { + return "&"; + } else { + return op; + } +} + +function getExpandedValue(option: ValueOptions): string { + let isFirst = option.isFirst; + const { op, varName, varValue: value, reserved } = option; + const vals: string[] = []; + const [named, ifEmpty] = getNamedAndIfEmpty(op); + + if (Array.isArray(value)) { + for (const val of value.filter(isDefined)) { + // prepare the following parts: separator, varName, value + vals.push(`${getFirstOrSep(op, isFirst)}`); + if (named && varName) { + vals.push(`${encodeURIComponent(varName)}`); + if (val === "") { + vals.push(ifEmpty); + } else { + vals.push("="); + } + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } else if (typeof value === "object") { + for (const key of Object.keys(value)) { + const val = value[key]; + if (!isDefined(val)) { + continue; + } + // prepare the following parts: separator, key, value + vals.push(`${getFirstOrSep(op, isFirst)}`); + if (key) { + vals.push(`${encodeURIComponent(key)}`); + if (named && val === "") { + vals.push(ifEmpty); + } else { + vals.push("="); + } + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } + return vals.join(""); +} + +function getNonExpandedValue(option: ValueOptions): string | undefined { + const { op, varName, varValue: value, isFirst, reserved } = option; + const vals: string[] = []; + const first = getFirstOrSep(op, isFirst); + const [named, ifEmpty] = getNamedAndIfEmpty(op); + if (named && varName) { + vals.push(encodeComponent(varName, reserved, op)); + if (value === "") { + if (!ifEmpty) { + vals.push(ifEmpty); + } + return !vals.join("") ? undefined : `${first}${vals.join("")}`; + } + vals.push("="); + } + + const items = []; + if (Array.isArray(value)) { + for (const val of value.filter(isDefined)) { + items.push(encodeComponent(val, reserved, op)); + } + } else if (typeof value === "object") { + for (const key of Object.keys(value)) { + if (!isDefined(value[key])) { + continue; + } + items.push(encodeRFC3986URIComponent(key)); + items.push(encodeComponent(value[key], reserved, op)); + } + } + vals.push(items.join(",")); + return !vals.join(",") ? undefined : `${first}${vals.join("")}`; +} + +function getVarValue(option: ValueOptions): string | undefined { + const { op, varName, modifier, isFirst, reserved, varValue: value } = option; + + if (!isDefined(value)) { + return undefined; + } else if (["string", "number", "boolean"].includes(typeof value)) { + let val = value.toString(); + const [named, ifEmpty] = getNamedAndIfEmpty(op); + const vals: string[] = [getFirstOrSep(op, isFirst)]; + if (named && varName) { + // No need to encode varName considering it is already encoded + vals.push(varName); + if (val === "") { + vals.push(ifEmpty); + } else { + vals.push("="); + } + } + if (modifier && modifier !== "*") { + val = val.substring(0, parseInt(modifier, 10)); + } + vals.push(encodeComponent(val, reserved, op)); + return vals.join(""); + } else if (modifier === "*") { + return getExpandedValue(option); + } else { + return getNonExpandedValue(option); + } +} + +// --------------------------------------------------------------------------------------------------- +// This is an implementation of RFC 6570 URI Template: https://datatracker.ietf.org/doc/html/rfc6570. +// --------------------------------------------------------------------------------------------------- +export function expandUrlTemplate( + template: string, + context: Record, + option?: UrlTemplateOptions, +): string { + const result = template.replace(/\{([^{}]+)\}|([^{}]+)/g, (_, expr, text) => { + if (!expr) { + return encodeReservedComponent(text); + } + let op; + if (["+", "#", ".", "/", ";", "?", "&"].includes(expr[0])) { + op = expr[0]; + expr = expr.slice(1); + } + const varList = expr.split(/,/g); + const innerResult = []; + for (const varSpec of varList) { + const varMatch = /([^:*]*)(?::(\d+)|(\*))?/.exec(varSpec); + if (!varMatch || !varMatch[1]) { + continue; + } + const varValue = getVarValue({ + isFirst: innerResult.length === 0, + op, + varValue: context[varMatch[1]], + varName: varMatch[1], + modifier: varMatch[2] || varMatch[3], + reserved: option?.allowReserved, + }); + if (varValue) { + innerResult.push(varValue); + } + } + return innerResult.join(""); + }); + + return normalizeUnreserved(result); +} + +/** + * Normalize an expanded URI by decoding percent-encoded unreserved characters. + * RFC 3986 unreserved: "-" / "." / "~" + */ +function normalizeUnreserved(uri: string): string { + return uri.replace(/%([0-9A-Fa-f]{2})/g, (match, hex) => { + const char = String.fromCharCode(parseInt(hex, 16)); + // Decode only if it's unreserved + if (/[.~-]/.test(char)) { + return char; + } + return match; // leave other encodings intact + }); +} diff --git a/sdk/cost-management/arm-costmanagement/tsconfig.json b/sdk/cost-management/arm-costmanagement/tsconfig.json index 4f50981fb333..d0a44aae0734 100644 --- a/sdk/cost-management/arm-costmanagement/tsconfig.json +++ b/sdk/cost-management/arm-costmanagement/tsconfig.json @@ -4,19 +4,22 @@ "path": "./config/tsconfig.src.esm.json" }, { - "path": "./config/tsconfig.src.cjs.json" + "path": "./config/tsconfig.src.browser.json" }, { - "path": "./config/tsconfig.src.browser.json" + "path": "./config/tsconfig.src.cjs.json" }, { "path": "./config/tsconfig.test.node.json" }, { - "path": "./config/tsconfig.snippets.json" + "path": "./config/tsconfig.test.browser.json" }, { "path": "./config/tsconfig.samples.json" + }, + { + "path": "./config/tsconfig.snippets.json" } ], "files": [] diff --git a/sdk/cost-management/arm-costmanagement/tsp-location.yaml b/sdk/cost-management/arm-costmanagement/tsp-location.yaml new file mode 100644 index 000000000000..11618d6b4cde --- /dev/null +++ b/sdk/cost-management/arm-costmanagement/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement +commit: 4375d0c4eb36e73152199e484c0d4537ddd4c9da +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/cost-management/arm-costmanagement/vitest.config.ts b/sdk/cost-management/arm-costmanagement/vitest.config.ts index cc5cd85d4131..0dfa15cc4498 100644 --- a/sdk/cost-management/arm-costmanagement/vitest.config.ts +++ b/sdk/cost-management/arm-costmanagement/vitest.config.ts @@ -1,4 +1,3 @@ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. diff --git a/sdk/cost-management/arm-costmanagement/warp.config.yml b/sdk/cost-management/arm-costmanagement/warp.config.yml index 326e6c0415c8..d350c71a91b1 100644 --- a/sdk/cost-management/arm-costmanagement/warp.config.yml +++ b/sdk/cost-management/arm-costmanagement/warp.config.yml @@ -1,5 +1,30 @@ +# warp.config.yml — build configuration -extends: ../../../warp.base.config.yml +exports: + "./package.json": "./package.json" + ".": "./src/index.ts" + "./api": "./src/api/index.ts" + "./api/priceSheet": "./src/api/priceSheet/index.ts" + "./api/generateReservationDetailsReport": "./src/api/generateReservationDetailsReport/index.ts" + "./api/query": "./src/api/query/index.ts" + "./api/dimensions": "./src/api/dimensions/index.ts" + "./api/forecast": "./src/api/forecast/index.ts" + "./api/generateDetailedCostReport": "./src/api/generateDetailedCostReport/index.ts" + "./api/generateBenefitUtilizationSummariesReport": "./src/api/generateBenefitUtilizationSummariesReport/index.ts" + "./api/benefitUtilizationSummaries": "./src/api/benefitUtilizationSummaries/index.ts" + "./api/benefitRecommendations": "./src/api/benefitRecommendations/index.ts" + "./api/costAllocationRules": "./src/api/costAllocationRules/index.ts" + "./api/generateCostDetailsReport": "./src/api/generateCostDetailsReport/index.ts" + "./api/settings": "./src/api/settings/index.ts" + "./api/scheduledActions": "./src/api/scheduledActions/index.ts" + "./api/alerts": "./src/api/alerts/index.ts" + "./api/views": "./src/api/views/index.ts" + "./api/generateDetailedCostReportOperationResults": "./src/api/generateDetailedCostReportOperationResults/index.ts" + "./api/exports": "./src/api/exports/index.ts" + "./api/budgets": "./src/api/budgets/index.ts" + "./api/operations": "./src/api/operations/index.ts" + "./api/generateDetailedCostReportOperationStatus": "./src/api/generateDetailedCostReportOperationStatus/index.ts" + "./models": "./src/models/index.ts" targets: - name: browser diff --git a/sdk/cost-management/ci.mgmt.yml b/sdk/cost-management/ci.mgmt.yml index 973c627453e5..95ad5cc0b461 100644 --- a/sdk/cost-management/ci.mgmt.yml +++ b/sdk/cost-management/ci.mgmt.yml @@ -1,5 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: @@ -13,7 +13,6 @@ trigger: include: - sdk/cost-management/arm-costmanagement - sdk/cost-management/ci.mgmt.yml - pr: branches: include: @@ -27,7 +26,6 @@ pr: include: - sdk/cost-management/arm-costmanagement - sdk/cost-management/ci.mgmt.yml - extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: @@ -35,4 +33,3 @@ extends: Artifacts: - name: azure-arm-costmanagement safeName: azurearmcostmanagement - \ No newline at end of file