Возвращает весь набор тегов для ресурса или подписки.
GET https://management.azure.com/{scope}/providers/Microsoft.Resources/tags/default?api-version=2021-04-01
Параметры URI
Имя |
В |
Обязательно |
Тип |
Описание |
scope
|
path |
True
|
string
|
Область ресурса.
|
api-version
|
query |
True
|
string
|
Версия API, используемая для данной операции.
|
Ответы
Имя |
Тип |
Описание |
200 OK
|
TagsResource
|
Возвращает теги из указанного объекта.
|
Other Status Codes
|
CloudError
|
Ответ об ошибке, описывающий причину сбоя операции.
|
Безопасность
azure_auth
Поток OAuth2 в Azure Active Directory
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Имя |
Описание |
user_impersonation
|
олицетворения учетной записи пользователя
|
Примеры
Sample Request
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group/providers/myPRNameSpace/VM/myVm/providers/Microsoft.Resources/tags/default?api-version=2021-04-01
package armresources_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4fd842fb73656039ec94ce367bcedee25a57bd18/specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/GetTagsResource.json
func ExampleTagsClient_GetAtScope_getTagsOnAResource() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armresources.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewTagsClient().GetAtScope(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group/providers/myPRNameSpace/VM/myVm", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.TagsResource = armresources.TagsResource{
// Properties: &armresources.Tags{
// Tags: map[string]*string{
// "tagKey1": to.Ptr("tag-value-1"),
// "tagKey2": to.Ptr("tag-value-2"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ResourceManagementClient } = require("@azure/arm-resources");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets the entire set of tags on a resource or subscription.
*
* @summary Gets the entire set of tags on a resource or subscription.
* x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/GetTagsResource.json
*/
async function getTagsOnAResource() {
const subscriptionId =
process.env["RESOURCES_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const scope =
"subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group/providers/myPRNameSpace/VM/myVm";
const credential = new DefaultAzureCredential();
const client = new ResourceManagementClient(credential, subscriptionId);
const result = await client.tagsOperations.getAtScope(scope);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"properties": {
"tags": {
"tagKey1": "tag-value-1",
"tagKey2": "tag-value-2"
}
}
}
Sample Request
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/tags/default?api-version=2021-04-01
package armresources_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4fd842fb73656039ec94ce367bcedee25a57bd18/specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/GetTagsSubscription.json
func ExampleTagsClient_GetAtScope_getTagsOnASubscription() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armresources.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewTagsClient().GetAtScope(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.TagsResource = armresources.TagsResource{
// Properties: &armresources.Tags{
// Tags: map[string]*string{
// "tagKey1": to.Ptr("tag-value-1"),
// "tagKey2": to.Ptr("tag-value-2"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ResourceManagementClient } = require("@azure/arm-resources");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets the entire set of tags on a resource or subscription.
*
* @summary Gets the entire set of tags on a resource or subscription.
* x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/GetTagsSubscription.json
*/
async function getTagsOnASubscription() {
const subscriptionId =
process.env["RESOURCES_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const scope = "subscriptions/00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new ResourceManagementClient(credential, subscriptionId);
const result = await client.tagsOperations.getAtScope(scope);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"properties": {
"tags": {
"tagKey1": "tag-value-1",
"tagKey2": "tag-value-2"
}
}
}
Определения
CloudError
Ответ об ошибке для запроса на управление ресурсами.
Имя |
Тип |
Описание |
error
|
ErrorResponse
|
Сообщение об ошибке
Общие ответы об ошибках для всех API-интерфейсов Azure Resource Manager возвращать сведения об ошибках для неудачных операций. (Это также соответствует формату ответа об ошибке OData.)
|
ErrorAdditionalInfo
Дополнительные сведения об ошибке управления ресурсами.
Имя |
Тип |
Описание |
info
|
object
|
Дополнительные сведения.
|
type
|
string
|
Тип дополнительных сведений.
|
ErrorResponse
Сообщение об ошибке
Имя |
Тип |
Описание |
additionalInfo
|
ErrorAdditionalInfo[]
|
Дополнительные сведения об ошибке.
|
code
|
string
|
Код ошибки.
|
details
|
ErrorResponse[]
|
Сведения об ошибке.
|
message
|
string
|
Сообщение об ошибке.
|
target
|
string
|
Целевой объект ошибки.
|
Словарь пар имен и значений.
Имя |
Тип |
Описание |
tags
|
object
|
|
Ресурс-оболочка для запросов и ответов API тегов.
Имя |
Тип |
Описание |
id
|
string
|
Идентификатор ресурса-оболочки тегов.
|
name
|
string
|
Имя ресурса-оболочки тегов.
|
properties
|
Tags
|
Набор тегов.
|
type
|
string
|
Тип ресурса-оболочки тегов.
|