Updated on 2023-12-13 GMT+08:00

FGS.ApigEventMap

Element Description

FGS.ApigEventMap is used to create APIG trigger resources for FunctionGraph. APIG triggers depend on the API Gateway service. Based on APIG trigger events, APIG triggers can trigger function execution.

Element Properties

Table 1 Property Description

Property

Required

Descripiton

protocol

Yes

Request protocol

Type: string

Value Description: Support HTTP, HTTPS

Default: HTTPS

Value Constraint: Valid values can only be HTTP or HTTPS

Suggestion: Use the get_input function to pass this parameter. Its value can then be automatically selected when you create a stack on the AOS console.

name

Yes

APIG trigger name

Type: string

Value Description: Supports customization

Value Constraint: You can only begin with english letters or chinese characters, and contain only letters, numbers, underlines, and middle scribe. 3-24 character.

Suggestion: Use the get_input function to pass this parameter. Its value can then be automatically selected when you create a stack on the AOS console.

apigroup_id

Yes

api group id.

Type: string

Value Description: The field is automatically retrieved from the refID field of HuaweiCloud.APIG.ApiGroup element by the get_reference function. The field must be selected.

Suggestion: Using the default configuration.

env_name

Yes

The name of API publishing environment.

Type: string

Value Description: The default publishing environment name is "RELEASE", and the API publishing environment configuration based on the created API environment.

Default: RELEASE

Value Constraint: Valid values can only be "RELEASE".

sl_domain

Yes

Sub domain.

Type: string

Value Description: The field must be selected.

Suggestion: The field is automatically retrieved from the slDomain field of type HuaweiCloud.APIG.ApiGroup element by the get_attribute function. The field needs to manually configure the get_attribute function.

auth

Yes

Security authentication type.

Type: string

Value Description: Support IAM, APP, NONE

Default: IAM

Value Constraint: Valid values can only be IAM, APP, NONE.

Suggestion: Use the get_input function to import this field. The value can be obtained on the AOS page.

timeout

Yes

Maximum time that the backend can run before it is killed in milliseconds.

Type: integer

Value Description: If the backend timeout, the API call will be stopped. The unit of timeout is millisecond.

Default: 5000

Value Constraint: The value ranges from 1 to 60000.

Suggestion: Use the get_input function to import this field. The value can be obtained on the AOS page.

env_id

Yes

API publishing environment id.

Type: string

Value Description: The default publishing environment id is "DEFAULT_ENVIRONMENT_RELEASE_ID", and the API publishing environment configuration based on the created API environment.

Default: DEFAULT_ENVIRONMENT_RELEASE_ID

Value Constraint: Valid values can only be "DEFAULT_ENVIRONMENT_RELEASE_ID".

funcId

Yes

function urn.

Type: string

Value Description: The field is automatically retrieved from the refID field of type HuaweiCloud.FGS.Function element by the get_reference function. The field must be selected.

Suggestion: Using the default configuration.

Relationships Between Elements

Table 2 Relationship description

Description

Target

Connected

APIG.ApiGroup

ContainedIn

FGS.Function

Return Value

None.

Blueprint Example

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