Var olan bir QueryPack'in etiketlerini Güncelleştirmeler. Diğer alanları güncelleştirmek için CreateOrUpdate yöntemini kullanın.
PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/queryPacks/{queryPackName}?api-version=2019-09-01
URI Parametreleri
Name |
İçinde |
Gerekli |
Tür |
Description |
queryPackName
|
path |
True
|
string
|
Log Analytics QueryPack kaynağının adı.
|
resourceGroupName
|
path |
True
|
string
|
Kaynak grubunun adı. Ad büyük/küçük harfe duyarlı değildir.
|
subscriptionId
|
path |
True
|
string
|
Hedef aboneliğin kimliği.
|
api-version
|
query |
True
|
string
|
Bu işlem için kullanılacak API sürümü.
|
İstek Gövdesi
Name |
Tür |
Description |
tags
|
object
|
Kaynak etiketleri
|
Yanıtlar
Name |
Tür |
Description |
200 OK
|
LogAnalyticsQueryPack
|
Log Analytics QueryPack etiketlerini güncelleştirme başarılı oldu. QueryPack etiketleri, QueryPack'in nesne özelliklerinin geri kalanıyla birlikte güncelleştirilir ve döndürülür.
|
Other Status Codes
|
ErrorResponse
|
İşlemin neden başarısız olduğunu açıklayan hata yanıtı.
|
Güvenlik
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
kullanıcı hesabınızın kimliğine bürünme
|
Örnekler
Sample Request
PATCH https://management.azure.com/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.OperationalInsights/queryPacks/my-querypack?api-version=2019-09-01
{
"tags": {
"Tag1": "Value1",
"Tag2": "Value2"
}
}
import com.azure.resourcemanager.loganalytics.models.LogAnalyticsQueryPack;
import java.util.HashMap;
import java.util.Map;
/** Samples for QueryPacks UpdateTags. */
public final class Main {
/*
* x-ms-original-file: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2019-09-01/examples/QueryPacksUpdateTagsOnly.json
*/
/**
* Sample code: QueryPackUpdateTagsOnly.
*
* @param manager Entry point to LogAnalyticsManager.
*/
public static void queryPackUpdateTagsOnly(com.azure.resourcemanager.loganalytics.LogAnalyticsManager manager) {
LogAnalyticsQueryPack resource =
manager
.queryPacks()
.getByResourceGroupWithResponse("my-resource-group", "my-querypack", com.azure.core.util.Context.NONE)
.getValue();
resource.update().withTags(mapOf("Tag1", "Value1", "Tag2", "Value2")).apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armoperationalinsights_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/operationalinsights/armoperationalinsights/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf3574813e15bb33b3cb610f44edfcbebd8b1b23/specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2019-09-01/examples/QueryPacksUpdateTagsOnly.json
func ExampleQueryPacksClient_UpdateTags() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armoperationalinsights.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewQueryPacksClient().UpdateTags(ctx, "my-resource-group", "my-querypack", armoperationalinsights.TagsResource{
Tags: map[string]*string{
"Tag1": to.Ptr("Value1"),
"Tag2": to.Ptr("Value2"),
},
}, 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.LogAnalyticsQueryPack = armoperationalinsights.LogAnalyticsQueryPack{
// Name: to.Ptr("my-querypack"),
// Type: to.Ptr("microsoft.operationalinsights/querypacks"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/microsoft.operationalinsights/queryPacks/my-querypack"),
// Location: to.Ptr("South Central US"),
// Tags: map[string]*string{
// "Tag1": to.Ptr("Value1"),
// "Tag2": to.Ptr("Value2"),
// },
// Properties: &armoperationalinsights.LogAnalyticsQueryPackProperties{
// ProvisioningState: to.Ptr("Succeeded"),
// QueryPackID: to.Ptr("aac8fc00-2b68-441e-8f9b-ded8748dc635"),
// TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-04T12:37:56.8543652Z"); return t}()),
// TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-04T12:37:56.8543652Z"); return t}()),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { OperationalInsightsManagementClient } = require("@azure/arm-operationalinsights");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Updates an existing QueryPack's tags. To update other fields use the CreateOrUpdate method.
*
* @summary Updates an existing QueryPack's tags. To update other fields use the CreateOrUpdate method.
* x-ms-original-file: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2019-09-01/examples/QueryPacksUpdateTagsOnly.json
*/
async function queryPackUpdateTagsOnly() {
const subscriptionId = process.env["OPERATIONALINSIGHTS_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName =
process.env["OPERATIONALINSIGHTS_RESOURCE_GROUP"] || "my-resource-group";
const queryPackName = "my-querypack";
const queryPackTags = {
tags: { tag1: "Value1", tag2: "Value2" },
};
const credential = new DefaultAzureCredential();
const client = new OperationalInsightsManagementClient(credential, subscriptionId);
const result = await client.queryPacks.updateTags(
resourceGroupName,
queryPackName,
queryPackTags
);
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
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.OperationalInsights;
using Azure.ResourceManager.OperationalInsights.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2019-09-01/examples/QueryPacksUpdateTagsOnly.json
// this example is just showing the usage of "QueryPacks_UpdateTags" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this LogAnalyticsQueryPackResource created on azure
// for more information of creating LogAnalyticsQueryPackResource, please refer to the document of LogAnalyticsQueryPackResource
string subscriptionId = "subid";
string resourceGroupName = "my-resource-group";
string queryPackName = "my-querypack";
ResourceIdentifier logAnalyticsQueryPackResourceId = LogAnalyticsQueryPackResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, queryPackName);
LogAnalyticsQueryPackResource logAnalyticsQueryPack = client.GetLogAnalyticsQueryPackResource(logAnalyticsQueryPackResourceId);
// invoke the operation
LogAnalyticsQueryPackPatch patch = new LogAnalyticsQueryPackPatch()
{
Tags =
{
["Tag1"] = "Value1",
["Tag2"] = "Value2",
},
};
LogAnalyticsQueryPackResource result = await logAnalyticsQueryPack.UpdateAsync(patch);
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
LogAnalyticsQueryPackData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
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
{
"id": "/subscriptions/subid/resourceGroups/my-resource-group/providers/microsoft.operationalinsights/queryPacks/my-querypack",
"name": "my-querypack",
"type": "microsoft.operationalinsights/querypacks",
"location": "South Central US",
"tags": {
"Tag1": "Value1",
"Tag2": "Value2"
},
"properties": {
"queryPackId": "aac8fc00-2b68-441e-8f9b-ded8748dc635",
"timeCreated": "2019-06-04T12:37:56.8543652Z",
"timeModified": "2019-08-04T12:37:56.8543652Z",
"provisioningState": "Succeeded"
}
}
Tanımlar
ErrorAdditionalInfo
Kaynak yönetimi hatası ek bilgileri.
Name |
Tür |
Description |
info
|
object
|
Ek bilgiler.
|
type
|
string
|
Ek bilgi türü.
|
ErrorDetail
Hata ayrıntısı.
Name |
Tür |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
Hata ek bilgileri.
|
code
|
string
|
Hata kodu.
|
details
|
ErrorDetail[]
|
Hata ayrıntıları.
|
message
|
string
|
Hata iletisi.
|
target
|
string
|
Hata hedefi.
|
ErrorResponse
Hata yanıtı
LogAnalyticsQueryPack
Log Analytics QueryPack tanımı.
Name |
Tür |
Description |
id
|
string
|
Azure kaynak kimliği
|
location
|
string
|
Kaynak konumu
|
name
|
string
|
Azure kaynak adı
|
properties.provisioningState
|
string
|
Bu QueryPack'in geçerli durumu: tanımlandığı kaynak grubu içinde sağlanıp sağlanmadığı. Kullanıcılar bu değeri değiştiremez ancak bu değerden okuyabilir. Değerler Başarılı, Dağıtıldı, İptal Edildi ve Başarısız değerlerini içerir.
|
properties.queryPackId
|
string
|
Uygulamanızın benzersiz kimliği. Bu alan değiştirilemez.
|
properties.timeCreated
|
string
|
Log Analytics QueryPack için ISO 8601 biçiminde oluşturma tarihi.
|
properties.timeModified
|
string
|
Log Analytics QueryPack'in ISO 8601 biçimindeki son değiştirme tarihi.
|
tags
|
object
|
Kaynak etiketleri
|
type
|
string
|
Azure kaynak türü
|
Kullanıcının QueryPack örneğindeki etiketleri güncelleştirmesine olanak sağlayan, yalnızca bir kaynağın Etiketlerini tutan kapsayıcı.
Name |
Tür |
Description |
tags
|
object
|
Kaynak etiketleri
|