删除现有命名空间。 此操作还会删除 命名空间下的所有关联资源。
DELETE https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}?api-version=2024-01-01
URI 参数
名称 |
在 |
必需 |
类型 |
说明 |
namespaceName
|
path |
True
|
string
|
命名空间名称
正则表达式模式: ^[a-zA-Z][a-zA-Z0-9-]{6,50}[a-zA-Z0-9]$
|
resourceGroupName
|
path |
True
|
string
|
Azure 订阅中的资源组的名称。
|
subscriptionId
|
path |
True
|
string
|
唯一标识 Microsoft Azure 订阅的订阅凭据。 此订阅 ID 是每个服务调用的 URI 的一部分。
|
api-version
|
query |
True
|
string
|
客户端 API 版本。
|
响应
名称 |
类型 |
说明 |
200 OK
|
|
已成功删除命名空间。
|
202 Accepted
|
|
命名空间删除请求已接受。
|
204 No Content
|
|
无内容。
|
Other Status Codes
|
ErrorResponse
|
描述操作失败原因的 Eventhub 错误响应。
|
安全性
azure_auth
Azure Active Directory OAuth2 流
类型:
oauth2
流向:
implicit
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize
作用域
名称 |
说明 |
user_impersonation
|
模拟用户帐户
|
示例
NameSpaceDelete
示例请求
DELETE https://management.azure.com/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.EventHub/namespaces/NamespaceSample?api-version=2024-01-01
/**
* Samples for Namespaces Delete.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/eventhub/resource-manager/Microsoft.EventHub/stable/2024-01-01/examples/NameSpaces/
* EHNameSpaceDelete.json
*/
/**
* Sample code: NameSpaceDelete.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void nameSpaceDelete(com.azure.resourcemanager.AzureResourceManager azure) {
azure.eventHubs().manager().serviceClient().getNamespaces().delete("ResurceGroupSample", "NamespaceSample",
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.eventhub import EventHubManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-eventhub
# USAGE
python eh_name_space_delete.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 = EventHubManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SampleSubscription",
)
client.namespaces.begin_delete(
resource_group_name="ResurceGroupSample",
namespace_name="NamespaceSample",
).result()
# x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2024-01-01/examples/NameSpaces/EHNameSpaceDelete.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
const { EventHubManagementClient } = require("@azure/arm-eventhub");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Deletes an existing namespace. This operation also removes all associated resources under the namespace.
*
* @summary Deletes an existing namespace. This operation also removes all associated resources under the namespace.
* x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2024-01-01/examples/NameSpaces/EHNameSpaceDelete.json
*/
async function nameSpaceDelete() {
const subscriptionId = process.env["EVENTHUB_SUBSCRIPTION_ID"] || "SampleSubscription";
const resourceGroupName = process.env["EVENTHUB_RESOURCE_GROUP"] || "ResurceGroupSample";
const namespaceName = "NamespaceSample";
const credential = new DefaultAzureCredential();
const client = new EventHubManagementClient(credential, subscriptionId);
const result = await client.namespaces.beginDeleteAndWait(resourceGroupName, namespaceName);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.EventHubs.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.EventHubs;
// Generated from example definition: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2024-01-01/examples/NameSpaces/EHNameSpaceDelete.json
// this example is just showing the usage of "Namespaces_Delete" 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 EventHubsNamespaceResource created on azure
// for more information of creating EventHubsNamespaceResource, please refer to the document of EventHubsNamespaceResource
string subscriptionId = "SampleSubscription";
string resourceGroupName = "ResurceGroupSample";
string namespaceName = "NamespaceSample";
ResourceIdentifier eventHubsNamespaceResourceId = EventHubsNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName);
EventHubsNamespaceResource eventHubsNamespace = client.GetEventHubsNamespaceResource(eventHubsNamespaceResourceId);
// invoke the operation
await eventHubsNamespace.DeleteAsync(WaitUntil.Completed);
Console.WriteLine($"Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
示例响应
azure-asyncoperation: http://azure.async.operation/status
azure-asyncoperation: http://azure.async.operation/status
azure-asyncoperation: http://azure.async.operation/status
定义
ErrorAdditionalInfo
资源管理错误附加信息。
名称 |
类型 |
说明 |
info
|
object
|
其他信息。
|
type
|
string
|
其他信息类型。
|
ErrorDetail
错误详细信息。
ErrorResponse
错误响应指示事件中心服务无法处理传入请求。 错误消息中提供了原因。