你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Scheduled Query Rules - Delete
删除日志搜索规则
DELETE https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}?api-version=2018-04-16
URI 参数
名称 |
在 |
必需 |
类型 |
说明 |
resourceGroupName
|
path |
True
|
string
|
资源组的名称。 此名称不区分大小写。
|
ruleName
|
path |
True
|
string
|
规则的名称。
|
subscriptionId
|
path |
True
|
string
|
目标订阅的 ID。
|
api-version
|
query |
True
|
string
|
要用于此操作的 API 版本。
|
响应
名称 |
类型 |
说明 |
200 OK
|
|
已成功请求删除日志搜索规则
|
204 No Content
|
|
无内容。 找不到资源
|
Other Status Codes
|
ErrorContract
|
描述操作失败原因的错误响应。
|
安全性
azure_auth
Azure Active Directory OAuth2 流
类型:
oauth2
流向:
implicit
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize
作用域
名称 |
说明 |
user_impersonation
|
模拟用户帐户
|
示例
Delete rule
示例请求
DELETE https://management.azure.com/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourcegroups/Rac46PostSwapRG/providers/Microsoft.Insights/scheduledQueryRules/logalertfoo?api-version=2018-04-16
import com.azure.core.util.Context;
/** Samples for ScheduledQueryRules Delete. */
public final class Main {
/*
* x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/deleteScheduledQueryRules.json
*/
/**
* Sample code: Delete rule.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void deleteRule(com.azure.resourcemanager.AzureResourceManager azure) {
azure
.diagnosticSettings()
.manager()
.serviceClient()
.getScheduledQueryRules()
.deleteWithResponse("Rac46PostSwapRG", "logalertfoo", 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/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/deleteScheduledQueryRules.json
func ExampleScheduledQueryRulesClient_Delete() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client, err := armmonitor.NewScheduledQueryRulesClient("b67f7fec-69fc-4974-9099-a26bd6ffeda3", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
_, err = client.Delete(ctx,
"Rac46PostSwapRG",
"logalertfoo",
nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
}
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 Deletes a Log Search rule
*
* @summary Deletes a Log Search rule
* x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/deleteScheduledQueryRules.json
*/
async function deleteRule() {
const subscriptionId =
process.env["MONITOR_SUBSCRIPTION_ID"] || "b67f7fec-69fc-4974-9099-a26bd6ffeda3";
const resourceGroupName = process.env["MONITOR_RESOURCE_GROUP"] || "Rac46PostSwapRG";
const ruleName = "logalertfoo";
const credential = new DefaultAzureCredential();
const client = new MonitorClient(credential, subscriptionId);
const result = await client.scheduledQueryRules.delete(resourceGroupName, ruleName);
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
定义
ErrorContract
描述错误响应的格式。
ErrorResponse
描述错误响应的格式。
名称 |
类型 |
说明 |
code
|
string
|
错误代码
|
message
|
string
|
指示操作失败原因的错误消息。
|