你当前正在访问 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 参数

名称 必需 类型 说明
eventHubName
path True

string

事件中心名称

namespaceName
path True

string

命名空间名称

Regex pattern: ^[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 版本。

请求正文

名称 类型 说明
properties.captureDescription

CaptureDescription

捕获说明的属性

properties.messageRetentionInDays

integer

为此事件中心保留事件的天数,值应为 1 到 7 天

properties.partitionCount

integer

为事件中心创建的分区数,允许的值为 1 到 32 个分区。

properties.retentionDescription

RetentionDescription

事件中心保留设置

properties.status

EntityStatus

枚举事件中心状态的可能值。

properties.userMetadata

string

获取和设置用户的元数据。

响应

名称 类型 说明
200 OK

Eventhub

已成功创建事件中心。

Other Status Codes

ErrorResponse

描述操作失败原因的 Eventhub 错误响应。

安全性

azure_auth

Azure Active Directory OAuth2 流

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

名称 说明
user_impersonation 模拟用户帐户

示例

EventHubCreate

Sample Request

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
    }
  }
}

Sample Response

{
  "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
    }
  }
}

定义

名称 说明
CaptureDescription

用于为 eventhub 配置捕获说明的属性

CaptureIdentity

一个 值,该值指示是否启用捕获说明。

CaptureIdentityType

Azure Active Directory 托管标识的类型。

CleanupPolicyRetentionDescription

枚举清理策略的可能值

createdByType

创建资源的标识类型。

Destination

捕获描述的捕获存储详细信息

EncodingCaptureDescription

枚举捕获说明编码格式的可能值。 注意:新 API 版本中将弃用“AvroDeflate”

EntityStatus

枚举事件中心状态的可能值。

ErrorAdditionalInfo

资源管理错误附加信息。

ErrorDetail

错误详细信息。

ErrorResponse

错误响应指示事件中心服务无法处理传入请求。 错误消息中提供了原因。

Eventhub

列表或获取事件中心操作中的单个项

RetentionDescription

用于配置 eventhub 保留设置的属性

systemData

与资源的创建和上次修改相关的元数据。

CaptureDescription

用于为 eventhub 配置捕获说明的属性

名称 类型 说明
destination

Destination

要存储捕获的目标的属性。 (存储帐户、Blob 名称)

enabled

boolean

一个 值,该值指示是否启用捕获说明。

encoding

EncodingCaptureDescription

枚举捕获说明编码格式的可能值。 注意:新 API 版本中将弃用“AvroDeflate”

intervalInSeconds

integer

使用时间范围可以设置捕获到 Azure Blob 的频率,值应介于 60 到 900 秒之间

sizeLimitInBytes

integer

大小窗口定义捕获操作之前事件中心内生成的数据量,值应介于 10485760 到 524288000 个字节之间

skipEmptyArchives

boolean

一个值,该值指示是否跳过空存档

CaptureIdentity

一个 值,该值指示是否启用捕获说明。

名称 类型 说明
type

CaptureIdentityType

Azure Active Directory 托管标识的类型。

userAssignedIdentity

string

托管用户标识的 ARM ID。 此属性是必需的,类型为 UserAssignedIdentity。 如果 type 为 SystemAssigned,则将使用与命名空间关联的系统分配标识。

CaptureIdentityType

Azure Active Directory 托管标识的类型。

名称 类型 说明
SystemAssigned

string

UserAssigned

string

CleanupPolicyRetentionDescription

枚举清理策略的可能值

名称 类型 说明
Compact

string

Delete

string

createdByType

创建资源的标识类型。

名称 类型 说明
Application

string

Key

string

ManagedIdentity

string

User

string

Destination

捕获描述的捕获存储详细信息

名称 类型 说明
identity

CaptureIdentity

一个 值,该值指示是否启用捕获说明。

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

Azure Data Lake Store 的订阅 ID

properties.storageAccountResourceId

string

要用于创建 Blob 的存储帐户的资源 ID

EncodingCaptureDescription

枚举捕获说明编码格式的可能值。 注意:新 API 版本中将弃用“AvroDeflate”

名称 类型 说明
Avro

string

AvroDeflate

string

EntityStatus

枚举事件中心状态的可能值。

名称 类型 说明
Active

string

Creating

string

Deleting

string

Disabled

string

ReceiveDisabled

string

Renaming

string

Restoring

string

SendDisabled

string

Unknown

string

ErrorAdditionalInfo

资源管理错误附加信息。

名称 类型 说明
info

object

其他信息。

type

string

其他信息类型。

ErrorDetail

错误详细信息。

名称 类型 说明
additionalInfo

ErrorAdditionalInfo[]

错误附加信息。

code

string

错误代码。

details

ErrorDetail[]

错误详细信息。

message

string

错误消息。

target

string

错误目标。

ErrorResponse

错误响应指示事件中心服务无法处理传入请求。 错误消息中提供了原因。

名称 类型 说明
error

ErrorDetail

错误对象。

Eventhub

列表或获取事件中心操作中的单个项

名称 类型 说明
id

string

资源的完全限定的资源 ID。 例如 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

location

string

资源所在的地理位置

name

string

资源的名称

properties.captureDescription

CaptureDescription

捕获说明的属性

properties.createdAt

string

创建事件中心的确切时间。

properties.messageRetentionInDays

integer

为此事件中心保留事件的天数,值应为 1 到 7 天

properties.partitionCount

integer

为事件中心创建的分区数,允许的值为 1 到 32 个分区。

properties.partitionIds

string[]

事件中心上的当前分片数。

properties.retentionDescription

RetentionDescription

事件中心保留设置

properties.status

EntityStatus

枚举事件中心状态的可能值。

properties.updatedAt

string

消息的确切更新时间。

properties.userMetadata

string

获取和设置用户的元数据。

systemData

systemData

与此资源相关的系统元数据。

type

string

资源类型。 例如“Microsoft.EventHub/Namespaces”或“Microsoft.EventHub/Namespaces/EventHubs”

RetentionDescription

用于配置 eventhub 保留设置的属性

名称 类型 说明
cleanupPolicy

CleanupPolicyRetentionDescription

枚举清理策略的可能值

retentionTimeInHours

integer

保留此事件中心的事件的小时数。 仅当 cleanupPolicy 为 Delete 时才使用此值。 如果 cleanupPolicy 为 Compact,则此属性的返回值为 Long.MaxValue

tombstoneRetentionTimeInHours

integer

保留压缩事件中心的逻辑删除标记的小时数。 仅当 cleanupPolicy 为 Compact 时才使用此值。 如果使用者从开始偏移量开始,则使用者必须在指定的时间内完成对逻辑删除标记的读取,以确保在压缩事件中心内获得由逻辑删除标记描述的特定键的有效快照

systemData

与资源的创建和上次修改相关的元数据。

名称 类型 说明
createdAt

string

资源的创建时间戳 (UTC) 。

createdBy

string

创建资源的标识。

createdByType

createdByType

创建资源的标识类型。

lastModifiedAt

string

上次修改资源的标识类型。

lastModifiedBy

string

上次修改资源的标识。

lastModifiedByType

createdByType

上次修改资源的标识类型。