日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

事件內(nèi)容轉(zhuǎn)換

更新時(shí)間:

事件總線EventBridge支持事件內(nèi)容轉(zhuǎn)換,即在事件被路由到事件目標(biāo)前,事件總線EventBridge可以把CloudEvents標(biāo)準(zhǔn)事件轉(zhuǎn)換為事件目標(biāo)能接收的事件類型。本文介紹事件總線EventBridge提供的事件轉(zhuǎn)換類型。

背景信息

事件總線EventBridge支持的事件內(nèi)容轉(zhuǎn)換類型如下:

完整事件

當(dāng)轉(zhuǎn)化類型為完整事件時(shí),事件總線EventBridge不對(duì)事件進(jìn)行轉(zhuǎn)換,將原生CloudEvents的完整結(jié)構(gòu)路由到事件目標(biāo)。下表介紹經(jīng)過完整事件轉(zhuǎn)換前后的事件示例。

說明

更多CloudEvents相關(guān)信息,請(qǐng)參見CloudEvents 1.0

轉(zhuǎn)換前的事件

轉(zhuǎn)換類型

轉(zhuǎn)換后的事件

{
    "id":"7adc8c1a-645d-4476-bdef-5d6fb57f****",
    "source":"acs.oss",
    "specversion":"1.0",
    "type":"oss:ObjectCreated:PostObject",
    "datacontenttype":"application/json",
    "dataschema":"http://example.com/test.json",
    "subject":"acs:oss:cn-hangzhou:1234567:xls-papk/game_apk/123.jpg",
    "time":"2020-08-17T16:04:46.149Asia/Shanghai",
    "aliyuneventbusname":"demo-bus",
    "aliyunregionid":"Shanghai",
    "data":{
        "name":"test",
        "scope":100
    }
}

完整事件

{
    "id":"7adc8c1a-645d-4476-bdef-5d6fb57f****",
    "source":"acs.oss",
    "specversion":"1.0",
    "type":"oss:ObjectCreated:PostObject",
    "datacontenttype":"application/json",
    "dataschema":"http://example.com/test.json",
    "subject":"acs:oss:cn-hangzhou:1234567:xls-papk/game_apk/123.jpg",
    "time":"2020-08-17T16:04:46.149Asia/Shanghai",
    "aliyuneventbusname":"demo-bus",
    "aliyunregionid":"Shanghai",
    "data":{
        "name":"test",
        "scope":100
    }
}

部分事件

當(dāng)轉(zhuǎn)換類型為部分事件時(shí),事件總線EventBridge通過JSONPath從CloudEvents中提取事件中的參數(shù),將指定的事件內(nèi)容路由到事件目標(biāo)。下表介紹經(jīng)過部分事件轉(zhuǎn)換前后的事件示例。

轉(zhuǎn)換前的事件

轉(zhuǎn)換類型

轉(zhuǎn)換后的事件

{
    "id":"7adc8c1a-645d-4476-bdef-5d6fb57f****",
    "source":"acs.oss",
    "specversion":"1.0",
    "type":"oss:ObjectCreated:PostObject",
    "datacontenttype":"application/json",
    "dataschema":"http://example.com/test.json",
    "subject":"acs:oss:cn-hangzhou:1234567:xls-papk/game_apk/123.jpg",
    "time":"2020-08-17T16:04:46.149Asia/Shanghai",
    "aliyuneventbusname":"demo-bus",
    "aliyunregionid":"Shanghai",
    "data":{
        "name":"test",
        "scope":100
    }
}

部分事件

$.data.name
說明
  • 部分事件只支持定義一個(gè)變量。

  • value不超過10240個(gè)字符。

test

常量

當(dāng)轉(zhuǎn)換類型為常量時(shí),事件只起到觸發(fā)器的作用,不管事件內(nèi)容是什么,事件總線EventBridge都把常量路由到事件目標(biāo)。下表介紹經(jīng)過常量轉(zhuǎn)換前后的事件示例。

轉(zhuǎn)換前的事件

轉(zhuǎn)換類型

轉(zhuǎn)換后的事件

{
    "id":"7adc8c1a-645d-4476-bdef-5d6fb57f****",
    "source":"acs.oss",
    "specversion":"1.0",
    "type":"oss:ObjectCreated:PostObject",
    "datacontenttype":"application/json",
    "dataschema":"http://example.com/test.json",
    "subject":"acs:oss:cn-hangzhou:1234567:xls-papk/game_apk/123.jpg",
    "time":"2020-08-17T16:04:46.149Asia/Shanghai",
    "aliyuneventbusname":"demo-bus",
    "aliyunregionid":"Shanghai",
    "data":{
        "name":"test",
        "scope":100
    }
}

常量

test1
說明

value不超過10240個(gè)字符。

test1

模板

當(dāng)轉(zhuǎn)換類型為模板時(shí),通過自定義模板、定義模板里需要的變量,事件總線EventBridge通過JSONPath從CloudEvents提取事件中的參數(shù),把這些值存放在變量中,然后按照模板定義的格式路由到事件目標(biāo)。下表介紹經(jīng)過模板轉(zhuǎn)換前后的事件示例。

轉(zhuǎn)換前的事件

轉(zhuǎn)換類型

轉(zhuǎn)換后的事件

{
    "id":"7adc8c1a-645d-4476-bdef-5d6fb57f****",
    "source":"acs.oss",
    "specversion":"1.0",
    "type":"oss:ObjectCreated:PostObject",
    "datacontenttype":"application/json",
    "dataschema":"http://example.com/test.json",
    "subject":"acs:oss:cn-hangzhou:1234567:xls-papk/game_apk/123.jpg",
    "time":"2020-08-17T16:04:46.149Asia/Shanghai",
    "aliyuneventbusname":"demo-bus",
    "aliyunregionid":"Shanghai",
    "data":{
        "name":"test",
        "scope":100
    }
}

模板

  • 變量

    {
        "name":"$.data.name",
        "constant":"Please deal with it timely."
    }
    說明
    • JSONPath提取的值可以是變量,也可以是常量。

    • 定義變量不支持嵌套多層結(jié)構(gòu)。

    • value不超過10240個(gè)字符。

  • 模板

    The instance is broken,which name is ${name}, ${constant}
    說明

    template最大為10240字符。

The instance is broken,which name is test, Please deal with it timely.

您也可以創(chuàng)建String格式和JSON格式的模板,通過自定義模板將事件轉(zhuǎn)換成示例輸出,然后路由到事件目標(biāo)。以下為事件總線EventBridge支持的模板類型:

表 1. 簡(jiǎn)單String

轉(zhuǎn)換前的事件

轉(zhuǎn)換類型

轉(zhuǎn)換后的事件

{
    "id":"7adc8c1a-645d-4476-bdef-5d6fb57f****",
    "source":"acs.oss",
    "specversion":"1.0",
    "type":"oss:ObjectCreated:PostObject",
    "datacontenttype":"application/json",
    "dataschema":"http://example.com/test.json",
    "subject":"acs:oss:cn-hangzhou:1234567:xls-papk/game_apk/123.jpg",
    "time":"2020-08-17T16:04:46.149Asia/Shanghai",
    "aliyuneventbusname":"demo-bus",
    "aliyunregionid":"Shanghai",
    "data":{
        "name":"test",
        "state":"RUNNING"
    }
}

模板

  • 變量

    {
        "name":"$.data.name",
        "state":"$.data.state"
    }
  • 模板

    "name ${name} is in ${state}"
"name test is in RUNNING"

表 2. 簡(jiǎn)單JSON

轉(zhuǎn)換前的事件

轉(zhuǎn)換類型

轉(zhuǎn)換后的事件

{
    "id":"7adc8c1a-645d-4476-bdef-5d6fb57f****",
    "source":"acs.oss",
    "specversion":"1.0",
    "type":"oss:ObjectCreated:PostObject",
    "datacontenttype":"application/json",
    "dataschema":"http://example.com/test.json",
    "subject":"acs:oss:cn-hangzhou:1234567:xls-papk/game_apk/123.jpg",
    "time":"2020-08-17T16:04:46.149Asia/Shanghai",
    "aliyuneventbusname":"demo-bus",
    "aliyunregionid":"Shanghai",
    "data":{
        "name":"test",
        "state":"RUNNING"
    }
}

模板

  • 變量

    {
        "name":"$.data.name",
        "state":"$.data.state"
    }
  • 模板

    {
        "name":"${name}",
        "state":"${state}"
    }
{
    "name":"test",
    "state":"RUNNING"
}

表 3. 混合變量和常量的JSON

轉(zhuǎn)換前的事件

轉(zhuǎn)換類型

轉(zhuǎn)換后的事件

{
    "id":"7adc8c1a-645d-4476-bdef-5d6fb57f****",
    "source":"acs.oss",
    "specversion":"1.0",
    "type":"oss:ObjectCreated:PostObject",
    "datacontenttype":"application/json",
    "dataschema":"http://example.com/test.json",
    "subject":"acs:oss:cn-hangzhou:1234567:xls-papk/game_apk/123.jpg",
    "time":"2020-08-17T16:04:46.149Asia/Shanghai",
    "aliyuneventbusname":"demo-bus",
    "aliyunregionid":"Shanghai",
    "data":{
        "name":"test",
        "state":"RUNNING"
    }
}

模板

  • 變量

    {
        "name":"$.data.name",
        "state":"$.data.state"
    }
  • 模板

    {
        "name":"${name}",
        "state":[
            9,
            "${state}",
            true
        ],
        "Transformed":"Yes"
    }
{
    "name":"test",
    "state":[
        9,
        "RUNNING",
        true
    ],
    "Transformed":"Yes"
}

表 4. 嵌套JSON

轉(zhuǎn)換前的事件

轉(zhuǎn)換類型

轉(zhuǎn)換后的事件

{
    "id": "45ef4dewdwe1-7c35-447a-bd93-fab****",
    "source": "acs.imm",
    "specversion": "1.0",
    "subject": "acs.imm:cn-hangzhou:123456789098****:215672",
    "time": "2020-11-19T21:04:41+08:00",
    "type": "imm:FileMeta:Index",
    "aliyunaccountid": "123456789098****",
    "aliyunpublishtime": "2020-11-19T21:04:42.179PRC",
    "aliyuneventbusname": "default",
    "aliyunregionid": "cn-hangzhou",
    "aliyunpublishaddr": "172.25.XX.XX",
    "data": {
        "ProjectName": "test_project",
        "DatasetName": "test_dataset",
        "RequestId": "D2A3AE88-D17C-4CCC-B149-6651115C****",
        "StartTime": "2021-07-22T14:03:15.489885+08:00",
        "EndTime": "2021-07-22T14:05:15.489885+08:00",
        "Message": "InvalidParameter",
        "Success": false,
        "Files": [
            {
                "URI": "oss://bucket/file",
                "CustomId": "defaultId",
                "CustomLabels": {
                    "Key1": "Val1",
                    "Key2": "Val2"
                },
                "Error": "InternalError"
            }
        ]
    }
}

模板

  • 變量

    {   
        "ProjectName":"$.data.ProjectName",
        "Files":"$.data.Files"
    }
  • 模板

    {
        "ProjectName":"${ProjectName}",
        "Files":${Files}
    }
{  
    "ProjectName":"test_project",
  "Files": [
        {
            "URI": "oss://bucket/file",
            "CustomId": "defaultId",
            "CustomLabels": {
                "Key1": "Val1",
                "Key2": "Val2"
            },
            "Error": "InternalError"
        }
    ]
}

在模板中支持2個(gè)處理特殊字符的函數(shù)分別是jsonEscape和htmlEscape。

  • jsonEscape函數(shù)用于轉(zhuǎn)義JSON字符串中的特殊字符,防止嵌入的特殊字符破壞JSON格式。

    比如一個(gè)包含雙引號(hào)的變量:

    {
      "var" : "\"abc\""
    }

    在模板中使用jsonEscape函數(shù):

    {
      "text": "var is ${jsonEscape(var)}"
    }

    轉(zhuǎn)義后的輸出是:

    {
      "text": "var is \"abc\""
    }
  • htmlEscape函數(shù)用于轉(zhuǎn)義HTML特殊字符,特殊字符經(jīng)過轉(zhuǎn)義后,會(huì)變成普通字符串輸出,防止惡意腳本注入造成安全問題。

    比如一個(gè)含有HTML內(nèi)容的變量:

    {
      "var" : "<script>alert('unsafe');</script>"
    }

    可以在模板中使用htmlEscape函數(shù):

    <p>User Input: ${htmlEscape(var)}</p>

    轉(zhuǎn)義后的輸出是:

    <p>User Input: &lt;script&gt;alert('unsafe');&lt;/script&gt;</p>