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

Microsoft.EventGrid 主题 2018-09-15-preview

Bicep 资源定义

主题资源类型可以使用以下目标操作进行部署:

有关每个 API 版本中更改的属性的列表,请参阅 更改日志

资源格式

若要创建 Microsoft.EventGrid/topics 资源,请将以下 Bicep 添加到模板。

resource symbolicname 'Microsoft.EventGrid/topics@2018-09-15-preview' = {
  name: 'string'
  location: 'string'
  tags: {
    tagName1: 'tagValue1'
    tagName2: 'tagValue2'
  }
  properties: {
    inputSchema: 'string'
    inputSchemaMapping: {
      inputSchemaMappingType: 'string'
      // For remaining properties, see InputSchemaMapping objects
    }
  }
}

InputSchemaMapping 对象

设置 inputSchemaMappingType 属性以指定对象的类型。

对于 Json,请使用:

  inputSchemaMappingType: 'Json'
  properties: {
    dataVersion: {
      defaultValue: 'string'
      sourceField: 'string'
    }
    eventTime: {
      sourceField: 'string'
    }
    eventType: {
      defaultValue: 'string'
      sourceField: 'string'
    }
    id: {
      sourceField: 'string'
    }
    subject: {
      defaultValue: 'string'
      sourceField: 'string'
    }
    topic: {
      sourceField: 'string'
    }
  }

属性值

topics

名称 说明
name 资源名称 字符串 (必需)

字符限制:3-50

有效字符:
字母数字和连字符。
location 资源的位置 字符串 (必需)
标记 资源的标记 标记名称和值的字典。 请参阅 模板中的标记
properties 主题的属性 TopicProperties

TopicProperties

名称 说明
inputSchema 这将确定事件网格应预期发布到主题的传入事件的格式。 “CloudEventV01Schema”
“CustomEventSchema”
“EventGridSchema”
inputSchemaMapping 这样就可以使用自定义事件架构进行发布。 可以指定 InputSchemaMapping,将源架构的各种属性映射到 EventGridEvent 架构的各种必需属性。 InputSchemaMapping

InputSchemaMapping

名称 说明
inputSchemaMappingType 设置对象类型 需要 json ()

JsonInputSchemaMapping

名称 说明
inputSchemaMappingType 自定义映射的类型 “Json” (必需)
properties 输入架构映射的 JSON 属性 JsonInputSchemaMappingProperties

JsonInputSchemaMappingProperties

名称 说明
dataVersion 事件网格事件的 DataVersion 属性的映射信息。 JsonFieldWithDefault
EventTime 事件网格事件的 EventTime 属性的映射信息。 JsonField
eventType 事件网格事件的 EventType 属性的映射信息。 JsonFieldWithDefault
id 事件网格事件的 Id 属性的映射信息。 JsonField
subject 事件网格事件的 Subject 属性的映射信息。 JsonFieldWithDefault
主题 事件网格事件的 Topic 属性的映射信息。 JsonField

JsonFieldWithDefault

名称 说明
defaultValue 如果未提供 SourceField,或者已发布的 JSON 事件有效负载中没有具有指定名称的属性,则用于映射的默认值。 字符串
sourceField 要用作映射源的输入事件架构中的字段的名称。 字符串

JsonField

名称 说明
sourceField 要用作映射源的输入事件架构中的字段的名称。 字符串

快速入门模板

以下快速入门模板部署此资源类型。

模板 说明
创建Azure 事件网格自定义主题和订阅

部署到 Azure
创建Azure 事件网格自定义主题和 Webhook 订阅。 模板最初由 John Downs 创作。
使用 CloudEvents 自定义Azure 事件网格主题/订阅

部署到 Azure
创建自定义Azure 事件网格主题、具有 CloudEvents 架构的 Webhook 订阅和作为事件处理程序的逻辑应用。 模板最初由 Justin Yoo 创作。
创建事件网格自定义主题和事件中心处理程序

部署到 Azure
创建Azure 事件网格自定义主题和事件中心来处理事件。
创建Azure 事件网格自定义主题和队列订阅

部署到 Azure
创建Azure 事件网格自定义主题和服务总线队列订阅。 模板最初由 Markus Meyer 创作。
创建Azure 事件网格自定义主题订阅

部署到 Azure
创建Azure 事件网格自定义主题和服务总线主题订阅。 模板最初由 Markus Meyer 创作。

ARM 模板资源定义

主题资源类型可以使用面向以下对象的操作进行部署:

有关每个 API 版本中已更改属性的列表,请参阅 更改日志

资源格式

若要创建 Microsoft.EventGrid/topics 资源,请将以下 JSON 添加到模板。

{
  "type": "Microsoft.EventGrid/topics",
  "apiVersion": "2018-09-15-preview",
  "name": "string",
  "location": "string",
  "tags": {
    "tagName1": "tagValue1",
    "tagName2": "tagValue2"
  },
  "properties": {
    "inputSchema": "string",
    "inputSchemaMapping": {
      "inputSchemaMappingType": "string"
      // For remaining properties, see InputSchemaMapping objects
    }
  }
}

InputSchemaMapping 对象

设置 inputSchemaMappingType 属性以指定对象的类型。

对于 Json,请使用:

  "inputSchemaMappingType": "Json",
  "properties": {
    "dataVersion": {
      "defaultValue": "string",
      "sourceField": "string"
    },
    "eventTime": {
      "sourceField": "string"
    },
    "eventType": {
      "defaultValue": "string",
      "sourceField": "string"
    },
    "id": {
      "sourceField": "string"
    },
    "subject": {
      "defaultValue": "string",
      "sourceField": "string"
    },
    "topic": {
      "sourceField": "string"
    }
  }

属性值

topics

名称 说明 Value
type 资源类型 'Microsoft.EventGrid/topics'
apiVersion 资源 API 版本 '2018-09-15-preview'
name 资源名称 字符串 (必需)

字符限制:3-50

有效字符:
字母数字和连字符。
location 资源的位置 字符串 (必需)
标记 资源的标记 标记名称和值的字典。 请参阅 模板中的标记
properties 主题的属性 TopicProperties

TopicProperties

名称 说明
inputSchema 这将确定事件网格应针对发布到主题的传入事件应采用的格式。 “CloudEventV01Schema”
“CustomEventSchema”
“EventGridSchema”
inputSchemaMapping 这允许使用自定义事件架构进行发布。 可以指定 InputSchemaMapping,将源架构的各种属性映射到 EventGridEvent 架构的各种必需属性。 InputSchemaMapping

InputSchemaMapping

名称 说明
inputSchemaMappingType 设置对象类型 需要 json ()

JsonInputSchemaMapping

名称 说明
inputSchemaMappingType 自定义映射的类型 需要“Json” ()
properties 输入架构映射的 JSON 属性 JsonInputSchemaMappingProperties

JsonInputSchemaMappingProperties

名称 说明
dataVersion 事件网格事件的 DataVersion 属性的映射信息。 JsonFieldWithDefault
EventTime 事件网格事件的 EventTime 属性的映射信息。 JsonField
eventType 事件网格事件的 EventType 属性的映射信息。 JsonFieldWithDefault
id 事件网格事件的 Id 属性的映射信息。 JsonField
subject 事件网格事件的 Subject 属性的映射信息。 JsonFieldWithDefault
主题 事件网格事件的 Topic 属性的映射信息。 JsonField

JsonFieldWithDefault

名称 说明
defaultValue 如果未提供 SourceField,或者已发布的 JSON 事件有效负载中没有具有指定名称的属性,则用于映射的默认值。 string
sourceField 要用作映射源的输入事件架构中的字段的名称。 string

JsonField

名称 说明
sourceField 要用作映射源的输入事件架构中的字段的名称。 字符串

快速入门模板

以下快速入门模板部署此资源类型。

模板 说明
创建Azure 事件网格自定义主题和订阅

部署到 Azure
创建Azure 事件网格自定义主题和 Webhook 订阅。 模板最初由 John Downs 创作。
使用 CloudEvents 自定义Azure 事件网格主题/订阅

部署到 Azure
创建自定义Azure 事件网格主题、具有 CloudEvents 架构的 Webhook 订阅和作为事件处理程序的逻辑应用。 模板最初由 Justin Yoo 创作。
创建事件网格自定义主题和事件中心处理程序

部署到 Azure
创建Azure 事件网格自定义主题和事件中心来处理事件。
创建Azure 事件网格自定义主题和队列订阅

部署到 Azure
创建Azure 事件网格自定义主题和服务总线队列订阅。 模板最初由 Markus Meyer 创作。
创建Azure 事件网格自定义主题订阅

部署到 Azure
创建Azure 事件网格自定义主题和服务总线主题订阅。 模板最初由 Markus Meyer 创作。

Terraform (AzAPI 提供程序) 资源定义

主题资源类型可以使用面向以下对象的操作进行部署:

  • 资源组

有关每个 API 版本中已更改属性的列表,请参阅 更改日志

资源格式

若要创建 Microsoft.EventGrid/topics 资源,请将以下 Terraform 添加到模板。

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.EventGrid/topics@2018-09-15-preview"
  name = "string"
  location = "string"
  parent_id = "string"
  tags = {
    tagName1 = "tagValue1"
    tagName2 = "tagValue2"
  }
  body = jsonencode({
    properties = {
      inputSchema = "string"
      inputSchemaMapping = {
        inputSchemaMappingType = "string"
        // For remaining properties, see InputSchemaMapping objects
      }
    }
  })
}

InputSchemaMapping 对象

设置 inputSchemaMappingType 属性以指定对象的类型。

对于 Json,请使用:

  inputSchemaMappingType = "Json"
  properties = {
    dataVersion = {
      defaultValue = "string"
      sourceField = "string"
    }
    eventTime = {
      sourceField = "string"
    }
    eventType = {
      defaultValue = "string"
      sourceField = "string"
    }
    id = {
      sourceField = "string"
    }
    subject = {
      defaultValue = "string"
      sourceField = "string"
    }
    topic = {
      sourceField = "string"
    }
  }

属性值

topics

名称 说明 Value
type 资源类型 “Microsoft.EventGrid/topics@2018-09-15-preview”
name 资源名称 字符串 (必需)

字符限制:3-50

有效字符:
字母数字和连字符。
location 资源的位置 字符串 (必需)
parent_id 若要部署到资源组,请使用该资源组的 ID。 字符串 (必需)
标记 资源的标记 标记名称和值的字典。
properties 主题的属性 TopicProperties

TopicProperties

名称 说明
inputSchema 这将确定事件网格应预期发布到主题的传入事件的格式。 “CloudEventV01Schema”
“CustomEventSchema”
“EventGridSchema”
inputSchemaMapping 这样就可以使用自定义事件架构进行发布。 可以指定 InputSchemaMapping,将源架构的各种属性映射到 EventGridEvent 架构的各种必需属性。 InputSchemaMapping

InputSchemaMapping

名称 说明
inputSchemaMappingType 设置对象类型 需要 json ()

JsonInputSchemaMapping

名称 说明
inputSchemaMappingType 自定义映射的类型 “Json” (必需)
properties 输入架构映射的 JSON 属性 JsonInputSchemaMappingProperties

JsonInputSchemaMappingProperties

名称 说明
dataVersion 事件网格事件的 DataVersion 属性的映射信息。 JsonFieldWithDefault
EventTime 事件网格事件的 EventTime 属性的映射信息。 JsonField
eventType 事件网格事件的 EventType 属性的映射信息。 JsonFieldWithDefault
id 事件网格事件的 Id 属性的映射信息。 JsonField
subject 事件网格事件的 Subject 属性的映射信息。 JsonFieldWithDefault
主题 事件网格事件的 Topic 属性的映射信息。 JsonField

JsonFieldWithDefault

名称 说明
defaultValue 如果未提供 SourceField,或者发布的 JSON 事件有效负载中没有具有指定名称的属性,则用于映射的默认值。 字符串
sourceField 要用作映射源的输入事件架构中的字段的名称。 字符串

JsonField

名称 说明
sourceField 要用作映射源的输入事件架构中的字段的名称。 字符串