你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Event Sources - Create Or Update

在指定环境中创建或更新事件源。

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TimeSeriesInsights/environments/{environmentName}/eventSources/{eventSourceName}?api-version=2020-05-15

URI 参数

名称 必需 类型 说明
environmentName
path True

string

与指定资源组关联的时序见解环境的名称。

eventSourceName
path True

string

事件源的名称。

Regex pattern: ^[-\w\._\(\)]+$

resourceGroupName
path True

string

Azure 资源组的名称。

subscriptionId
path True

string

Azure 订阅 ID。

api-version
query True

string

要与客户端请求一起使用的 API 的版本。

请求正文

请求正文可以为下列任一内容:

名称 说明
EventHubEventSourceCreateOrUpdateParameters

提供给 EventHub 事件源的“创建或更新事件源”操作的参数。

IoTHubEventSourceCreateOrUpdateParameters

提供给 IoTHub 事件源的“创建或更新事件源”操作的参数。

EventHubEventSourceCreateOrUpdateParameters

提供给 EventHub 事件源的“创建或更新事件源”操作的参数。

名称 必需 类型 说明
eventSourceResourceId True

string

Azure 资源管理器中事件源的资源 ID。

kind True string:

Microsoft.EventHub

事件源的类型。

location True

string

资源的位置。

properties.consumerGroupName True

string

事件中心使用者组的名称,该使用者组包含要从中读取事件的分区。

properties.eventHubName True

string

事件中心的名称。

properties.keyName True

string

向时序见解服务授予对事件中心的访问权限的 SAS 密钥的名称。 此密钥的共享访问策略必须向事件中心授予“侦听”权限。

properties.serviceBusNamespace True

string

包含事件中心的服务总线的名称。

properties.sharedAccessKey True

string

向时序见解服务授予对事件中心的读取访问权限的共享访问密钥的值。 此属性不显示在事件源响应中。

ingressStartAt.time

string

) 可选ISO8601具有秒精度 (毫秒的 UTC 日期时间,用于指定用作事件使用的起点的日期和时间。

ingressStartAt.type

IngressStartAtType

ingressStartAt 的类型,可以是“EarliestAvailable”、“EventSourceCreationTime”、“CustomEnqueuedTime”。

localTimestamp

LocalTimestamp

一个表示本地时间戳属性的 对象。 它包含需要使用的本地时间戳格式和相应的时区偏移量信息。 如果未为 localTimestamp 指定值,或者如果为 null,则不会将本地时间戳与事件一起引入。

tags

object

资源的附加属性的键值对。

timestampPropertyName

string

用作事件源时间戳的事件属性。 如果未为 timestampPropertyName 指定值,或者指定 null 或空字符串,则会使用事件创建时间。

IoTHubEventSourceCreateOrUpdateParameters

提供给 IoTHub 事件源的“创建或更新事件源”操作的参数。

名称 必需 类型 说明
eventSourceResourceId True

string

Azure 资源管理器中事件源的资源 ID。

kind True string:

Microsoft.IoTHub

事件源的类型。

location True

string

资源的位置。

properties.consumerGroupName True

string

iot 中心的使用者组的名称,该使用者组包含要从中读取事件的分区。

properties.iotHubName True

string

iot 中心的名称。

properties.keyName True

string

向时序见解服务授予对 iot 中心的访问权限的共享访问策略密钥的名称。 此共享访问策略密钥必须授予对 iot 中心的“服务连接”权限。

properties.sharedAccessKey True

string

向时序见解服务授予对 iot 中心的读取访问权限的共享访问策略密钥的值。 此属性不显示在事件源响应中。

ingressStartAt.time

string

) 可选ISO8601具有秒精度 (毫秒的 UTC 日期时间,用于指定用作事件使用的起点的日期和时间。

ingressStartAt.type

IngressStartAtType

ingressStartAt 的类型,可以是“EarliestAvailable”、“EventSourceCreationTime”、“CustomEnqueuedTime”。

localTimestamp

LocalTimestamp

一个表示本地时间戳属性的 对象。 它包含需要使用的本地时间戳格式和相应的时区偏移量信息。 如果未为 localTimestamp 指定值,或者如果为 null,则不会将本地时间戳与事件一起引入。

tags

object

资源的附加属性的键值对。

timestampPropertyName

string

用作事件源时间戳的事件属性。 如果未为 timestampPropertyName 指定值,或者指定 null 或空字符串,则会使用事件创建时间。

响应

名称 类型 说明
200 OK EventSourceResource:

已成功更新现有事件源定义。

201 Created EventSourceResource:

已成功创建事件源。

Other Status Codes

CloudError

HTTP 400 (错误的请求) :给定的事件源请求正文无效;有关详细信息,请参阅响应中的错误代码和消息。

安全性

azure_auth

Azure Active Directory OAuth2 流

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

Scopes

名称 说明
user_impersonation 模拟用户帐户

示例

CreateEventHubEventSource
EventSourcesCreateEventHubWithCustomEnquedTime

CreateEventHubEventSource

Sample Request

PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.TimeSeriesInsights/environments/env1/eventSources/es1?api-version=2020-05-15

{
  "location": "West US",
  "kind": "Microsoft.EventHub",
  "properties": {
    "eventSourceResourceId": "somePathInArm",
    "serviceBusNamespace": "sbn",
    "consumerGroupName": "cgn",
    "eventHubName": "ehn",
    "keyName": "managementKey",
    "sharedAccessKey": "someSecretvalue",
    "timestampPropertyName": "someTimestampProperty",
    "localTimestamp": {
      "format": "TimeSpan",
      "timeZoneOffset": {
        "propertyName": "someEventPropertyName"
      }
    },
    "ingressStartAt": {
      "type": "EarliestAvailable"
    }
  }
}

Sample Response

{
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.TimeSeriesInsights/Environments/env1/eventSources/es1",
  "location": "West US",
  "name": "es1",
  "type": "Microsoft.TimeSeriesInsights/Environments/EventSources",
  "tags": {},
  "kind": "Microsoft.EventHub",
  "properties": {
    "eventSourceResourceId": "somePathInArm",
    "serviceBusNamespace": "sbn",
    "consumerGroupName": "cgn",
    "eventHubName": "ehn",
    "keyName": "managementKey",
    "provisioningState": "Succeeded",
    "creationTime": "2017-04-18T19:20:33.2288820Z",
    "localTimestamp": {
      "format": "TimeSpan",
      "timeZoneOffset": {
        "propertyName": "someEventPropertyName"
      }
    },
    "ingressStartAt": {
      "type": "EarliestAvailable"
    }
  }
}
{
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.TimeSeriesInsights/Environments/env1/eventSources/es1",
  "location": "West US",
  "name": "es1",
  "type": "Microsoft.TimeSeriesInsights/Environments/EventSources",
  "tags": {},
  "kind": "Microsoft.EventHub",
  "properties": {
    "eventSourceResourceId": "somePathInArm",
    "serviceBusNamespace": "sbn",
    "consumerGroupName": "cgn",
    "eventHubName": "ehn",
    "keyName": "managementKey",
    "provisioningState": "Succeeded",
    "creationTime": "2017-04-18T19:20:33.2288820Z",
    "localTimestamp": {
      "format": "TimeSpan",
      "timeZoneOffset": {
        "propertyName": "someEventPropertyName"
      }
    },
    "ingressStartAt": {
      "type": "EarliestAvailable"
    }
  }
}

EventSourcesCreateEventHubWithCustomEnquedTime

Sample Request

PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.TimeSeriesInsights/environments/env1/eventSources/es1?api-version=2020-05-15

{
  "location": "West US",
  "kind": "Microsoft.EventHub",
  "properties": {
    "eventSourceResourceId": "somePathInArm",
    "serviceBusNamespace": "sbn",
    "consumerGroupName": "cgn",
    "eventHubName": "ehn",
    "keyName": "managementKey",
    "sharedAccessKey": "someSecretvalue",
    "timestampPropertyName": "someTimestampProperty",
    "ingressStartAt": {
      "type": "CustomEnqueuedTime",
      "time": "2017-04-01T19:20:33.2288820Z"
    }
  }
}

Sample Response

{
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.TimeSeriesInsights/Environments/env1/eventSources/es1",
  "location": "West US",
  "name": "es1",
  "type": "Microsoft.TimeSeriesInsights/Environments/EventSources",
  "tags": {},
  "kind": "Microsoft.EventHub",
  "properties": {
    "eventSourceResourceId": "somePathInArm",
    "serviceBusNamespace": "sbn",
    "consumerGroupName": "cgn",
    "eventHubName": "ehn",
    "keyName": "managementKey",
    "provisioningState": "Succeeded",
    "creationTime": "2017-04-18T19:20:33.2288820Z",
    "ingressStartAt": {
      "type": "CustomEnqueuedTime",
      "time": "2017-04-01T19:20:33.2288820Z"
    }
  }
}
{
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.TimeSeriesInsights/Environments/env1/eventSources/es1",
  "location": "West US",
  "name": "es1",
  "type": "Microsoft.TimeSeriesInsights/Environments/EventSources",
  "tags": {},
  "kind": "Microsoft.EventHub",
  "properties": {
    "eventSourceResourceId": "somePathInArm",
    "serviceBusNamespace": "sbn",
    "consumerGroupName": "cgn",
    "eventHubName": "ehn",
    "keyName": "managementKey",
    "provisioningState": "Succeeded",
    "creationTime": "2017-04-18T19:20:33.2288820Z",
    "ingressStartAt": {
      "type": "CustomEnqueuedTime",
      "time": "2017-04-01T19:20:33.2288820Z"
    }
  }
}

定义

名称 说明
CloudError

包含有关 API 错误的信息。

CloudErrorBody

使用错误代码和消息描述特定的 API 错误。

EventHubEventSourceCreateOrUpdateParameters

提供给 EventHub 事件源的“创建或更新事件源”操作的参数。

EventHubEventSourceResource

从 Azure EventHub 接收其数据的事件源。

IngressStartAtType

ingressStartAt 的类型,可以是“EarliestAvailable”、“EventSourceCreationTime”、“CustomEnqueuedTime”。

IoTHubEventSourceCreateOrUpdateParameters

提供给 IoTHub 事件源的“创建或更新事件源”操作的参数。

IoTHubEventSourceResource

从 Azure IoTHub 接收其数据的事件源。

LocalTimestamp

一个表示本地时间戳属性的 对象。 它包含需要使用的本地时间戳格式和相应的时区偏移量信息。 如果未为 localTimestamp 指定值,或者如果为 null,则不会将本地时间戳与事件一起引入。

LocalTimestampFormat

一个枚举,表示需要设置的本地时间戳属性的格式。

ProvisioningState

资源的预配状态。

TimeZoneOffset

一个 对象,表示指定的本地时间戳格式的偏移信息。 不应为 LocalTimestampFormat - Embedded 指定。

CloudError

包含有关 API 错误的信息。

名称 类型 说明
error

CloudErrorBody

使用错误代码和消息描述特定的 API 错误。

CloudErrorBody

使用错误代码和消息描述特定的 API 错误。

名称 类型 说明
code

string

描述错误条件的错误代码比 HTTP 状态代码更精确。 可用于以编程方式处理特定错误情况。

details

CloudErrorBody[]

包含与此错误相关的嵌套错误。

message

string

详细描述错误并提供调试信息的消息。

target

string

特定错误的目标 (例如,错误) 中属性的名称。

EventHubEventSourceCreateOrUpdateParameters

提供给 EventHub 事件源的“创建或更新事件源”操作的参数。

名称 类型 说明
creationTime

string

创建资源的时间。

eventSourceResourceId

string

Azure 资源管理器中事件源的资源 ID。

ingressStartAt.time

string

) 可选ISO8601具有秒精度 (毫秒的 UTC 日期时间,用于指定用作事件使用的起点的日期和时间。

ingressStartAt.type

IngressStartAtType

ingressStartAt 的类型,可以是“EarliestAvailable”、“EventSourceCreationTime”、“CustomEnqueuedTime”。

kind string:

Microsoft.EventHub

事件源的类型。

localTimestamp

LocalTimestamp

一个表示本地时间戳属性的 对象。 它包含需要使用的本地时间戳格式和相应的时区偏移量信息。 如果未为 localTimestamp 指定值,或者如果为 null,则不会将本地时间戳与事件一起引入。

location

string

资源的位置。

properties.consumerGroupName

string

事件中心使用者组的名称,该使用者组包含要从中读取事件的分区。

properties.eventHubName

string

事件中心的名称。

properties.keyName

string

向时序见解服务授予对事件中心的访问权限的 SAS 密钥的名称。 此密钥的共享访问策略必须向事件中心授予“侦听”权限。

properties.serviceBusNamespace

string

包含事件中心的服务总线的名称。

properties.sharedAccessKey

string

向时序见解服务授予对事件中心的读取访问权限的共享访问密钥的值。 此属性不显示在事件源响应中。

provisioningState

ProvisioningState

资源的预配状态。

tags

object

资源的附加属性的键值对。

timestampPropertyName

string

用作事件源时间戳的事件属性。 如果未为 timestampPropertyName 指定值,或者指定 null 或空字符串,则会使用事件创建时间。

EventHubEventSourceResource

从 Azure EventHub 接收其数据的事件源。

名称 类型 说明
creationTime

string

创建资源的时间。

eventSourceResourceId

string

Azure 资源管理器中事件源的资源 ID。

id

string

资源 ID

ingressStartAt.time

string

) 可选ISO8601具有秒精度 (毫秒的 UTC 日期时间,用于指定用作事件使用的起点的日期和时间。

ingressStartAt.type

IngressStartAtType

ingressStartAt 的类型,可以是“EarliestAvailable”、“EventSourceCreationTime”、“CustomEnqueuedTime”。

kind string:

Microsoft.EventHub

事件源的类型。

localTimestamp

LocalTimestamp

一个表示本地时间戳属性的 对象。 它包含需要使用的本地时间戳格式和相应的时区偏移量信息。 如果未为 localTimestamp 指定值,或者如果为 null,则不会将本地时间戳与事件一起引入。

location

string

资源位置

name

string

资源名称

properties.consumerGroupName

string

事件中心使用者组的名称,该使用者组包含要从中读取事件的分区。

properties.eventHubName

string

事件中心的名称。

properties.keyName

string

向时序见解服务授予对事件中心的访问权限的 SAS 密钥的名称。 此密钥的共享访问策略必须向事件中心授予“侦听”权限。

properties.serviceBusNamespace

string

包含事件中心的服务总线的名称。

provisioningState

ProvisioningState

资源的预配状态。

tags

object

资源标记

timestampPropertyName

string

用作事件源时间戳的事件属性。 如果未为 timestampPropertyName 指定值,或者指定 null 或空字符串,则会使用事件创建时间。

type

string

资源类型

IngressStartAtType

ingressStartAt 的类型,可以是“EarliestAvailable”、“EventSourceCreationTime”、“CustomEnqueuedTime”。

名称 类型 说明
CustomEnqueuedTime

string

EarliestAvailable

string

EventSourceCreationTime

string

IoTHubEventSourceCreateOrUpdateParameters

提供给 IoTHub 事件源的“创建或更新事件源”操作的参数。

名称 类型 说明
creationTime

string

创建资源的时间。

eventSourceResourceId

string

Azure 资源管理器中事件源的资源 ID。

ingressStartAt.time

string

) 可选ISO8601具有秒精度 (毫秒的 UTC 日期时间,用于指定用作事件使用的起点的日期和时间。

ingressStartAt.type

IngressStartAtType

ingressStartAt 的类型,可以是“EarliestAvailable”、“EventSourceCreationTime”、“CustomEnqueuedTime”。

kind string:

Microsoft.IoTHub

事件源的类型。

localTimestamp

LocalTimestamp

一个表示本地时间戳属性的 对象。 它包含需要使用的本地时间戳格式和相应的时区偏移量信息。 如果未为 localTimestamp 指定值,或者如果为 null,则不会将本地时间戳与事件一起引入。

location

string

资源的位置。

properties.consumerGroupName

string

iot 中心的使用者组的名称,该使用者组包含要从中读取事件的分区。

properties.iotHubName

string

iot 中心的名称。

properties.keyName

string

向时序见解服务授予对 iot 中心的访问权限的共享访问策略密钥的名称。 此共享访问策略密钥必须授予对 iot 中心的“服务连接”权限。

properties.sharedAccessKey

string

向时序见解服务授予对 iot 中心的读取访问权限的共享访问策略密钥的值。 此属性不显示在事件源响应中。

provisioningState

ProvisioningState

资源的预配状态。

tags

object

资源的附加属性的键值对。

timestampPropertyName

string

用作事件源时间戳的事件属性。 如果未为 timestampPropertyName 指定值,或者指定 null 或空字符串,则会使用事件创建时间。

IoTHubEventSourceResource

从 Azure IoTHub 接收其数据的事件源。

名称 类型 说明
creationTime

string

创建资源的时间。

eventSourceResourceId

string

Azure 资源管理器中事件源的资源 ID。

id

string

资源 ID

ingressStartAt.time

string

) 可选ISO8601具有秒精度 (毫秒的 UTC 日期时间,用于指定用作事件使用的起点的日期和时间。

ingressStartAt.type

IngressStartAtType

ingressStartAt 的类型,可以是“EarliestAvailable”、“EventSourceCreationTime”、“CustomEnqueuedTime”。

kind string:

Microsoft.IoTHub

事件源的类型。

localTimestamp

LocalTimestamp

一个表示本地时间戳属性的 对象。 它包含需要使用的本地时间戳格式和相应的时区偏移量信息。 如果未为 localTimestamp 指定值,或者如果为 null,则不会将本地时间戳与事件一起引入。

location

string

资源位置

name

string

资源名称

properties.consumerGroupName

string

iot 中心的使用者组的名称,该使用者组包含要从中读取事件的分区。

properties.iotHubName

string

iot 中心的名称。

properties.keyName

string

向时序见解服务授予对 iot 中心的访问权限的共享访问策略密钥的名称。 此共享访问策略密钥必须授予对 iot 中心的“服务连接”权限。

provisioningState

ProvisioningState

资源的预配状态。

tags

object

资源标记

timestampPropertyName

string

用作事件源时间戳的事件属性。 如果未为 timestampPropertyName 指定值,或者指定 null 或空字符串,则会使用事件创建时间。

type

string

资源类型

LocalTimestamp

一个表示本地时间戳属性的 对象。 它包含需要使用的本地时间戳格式和相应的时区偏移量信息。 如果未为 localTimestamp 指定值,或者如果为 null,则不会将本地时间戳与事件一起引入。

名称 类型 说明
format

LocalTimestampFormat

一个枚举,表示需要设置的本地时间戳属性的格式。

timeZoneOffset

TimeZoneOffset

一个 对象,表示指定的本地时间戳格式的偏移信息。 不应为 LocalTimestampFormat - Embedded 指定。

LocalTimestampFormat

一个枚举,表示需要设置的本地时间戳属性的格式。

名称 类型 说明
Embedded

string

ProvisioningState

资源的预配状态。

名称 类型 说明
Accepted

string

Creating

string

Deleting

string

Failed

string

Succeeded

string

Updating

string

TimeZoneOffset

一个 对象,表示指定的本地时间戳格式的偏移信息。 不应为 LocalTimestampFormat - Embedded 指定。

名称 类型 说明
propertyName

string

将包含用于计算本地时间戳的偏移量信息的事件属性。 当 LocalTimestampFormat 为 Iana 时,属性名称将包含包含 IANA 时区名称的列的名称 (例如:Americas/Los Angeles) 。 当 LocalTimestampFormat 为 Timespan 时,它包含属性的名称,其中包含表示偏移量的值 (例如:P1D 或 1.00:00:00)