你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Event Hubs - Create Or Update
将新的事件中心创建或更新为命名空间中的嵌套资源。
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}?api-version=2024-01-01
URI 参数
名称 | 在 | 必需 | 类型 | 说明 |
---|---|---|---|---|
event
|
path | True |
string minLength: 1maxLength: 256 |
事件中心名称 |
namespace
|
path | True |
string minLength: 6maxLength: 50 pattern: ^[a-zA-Z][a-zA-Z0-9-]{6,50}[a-zA-Z0-9]$ |
Namespace名称 |
resource
|
path | True |
string minLength: 1maxLength: 90 |
Azure 订阅中的资源组的名称。 |
subscription
|
path | True |
string |
唯一标识Microsoft Azure 订阅的订阅凭据。 订阅 ID 构成了每个服务调用的 URI 的一部分。 |
api-version
|
query | True |
string |
客户端 API 版本。 |
请求正文
名称 | 类型 | 说明 |
---|---|---|
properties.captureDescription |
捕获说明的属性 |
|
properties.messageRetentionInDays |
integer (int64) minimum: 1 |
保留此事件中心的事件的天数,值应为 1 到 7 天 |
properties.partitionCount |
integer (int64) minimum: 1 |
为事件中心创建的分区数,允许的值从 1 到 32 个分区。 |
properties.retentionDescription |
事件中心保留设置 |
|
properties.status |
枚举事件中心状态的可能值。 |
|
properties.userMetadata |
string |
获取和设置用户的元数据。 |
响应
名称 | 类型 | 说明 |
---|---|---|
200 OK |
已成功创建事件中心。 |
|
Other Status Codes |
事件中心错误响应,描述作失败的原因。 |
安全性
azure_auth
Azure Active Directory OAuth2 Flow
类型:
oauth2
流向:
implicit
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize
作用域
名称 | 说明 |
---|---|
user_impersonation | 模拟用户帐户 |
示例
EventHubCreate
示例请求
PUT https://management.azure.com/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/Default-NotificationHubs-AustraliaEast/providers/Microsoft.EventHub/namespaces/sdk-Namespace-5357/eventhubs/sdk-EventHub-6547?api-version=2024-01-01
{
"properties": {
"messageRetentionInDays": 4,
"partitionCount": 4,
"status": "Active",
"userMetadata": "key",
"captureDescription": {
"enabled": true,
"encoding": "Avro",
"destination": {
"name": "EventHubArchive.AzureBlockBlob",
"properties": {
"storageAccountResourceId": "/subscriptions/e2f361f0-3b27-4503-a9cc-21cfba380093/resourceGroups/Default-Storage-SouthCentralUS/providers/Microsoft.ClassicStorage/storageAccounts/arjunteststorage",
"blobContainer": "container",
"archiveNameFormat": "{Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}"
},
"identity": {
"type": "UserAssigned",
"userAssignedIdentity": "/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud2"
}
},
"intervalInSeconds": 120,
"sizeLimitInBytes": 10485763
},
"retentionDescription": {
"cleanupPolicy": "Compact",
"retentionTimeInHours": 96,
"tombstoneRetentionTimeInHours": 1
}
}
}
示例响应
{
"id": "/subscriptions/e2f361f0-3b27-4503-a9cc-21cfba380093/resourceGroups/Default-NotificationHubs-AustraliaEast/providers/Microsoft.EventHub/namespaces/sdk-Namespace-716/eventhubs/sdk-EventHub-10",
"name": "sdk-EventHub-10",
"type": "Microsoft.EventHub/Namespaces/EventHubs",
"properties": {
"messageRetentionInDays": 4,
"partitionCount": 4,
"status": "Active",
"userMetadata": "key",
"createdAt": "2017-06-28T02:45:55.877Z",
"updatedAt": "2017-06-28T02:46:05.877Z",
"partitionIds": [
"0",
"1",
"2",
"3"
],
"captureDescription": {
"enabled": true,
"encoding": "Avro",
"destination": {
"name": "EventHubArchive.AzureBlockBlob",
"properties": {
"storageAccountResourceId": "/subscriptions/e2f361f0-3b27-4503-a9cc-21cfba380093/resourceGroups/Default-Storage-SouthCentralUS/providers/Microsoft.ClassicStorage/storageAccounts/arjunteststorage",
"blobContainer": "container",
"archiveNameFormat": "{Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}"
},
"identity": {
"type": "UserAssigned",
"userAssignedIdentity": "/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud2"
}
},
"intervalInSeconds": 120,
"sizeLimitInBytes": 10485763
},
"retentionDescription": {
"cleanupPolicy": "Compact",
"retentionTimeInHours": 96,
"tombstoneRetentionTimeInHours": 1
}
}
}
定义
名称 | 说明 |
---|---|
Capture |
配置事件中心捕获说明的属性 |
Capture |
一个值,该值指示是否启用捕获说明。 |
Capture |
Azure Active Directory 托管标识的类型。 |
Cleanup |
枚举清理策略的可能值 |
created |
创建资源的标识的类型。 |
Destination |
捕获存储详细信息以获取捕获说明 |
Encoding |
枚举捕获说明的编码格式的可能值。 注意:新 API 版本中将弃用“AvroDeflate” |
Entity |
枚举事件中心状态的可能值。 |
Error |
资源管理错误附加信息。 |
Error |
错误详细信息。 |
Error |
错误响应指示事件中心服务无法处理传入请求。 错误消息中提供了原因。 |
Eventhub |
列表或获取事件中心操作中的单个项 |
Retention |
配置事件中心保留设置的属性 |
system |
与创建和上次修改资源相关的元数据。 |
CaptureDescription
配置事件中心捕获说明的属性
名称 | 类型 | 说明 |
---|---|---|
destination |
将存储捕获的目标的属性。 (存储帐户、Blob 名称) |
|
enabled |
boolean |
一个值,该值指示是否启用捕获说明。 |
encoding |
枚举捕获说明的编码格式的可能值。 注意:新 API 版本中将弃用“AvroDeflate” |
|
intervalInSeconds |
integer (int32) |
使用时间范围可以设置捕获到 Azure Blob 的频率,值应介于 60 到 900 秒之间 |
sizeLimitInBytes |
integer (int32) |
大小窗口定义在捕获作之前在事件中心生成的数据量,值应在10485760到524288000字节之间 |
skipEmptyArchives |
boolean |
一个值,该值指示是否跳过空存档 |
CaptureIdentity
一个值,该值指示是否启用捕获说明。
名称 | 类型 | 说明 |
---|---|---|
type |
Azure Active Directory 托管标识的类型。 |
|
userAssignedIdentity |
string |
托管用户标识的 ARM ID。 此属性是必需的,类型为 UserAssignedIdentity。 如果类型为 SystemAssigned,则将使用与命名空间关联的系统分配标识。 |
CaptureIdentityType
Azure Active Directory 托管标识的类型。
值 | 说明 |
---|---|
SystemAssigned | |
UserAssigned |
CleanupPolicyRetentionDescription
枚举清理策略的可能值
值 | 说明 |
---|---|
Compact | |
Delete |
createdByType
创建资源的标识的类型。
值 | 说明 |
---|---|
Application | |
Key | |
ManagedIdentity | |
User |
Destination
捕获存储详细信息以获取捕获说明
名称 | 类型 | 说明 |
---|---|---|
identity |
一个值,该值指示是否启用捕获说明。 |
|
name |
string |
捕获目标的名称 |
properties.archiveNameFormat |
string |
存档的 Blob 命名约定,例如 {Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}。 此处的所有参数(Namespace,EventHub .. 等)都是强制性的,无论顺序如何 |
properties.blobContainer |
string |
Blob 容器名称 |
properties.dataLakeAccountName |
string |
捕获事件的 Azure Data Lake Store 名称 |
properties.dataLakeFolderPath |
string |
捕获事件的目标文件夹路径 |
properties.dataLakeSubscriptionId |
string (uuid) |
Azure Data Lake Store 的订阅 ID |
properties.storageAccountResourceId |
string |
用于创建 Blob 的存储帐户的资源 ID |
EncodingCaptureDescription
枚举捕获说明的编码格式的可能值。 注意:新 API 版本中将弃用“AvroDeflate”
值 | 说明 |
---|---|
Avro | |
AvroDeflate |
EntityStatus
枚举事件中心状态的可能值。
值 | 说明 |
---|---|
Active | |
Creating | |
Deleting | |
Disabled | |
ReceiveDisabled | |
Renaming | |
Restoring | |
SendDisabled | |
Unknown |
ErrorAdditionalInfo
资源管理错误附加信息。
名称 | 类型 | 说明 |
---|---|---|
info |
object |
其他信息。 |
type |
string |
其他信息类型。 |
ErrorDetail
错误详细信息。
名称 | 类型 | 说明 |
---|---|---|
additionalInfo |
错误附加信息。 |
|
code |
string |
错误代码。 |
details |
错误详细信息。 |
|
message |
string |
错误消息。 |
target |
string |
错误目标。 |
ErrorResponse
错误响应指示事件中心服务无法处理传入请求。 错误消息中提供了原因。
名称 | 类型 | 说明 |
---|---|---|
error |
错误对象。 |
Eventhub
列表或获取事件中心操作中的单个项
名称 | 类型 | 说明 |
---|---|---|
id |
string |
资源的完全限定资源 ID。 Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} |
location |
string |
资源所在的地理位置 |
name |
string |
资源的名称 |
properties.captureDescription |
捕获说明的属性 |
|
properties.createdAt |
string (date-time) |
创建事件中心的确切时间。 |
properties.messageRetentionInDays |
integer (int64) minimum: 1 |
保留此事件中心的事件的天数,值应为 1 到 7 天 |
properties.partitionCount |
integer (int64) minimum: 1 |
为事件中心创建的分区数,允许的值从 1 到 32 个分区。 |
properties.partitionIds |
string[] |
事件中心上的当前分片数。 |
properties.retentionDescription |
事件中心保留设置 |
|
properties.status |
枚举事件中心状态的可能值。 |
|
properties.updatedAt |
string (date-time) |
消息的确切更新时间。 |
properties.userMetadata |
string |
获取和设置用户的元数据。 |
systemData |
与此资源相关的系统元数据。 |
|
type |
string |
资源的类型。 例如“Microsoft.EventHub/Namespaces”或“Microsoft.EventHub/Namespaces/EventHubs” |
RetentionDescription
配置事件中心保留设置的属性
名称 | 类型 | 说明 |
---|---|---|
cleanupPolicy |
枚举清理策略的可能值 |
|
retentionTimeInHours |
integer (int64) |
保留此事件中心的事件的小时数。 仅当 cleanupPolicy 为 Delete 时,才使用此值。 如果 cleanupPolicy 为 Compact,则此属性的返回值为 Long.MaxValue |
tombstoneRetentionTimeInHours |
integer (int32) |
保留压缩事件中心的逻辑删除标记的小时数。 仅当 cleanupPolicy 为 Compact 时,才使用此值。 使用者必须在此指定的时间范围内完成读取墓碑标记(如果使用者从起始偏移开始)以确保它们获取压缩事件中心内逻辑删除标记所描述的特定键的有效快照 |
systemData
与创建和上次修改资源相关的元数据。
名称 | 类型 | 说明 |
---|---|---|
createdAt |
string (date-time) |
资源创建时间戳(UTC)。 |
createdBy |
string |
创建资源的标识。 |
createdByType |
创建资源的标识的类型。 |
|
lastModifiedAt |
string (date-time) |
上次修改资源的标识的类型。 |
lastModifiedBy |
string |
上次修改资源的标识。 |
lastModifiedByType |
上次修改资源的标识的类型。 |