你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Views - Get By Scope

按视图名称获取已定义范围的视图。

GET https://management.azure.com/{scope}/providers/Microsoft.CostManagement/views/{viewName}?api-version=2023-11-01

URI 参数

名称 必需 类型 说明
scope
path True

string

与视图操作关联的范围。 这包括订阅范围的“subscriptions/{subscriptionId}” “subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}”表示 resourceGroup 范围,“providers/Microsoft.Billing/billingAccounts/{billingAccountId}”表示计费帐户范围,“providers/Microsoft.Billing/billingAccounts/{billingAccounts/{billingAccounts/{billingAccounts/{departmentId}”表示部门范围,“providers/Microsoft.Billing/billingAccountId}/enrollmentAccounts/{enrollmentAccountId}“表示 EnrollmentAccount 范围,”providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}“表示 BillingProfile 范围, ”providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}“表示 InvoiceSection 范围,”providers/Microsoft.Management/managementGroups/{managementGroupId}“表示管理组范围,”providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}“表示外部计费帐户范围,”providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}“表示外部订阅范围。

viewName
path True

string

视图名称

api-version
query True

string

要用于此操作的 API 版本。

响应

名称 类型 说明
200 OK

View

没问题。 请求已成功。

Other Status Codes

ErrorResponse

描述操作失败原因的错误响应。

安全性

azure_auth

Azure Active Directory OAuth2 流。

类型: oauth2
流向: implicit
授权 URL: https://login.microsoftonline.com/common/oauth2/authorize

作用域

名称 说明
user_impersonation 模拟用户帐户

示例

ResourceGroupView

示例请求

GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/views/swaggerExample?api-version=2023-11-01

示例响应

{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/views/swaggerExample",
  "name": "swaggerExample",
  "type": "Microsoft.CostManagement/Views",
  "eTag": "\"1d4ff9fe66f1d10\"",
  "properties": {
    "displayName": "swagger Example",
    "scope": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG",
    "query": {
      "type": "Usage",
      "timeframe": "MonthToDate",
      "dataSet": {
        "granularity": "Daily",
        "aggregation": {
          "totalCost": {
            "name": "PreTaxCost",
            "function": "Sum"
          }
        },
        "grouping": [],
        "sorting": [
          {
            "direction": "Ascending",
            "name": "UsageDate"
          }
        ]
      }
    },
    "chart": "Table",
    "accumulated": "true",
    "metric": "ActualCost",
    "kpis": [
      {
        "type": "Forecast",
        "id": null,
        "enabled": true
      },
      {
        "type": "Budget",
        "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo",
        "enabled": true
      }
    ],
    "pivots": [
      {
        "type": "Dimension",
        "name": "ServiceName"
      },
      {
        "type": "Dimension",
        "name": "MeterCategory"
      },
      {
        "type": "TagKey",
        "name": "swaggerTagKey"
      }
    ]
  }
}

定义

名称 说明
AccumulatedType

显示一段时间内累计的成本。

ChartType

成本分析中main视图的图表类型。 必需。

ErrorDetails

错误的详细信息。

ErrorResponse

错误响应指示服务无法处理传入请求。 错误消息中提供了原因。

某些错误响应:

  • 429 TooManyRequests - 请求受到限制。 等待“x-ms-ratelimit-microsoft.consumption-retry-after”标头中指定的时间后重试。

  • 503 ServiceUnavailable - 服务暂时不可用。 等待“Retry-After”标头中指定的时间后重试。

FunctionType

要使用的聚合函数的名称。

KpiProperties

每个 KPI 必须包含“type”和“enabled”密钥。

KpiTypeType

KPI 类型 (预测、预算) 。

MetricType

显示成本时要使用的指标。

OperatorType

用于比较的运算符。

PivotProperties

每个透视必须包含“type”和“name”。

PivotTypeType

在视图中显示的数据类型。

QueryColumnType

导出中列的类型。

ReportConfigAggregation

要用于报表的聚合表达式。

ReportConfigComparisonExpression

要用于报表的比较表达式。

ReportConfigDataset

报表中存在的数据的定义。

ReportConfigDatasetConfiguration

报表中数据集的配置。

ReportConfigFilter

要用于报表的筛选表达式。

ReportConfigGrouping

报表中使用的分组依据表达式。

ReportConfigSorting

在报表中使用的 order by 表达式。

ReportConfigSortingType

排序方向。

ReportConfigTimePeriod

拉取报表数据的开始和结束日期。

ReportGranularityType

报表中行的粒度。

ReportTimeframeType

为报表拉取数据的时间范围。 如果是自定义的,则必须提供特定的时间段。

ReportType

报表的类型。 使用情况表示实际使用情况,预测表示预测数据,UsageAndForecast 表示使用情况和预测数据。 可以根据日期区分实际使用情况和预测数据。

View

成本分析的状态和配置。

AccumulatedType

显示一段时间内累计的成本。

名称 类型 说明
false

string

true

string

ChartType

成本分析中main视图的图表类型。 必需。

名称 类型 说明
Area

string

GroupedColumn

string

Line

string

StackedColumn

string

Table

string

ErrorDetails

错误的详细信息。

名称 类型 说明
code

string

错误代码。

message

string

指示操作失败原因的错误消息。

ErrorResponse

错误响应指示服务无法处理传入请求。 错误消息中提供了原因。

某些错误响应:

  • 429 TooManyRequests - 请求受到限制。 等待“x-ms-ratelimit-microsoft.consumption-retry-after”标头中指定的时间后重试。

  • 503 ServiceUnavailable - 服务暂时不可用。 等待“Retry-After”标头中指定的时间后重试。

名称 类型 说明
error

ErrorDetails

错误的详细信息。

FunctionType

要使用的聚合函数的名称。

名称 类型 说明
Sum

string

KpiProperties

每个 KPI 必须包含“type”和“enabled”密钥。

名称 类型 说明
enabled

boolean

在 UI 中显示 KPI?

id

string

与指标 (预算) 相关的资源的 ID。

type

KpiTypeType

KPI 类型 (预测、预算) 。

KpiTypeType

KPI 类型 (预测、预算) 。

名称 类型 说明
Budget

string

Forecast

string

MetricType

显示成本时要使用的指标。

名称 类型 说明
AHUB

string

ActualCost

string

AmortizedCost

string

OperatorType

用于比较的运算符。

名称 类型 说明
Contains

string

In

string

PivotProperties

每个透视必须包含“type”和“name”。

名称 类型 说明
name

string

在视图中显示的数据字段。

type

PivotTypeType

在视图中显示的数据类型。

PivotTypeType

在视图中显示的数据类型。

名称 类型 说明
Dimension

string

TagKey

string

QueryColumnType

导出中列的类型。

名称 类型 说明
Dimension

string

成本数据的维度。

TagKey

string

与成本数据关联的标记。

ReportConfigAggregation

要用于报表的聚合表达式。

名称 类型 说明
function

FunctionType

要使用的聚合函数的名称。

name

string

要聚合的列的名称。

ReportConfigComparisonExpression

要用于报表的比较表达式。

名称 类型 说明
name

string

要用于比较的列的名称。

operator

OperatorType

用于比较的运算符。

values

string[]

要用于比较的值数组

ReportConfigDataset

报表中存在的数据的定义。

名称 类型 说明
aggregation

<string,  ReportConfigAggregation>

在报表中使用的聚合表达式字典。 字典中每个项的键是聚合列的别名。 报表最多可以有 2 个聚合子句。

configuration

ReportConfigDatasetConfiguration

具有报表中数据的配置信息。 如果提供聚合和分组,将忽略配置。

filter

ReportConfigFilter

具有在报表中使用的筛选器表达式。

granularity

ReportGranularityType

报表中行的粒度。

grouping

ReportConfigGrouping[]

在报表中使用的按表达式分组的数组。 报表最多可以有 2 个分组依据子句。

sorting

ReportConfigSorting[]

在报表中使用的按表达式排序的数组。

ReportConfigDatasetConfiguration

报表中数据集的配置。

名称 类型 说明
columns

string[]

要包含在报表中的列名的数组。 允许使用任何有效的报表列名。 如果未提供,则报表将包括所有列。

ReportConfigFilter

要用于报表的筛选表达式。

名称 类型 说明
and

ReportConfigFilter[]

逻辑“AND”表达式。 必须至少有 2 个项。

dimensions

ReportConfigComparisonExpression

具有维度的比较表达式

or

ReportConfigFilter[]

逻辑“OR”表达式。 必须至少有 2 个项。

tags

ReportConfigComparisonExpression

具有标记的比较表达式

ReportConfigGrouping

报表中使用的分组依据表达式。

名称 类型 说明
name

string

要分组的列的名称。 此版本支持订阅尽可能低的粒度。

type

QueryColumnType

具有要分组的列的类型。

ReportConfigSorting

在报表中使用的 order by 表达式。

名称 类型 说明
direction

ReportConfigSortingType

排序方向。

name

string

要排序的列的名称。

ReportConfigSortingType

排序方向。

名称 类型 说明
Ascending

string

Descending

string

ReportConfigTimePeriod

拉取报表数据的开始和结束日期。

名称 类型 说明
from

string

要从中拉取数据的开始日期。

to

string

要将数据拉取到的结束日期。

ReportGranularityType

报表中行的粒度。

名称 类型 说明
Daily

string

Monthly

string

ReportTimeframeType

为报表拉取数据的时间范围。 如果是自定义的,则必须提供特定的时间段。

名称 类型 说明
Custom

string

MonthToDate

string

WeekToDate

string

YearToDate

string

ReportType

报表的类型。 使用情况表示实际使用情况,预测表示预测数据,UsageAndForecast 表示使用情况和预测数据。 可以根据日期区分实际使用情况和预测数据。

名称 类型 说明
Usage

string

View

成本分析的状态和配置。

名称 类型 说明
eTag

string

资源的 eTag。 为了处理并发更新方案,此字段将用于确定用户是否正在更新最新版本。

id

string

资源 ID。

name

string

资源名称。

properties.accumulated

AccumulatedType

显示一段时间内累计的成本。

properties.chart

ChartType

成本分析中main视图的图表类型。 必需。

properties.createdOn

string

用户创建此视图的日期。

properties.currency

string

当前视图的货币。

properties.dateRange

string

当前视图的日期范围。

properties.displayName

string

视图的用户输入名称。 必需。

properties.kpis

KpiProperties[]

要显示在成本分析 UI 中的 KPI 列表。

properties.metric

MetricType

显示成本时要使用的指标。

properties.modifiedOn

string

用户上次修改此视图的日期。

properties.pivots

PivotProperties[]

在成本分析 UI 中配置 3 个子视图。

properties.query.dataSet

ReportConfigDataset

具有此报表配置中数据的定义。

properties.query.includeMonetaryCommitment

boolean

如果为 true,则报表包括货币承诺。

properties.query.timePeriod

ReportConfigTimePeriod

具有为报表拉取数据的时间段。

properties.query.timeframe

ReportTimeframeType

为报表拉取数据的时间范围。 如果是自定义的,则必须提供特定的时间段。

properties.query.type

ReportType

报表的类型。 使用情况表示实际使用情况,预测表示预测数据,UsageAndForecast 表示使用情况和预测数据。 可以根据日期区分实际使用情况和预测数据。

properties.scope

string

要保存视图的成本管理范围。 这包括订阅范围的“subscriptions/{subscriptionId}” “subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}”表示 resourceGroup 范围,“providers/Microsoft.Billing/billingAccounts/{billingAccountId}”表示计费帐户范围,“providers/Microsoft.Billing/billingAccounts/{billingAccounts/{billingAccounts/{billingAccounts/{departmentId}”表示部门范围,“providers/Microsoft.Billing/billingAccountId}/enrollmentAccounts/{enrollmentAccountId}“表示 EnrollmentAccount 范围,”providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}“表示 BillingProfile 范围, ”providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}“表示 InvoiceSection 范围,”providers/Microsoft.Management/managementGroups/{managementGroupId}“表示管理组范围,”/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}“表示 ExternalBillingAccount 范围,”/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}“表示 ExternalSubscription 范围。

type

string

资源类型。