更新时间:2023-12-13 GMT+08:00

FGS.ApigEventMap

模型说明

FGS.ApigEventMap元素用来创建函数工作流服务的APIG触发器资源,APIG触发器依赖API网关服务,需预先开通APIG服务,通过APIG事件触发函数执行。

模型属性

表1 模型定义属性说明

属性

是否必选

描述

protocol

请求协议

参数类型:string

取值说明:支持HTTP,HTTPS

默认值:HTTPS

取值约束:有效值为HTTP,HTTPS

使用建议:将该字段通过get_input函数传入,在AOS界面创建堆栈填写输入参数时可获取

name

APIG触发器的名称

参数类型:string

取值说明:用户自定义

取值约束:支持汉字,英文,数字,下划线,且只能以英文和汉字开头,3-24字符

使用建议:将该字段通过get_input函数传入,在AOS界面创建堆栈填写输入参数时可自动获取

apigroup_id

API组ID

参数类型:string

取值说明:该字段通过get_reference函数从HuaweiCloud.APIG.ApiGroup类型元素的refID字段自动获取,该字段必选

使用建议:采用默认配置

env_name

API发布环境名称

参数类型:string

取值说明:默认发布环境名称为"RELEASE",根据创建的API发布环境配置。

默认值:RELEASE

取值约束:目前仅可选RELEASE

sl_domain

子域名

参数类型:string

取值说明:该字段必选

使用建议:该字段通过get_attribute函数从HuaweiCloud.APIG.ApiGroup类型元素的slDomain字段获取。该字段需手动配置get_attribute函数

auth

安全认证类型

参数类型:string

取值说明:支持IAM, APP, NONE

默认值:IAM

取值约束:只能是如下取值 IAM | APP | NONE

使用建议:将该字段通过get_input函数传入,在AOS界面创建堆栈填写输入参数时可获取

timeout

后端超时时间

参数类型:integer

取值说明:后端超时API调用将被停止,超时时间单位为毫秒

默认值:5000

取值约束:范围1~60000毫秒

使用建议:将该字段通过get_input函数传入,在AOS界面创建堆栈填写输入参数时可获取

env_id

API发布环境ID

参数类型:string

取值说明:默认发布环境id为"DEFAULT_ENVIRONMENT_RELEASE_ID",根据创建的API发布环境配置。目前仅可选DEFAULT_ENVIRONMENT_RELEASE_ID

默认值:DEFAULT_ENVIRONMENT_RELEASE_ID

取值约束:目前仅可选DEFAULT_ENVIRONMENT_RELEASE_ID

funcId

函数urn

参数类型:string

使用建议:采用默认配置

关联关系

表2 关联关系说明

关系说明

关联节点

关联关系

APIG.ApiGroup

被包含关系

FGS.Function

输出

blueprint样例

tosca_definitions_version: huaweicloud_tosca_version_1_0
inputs:
  codeUrl:
    description: >-
      The address of the function code package on OBS. You need to upload the
      function code to OBS barrel in advance.
    label: Function
    type: string
  handler:
    default: index.handler
    description: >-
      The Execution Entry of the function. Default value is index. handler. It
      can be configured independently by code file name and entry function name.
    label: Function
    type: string
  memorySize:
    constraints:
      valid_values:
        - 128
        - 256
        - 512
        - 768
        - 1024
        - 1280
        - 1536
    default: 128
    description: The memory size of the function.
    label: Function
    type: integer
  name:
    constraints:
      regex: '^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$'
    default: image_watermark
    description: The name of the function.
    label: Function
    type: string
  runtime:
    constraints:
      valid_values:
        - Node.js6.10
        - Python2.7
        - Python3.6
        - Java8
        - Go1.8
        - Node.js8.10
    description: The runtime of the function.
    label: Function
    type: string
  timeout:
    constraints:
      in_range:
        - 3
        - 300
    default: 3
    description: The timeout of the function. The effective range is 3~300.
    label: Function
    type: integer
  xrole:
    description: The agency of the function. It should be created in advance.
    label: Function
    type: string
  api_name:
    constraints:
      regex: '^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$'
    description: The name of API.
    label: APIG trigger
    type: string
  apig_auth:
    default: IAM
    constraints:
      valid_values:
        - APP
        - IAM
        - NONE
    description: 'Security authentication type.Valid values are IAM, APP and NONE.'
    label: APIG trigger
    type: string
  apig_protocol:
    default: HTTPS
    constraints:
      valid_values:
        - HTTPS
        - HTTP
    description: Request protocol. Valid values are HTTP and HTTPS.
    label: APIG trigger
    type: string
  apig_timeout:
    default: 5000
    constraints:
      in_range:
        - 1
        - 60000
    description: Maximum time that the backend can run before it is killed in milliseconds.
    label: APIG trigger
    type: integer
  apig_group_name:
    description: API group name
    label: APIG
    type: string
node_templates:
  fgsf36en:
    properties:
      codeUrl:
        get_input: codeUrl
      handler:
        get_input: handler
      memorySize:
        get_input: memorySize
      name:
        get_input: name
      role:
        get_input: xrole
      runtime:
        get_input: runtime
      timeout:
        get_input: timeout
      code: ''
      codeType: obs
    type: HuaweiCloud.FGS.Function
  apiga246:
    type: HuaweiCloud.APIG.ApiGroup
    properties:
      name:
        get_input: apig_group_name
  fgsaet46:
    type: HuaweiCloud.FGS.ApigEventMap
    properties:
      protocol:
        get_input: apig_protocol
      name:
        get_input: api_name
      apigroup_id:
        get_reference: apiga246
      env_name: RELEASE
      sl_domain:
        get_attribute:
          - apiga246
          - slDomain
      auth:
        get_input: apig_auth
      timeout:
        get_input: apig_timeout
      env_id: DEFAULT_ENVIRONMENT_RELEASE_ID
      funcId:
        get_reference: fgsf36en
    requirements:
      - apigroup_id:
          node: apiga246
      - funcId:
          node: fgsf36en
outputs:
  function-urn:
    description: function URN
    value:
      get_attribute:
        - fgsf36en
        - refID
  api-group-name:
    description: api group name
    value:
      get_attribute:
        - apiga246
        - refName
  apig_trigger_info:
    description: APIG trigger info
    value:
      get_attribute:
        - fgsaet46
        - apigEventMap