sdk/cost-management/arm-costmanagement/samples-dev/dimensionsListSample.ts (358 lines of code) (raw):

/* * 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 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: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountDimensionsList.json */ async function billingAccountDimensionsListLegacy(): Promise<void> { 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)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function billingAccountDimensionsListMca(): Promise<void> { const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); for await (const item of client.dimensions.list(scope)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function billingAccountDimensionsListExpandAndTopLegacy(): Promise<void> { const scope = "providers/Microsoft.Billing/billingAccounts/100"; 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)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function billingAccountDimensionsListExpandAndTopMca(): Promise<void> { const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789"; 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)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function billingAccountDimensionsListWithFilterLegacy(): Promise<void> { 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 }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); for await (const item of client.dimensions.list(scope, options)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function billingAccountDimensionsListWithFilterMca(): Promise<void> { 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 }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); for await (const item of client.dimensions.list(scope, options)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function billingProfileDimensionsListMca(): Promise<void> { const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); for await (const item of client.dimensions.list(scope)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function billingProfileDimensionsListExpandAndTopMca(): Promise<void> { const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; 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)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function billingProfileDimensionsListWithFilterMca(): Promise<void> { 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 }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); for await (const item of client.dimensions.list(scope, options)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function customerDimensionsListMca(): Promise<void> { const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); for await (const item of client.dimensions.list(scope)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function customerDimensionsListExpandAndTopMca(): Promise<void> { const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"; 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)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function customerDimensionsListWithFilterMca(): Promise<void> { 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 }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); for await (const item of client.dimensions.list(scope, options)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function departmentDimensionsListLegacy(): Promise<void> { const scope = "providers/Microsoft.Billing/billingAccounts/100/departments/123"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); for await (const item of client.dimensions.list(scope)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function departmentDimensionsListExpandAndTopLegacy(): Promise<void> { const scope = "providers/Microsoft.Billing/billingAccounts/100/departments/123"; 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)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function departmentDimensionsListWithFilterLegacy(): Promise<void> { 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 }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); for await (const item of client.dimensions.list(scope, options)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function enrollmentAccountDimensionsListLegacy(): Promise<void> { const scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); for await (const item of client.dimensions.list(scope)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function enrollmentAccountDimensionsListExpandAndTopLegacy(): Promise<void> { const scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; 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)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function enrollmentAccountDimensionsListWithFilterLegacy(): Promise<void> { 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 }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); for await (const item of client.dimensions.list(scope, options)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function invoiceSectionDimensionsListMca(): Promise<void> { const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); for await (const item of client.dimensions.list(scope)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function invoiceSectionDimensionsListExpandAndTopMca(): Promise<void> { const scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876"; 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)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function invoiceSectionDimensionsListWithFilterMca(): Promise<void> { 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 }; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const resArray = new Array(); for await (const item of client.dimensions.list(scope, options)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function managementGroupDimensionsListLegacy(): Promise<void> { 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)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function managementGroupDimensionsListExpandAndTopLegacy(): Promise<void> { 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)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function managementGroupDimensionsListWithFilterLegacy(): Promise<void> { 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)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function resourceGroupDimensionsListLegacy(): Promise<void> { 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)) { resArray.push(item); } console.log(resArray); } /** * 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 */ async function subscriptionDimensionsListLegacy(): Promise<void> { 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)) { resArray.push(item); } console.log(resArray); } async function main(): Promise<void> { 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 managementGroupDimensionsListLegacy(); await managementGroupDimensionsListExpandAndTopLegacy(); await managementGroupDimensionsListWithFilterLegacy(); await resourceGroupDimensionsListLegacy(); await subscriptionDimensionsListLegacy(); } main().catch(console.error);