Listy przestrzeni nazw metryki dla zasobu.
GET https://management.azure.com/{resourceUri}/providers/microsoft.insights/metricNamespaces?api-version=2017-12-01-preview
Z parametrami opcjonalnymi:
GET https://management.azure.com/{resourceUri}/providers/microsoft.insights/metricNamespaces?api-version=2017-12-01-preview&startTime={startTime}
Parametry identyfikatora URI
Nazwa |
W |
Wymagane |
Typ |
Opis |
resourceUri
|
path |
True
|
string
|
Identyfikator zasobu.
|
api-version
|
query |
True
|
string
|
Wersja interfejsu API do użycia dla tej operacji.
|
startTime
|
query |
|
string
|
Wartość ISO 8601 jest zgodna z godziną rozpoczęcia daty, z której ma być wysyłane zapytanie o przestrzenie nazw metryk.
|
Odpowiedzi
Nazwa |
Typ |
Opis |
200 OK
|
MetricNamespaceCollection
|
Pomyślne żądanie pobrania listy przestrzeni nazw metryk
|
Other Status Codes
|
ErrorResponse
|
Odpowiedź na błąd opisująca, dlaczego operacja nie powiodła się.
|
Zabezpieczenia
azure_auth
Przepływ OAuth2 usługi Azure Active Directory
Typ:
oauth2
Flow:
implicit
Adres URL autoryzacji:
https://login.microsoftonline.com/common/oauth2/authorize
Zakresy
Nazwa |
Opis |
user_impersonation
|
personifikacja konta użytkownika
|
Przykłady
Get Metric Namespaces without filter
Przykładowe żądanie
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
from azure.identity import DefaultAzureCredential
from azure.mgmt.monitor import MonitorManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-monitor
# USAGE
python get_metric_namespaces.py
Before run the sample, please 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 info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = MonitorManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.metric_namespaces.list(
resource_uri="subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill",
)
for item in response:
print(item)
# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2017-12-01-preview/examples/GetMetricNamespaces.json
if __name__ == "__main__":
main()
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
Przykładowa odpowiedź
{
"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"
}
}
]
}
Definicje
ErrorResponse
Opisuje format odpowiedzi Błąd.
Nazwa |
Typ |
Opis |
code
|
string
|
Kod błędu
|
message
|
string
|
Komunikat o błędzie wskazujący, dlaczego operacja nie powiodła się.
|
MetricNamespace
Klasa przestrzeni nazw metryki określa metadane dla przestrzeni nazw metryki.
Nazwa |
Typ |
Opis |
classification
|
NamespaceClassification
|
Rodzaj przestrzeni nazw
|
id
|
string
|
Identyfikator przestrzeni nazw metryki.
|
name
|
string
|
Nazwa przestrzeni nazw, w ramach których została uniknięta.
|
properties
|
MetricNamespaceName
|
Właściwości zawierające w pełni kwalifikowaną nazwę przestrzeni nazw.
|
type
|
string
|
Typ przestrzeni nazw.
|
MetricNamespaceCollection
Reprezentuje kolekcję przestrzeni nazw metryk.
MetricNamespaceName
W pełni kwalifikowana nazwa przestrzeni nazw metryki.
Nazwa |
Typ |
Opis |
metricNamespaceName
|
string
|
Nazwa przestrzeni nazw metryki.
|
NamespaceClassification
Rodzaj przestrzeni nazw
Nazwa |
Typ |
Opis |
Custom
|
string
|
|
Platform
|
string
|
|
Qos
|
string
|
|