清單 資源的計量命名空間。
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 參數
名稱 |
位於 |
必要 |
類型 |
Description |
resourceUri
|
path |
True
|
string
|
資源的標識碼。
|
api-version
|
query |
True
|
string
|
用於此作業的 API 版本。
|
startTime
|
query |
|
string
|
ISO 8601 符合要從中查詢計量命名空間的日期開始時間。
|
回應
安全性
azure_auth
Azure Active Directory OAuth2 Flow
類型:
oauth2
Flow:
implicit
授權 URL:
https://login.microsoftonline.com/common/oauth2/authorize
範圍
名稱 |
Description |
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
描述錯誤回應的格式。
名稱 |
類型 |
Description |
code
|
string
|
錯誤碼
|
message
|
string
|
指出作業失敗原因的錯誤訊息。
|
MetricNamespace
計量命名空間類別會指定計量命名空間的元數據。
MetricNamespaceCollection
表示計量命名空間的集合。
MetricNamespaceName
完整計量命名空間名稱。
名稱 |
類型 |
Description |
metricNamespaceName
|
string
|
計量命名空間名稱。
|
NamespaceClassification
命名空間種類
名稱 |
類型 |
Description |
Custom
|
string
|
|
Platform
|
string
|
|
Qos
|
string
|
|