Lists资源的指标命名空间。
GET https://management.azure.com/{resourceUri}/providers/microsoft.insights/metricNamespaces?api-version=2017-12-01-preview
具有可选参数:
GET https://management.azure.com/{resourceUri}/providers/microsoft.insights/metricNamespaces?api-version=2017-12-01-preview&startTime={startTime}
URI 参数
名称 |
在 |
必需 |
类型 |
说明 |
resourceUri
|
path |
True
|
string
|
资源的标识符。
|
api-version
|
query |
True
|
string
|
要用于此操作的 API 版本。
|
startTime
|
query |
|
string
|
ISO 8601 符合查询指标命名空间的日期开始时间。
|
响应
安全性
azure_auth
Azure Active Directory OAuth2 流
类型:
oauth2
流向:
implicit
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize
作用域
名称 |
说明 |
user_impersonation
|
模拟用户帐户
|
示例
Get Metric Namespaces without filter
示例请求
GET https://management.azure.com/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricNamespaces?api-version=2017-12-01-preview&startTime=2020-08-31T15:53:00Z
/**
* Samples for MetricNamespaces List.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/monitor/resource-manager/Microsoft.Insights/preview/2017-12-01-preview/examples/GetMetricNamespaces
* .json
*/
/**
* Sample code: Get Metric Namespaces without filter.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getMetricNamespacesWithoutFilter(com.azure.resourcemanager.AzureResourceManager azure) {
azure.diagnosticSettings().manager().serviceClient().getMetricNamespaces().list(
"subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill",
"2020-08-31T15:53:00Z", com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armmonitor_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2017-12-01-preview/examples/GetMetricNamespaces.json
func ExampleMetricNamespacesClient_NewListPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmonitor.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewMetricNamespacesClient().NewListPager("subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill", &armmonitor.MetricNamespacesClientListOptions{StartTime: to.Ptr("2020-08-31T15:53:00Z")})
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.MetricNamespaceCollection = armmonitor.MetricNamespaceCollection{
// Value: []*armmonitor.MetricNamespace{
// {
// Name: to.Ptr("Azure.ApplicationInsights"),
// Type: to.Ptr("Microsoft.Insights/metricNamespaces"),
// Classification: to.Ptr(armmonitor.NamespaceClassificationCustom),
// ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricNamespaces/Azure.ApplicationInsights"),
// Properties: &armmonitor.MetricNamespaceName{
// MetricNamespaceName: to.Ptr("Azure.ApplicationInsights"),
// },
// },
// {
// Name: to.Ptr("microsoft.insights-components"),
// Type: to.Ptr("Microsoft.Insights/metricNamespaces"),
// Classification: to.Ptr(armmonitor.NamespaceClassificationPlatform),
// ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricNamespaces/microsoft.insights-components"),
// Properties: &armmonitor.MetricNamespaceName{
// MetricNamespaceName: to.Ptr("microsoft.insights/components"),
// },
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { MonitorClient } = require("@azure/arm-monitor");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Lists the metric namespaces for the resource.
*
* @summary Lists the metric namespaces for the resource.
* x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2017-12-01-preview/examples/GetMetricNamespaces.json
*/
async function getMetricNamespacesWithoutFilter() {
const subscriptionId =
process.env["MONITOR_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceUri =
"subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill";
const startTime = "2020-08-31T15:53:00Z";
const options = { startTime };
const credential = new DefaultAzureCredential();
const client = new MonitorClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.metricNamespaces.list(resourceUri, options)) {
resArray.push(item);
}
console.log(resArray);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
示例响应
{
"value": [
{
"id": "/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricNamespaces/Azure.ApplicationInsights",
"name": "Azure.ApplicationInsights",
"type": "Microsoft.Insights/metricNamespaces",
"classification": "Custom",
"properties": {
"metricNamespaceName": "Azure.ApplicationInsights"
}
},
{
"id": "/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricNamespaces/microsoft.insights-components",
"name": "microsoft.insights-components",
"type": "Microsoft.Insights/metricNamespaces",
"classification": "Platform",
"properties": {
"metricNamespaceName": "microsoft.insights/components"
}
}
]
}
定义
ErrorResponse
描述错误响应的格式。
名称 |
类型 |
说明 |
code
|
string
|
错误代码
|
message
|
string
|
指示操作失败原因的错误消息。
|
MetricNamespace
指标命名空间类指定指标命名空间的元数据。
MetricNamespaceCollection
表示指标命名空间的集合。
MetricNamespaceName
完全限定的指标命名空间名称。
名称 |
类型 |
说明 |
metricNamespaceName
|
string
|
指标命名空间名称。
|
NamespaceClassification
命名空间类型
名称 |
类型 |
说明 |
Custom
|
string
|
|
Platform
|
string
|
|
Qos
|
string
|
|