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

FGS.ObsEventMap

Element Description

HuaweiCloud.FGS.ObsEventMap is used to create Object Storage Service (OBS) trigger resources for FunctionGraph. OBS triggers depend on the OBS service. Based on OBS trigger events, OBS triggers can trigger function execution.

Element Properties

Table 1 Property Description

Property

Required

Descripiton

filter

No

OBS filter. Decide on which OBS objects will the events can trigger the function. Optional for OBS eventSource.

Type: FGS.OBSFilter

Value Description: If you need to configure filter rules, the field must be selected. If filter rules are not configured, the field does not need to be configured..

Default: {u'object': {u'filterRules': []}}

Suggestion: Use the get_input function to import filter value. The value can be automatically selected on the AOS page.

eventType

Yes

OBS triggering event list.

Type: string Array

Value Description: The field is a list type, and the field is selected. The optional value should be in accordance with the OBS service regulations. For example: ["ObjectCreated:*", "ObjectRemoved:*"]

Value Constraint: The field must be selected. The field is a list type, and the valid value is ["ObjectCreated:*", "ObjectCreated:Put", "ObjectCreated:Post", "ObjectCreated:Copy", "ObjectCreated:CompleteMultipartUpload", "ObjectRemoved:*", "ObjectRemoved:Delete", "ObjectRemoved:DeleteMarkerCreated"]

Suggestion: You are advised to enter ["ObjectCreated:*", "ObjectRemoved:*"]

bucketName

Yes

OBS bucket name.

Type: string

Value Description: The field is automatically retrieved from the refName field of type HuaweiCloud.OBS.Bucket element by the get_reference function. It is necessary to ensure that the OBS bucket name is unique under the same namespace. The field must be selected.

Suggestion: Using the default configuration.

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

OBS.Bucket

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
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
  fgsoe4tm:
    type: HuaweiCloud.FGS.ObsEventMap
    properties:
      eventType:
        - 'ObjectCreated:*'
        - 'ObjectRemoved:*'
      bucketName:
        get_reference: obsb17cb
      funcId:
        get_reference: fgsf36en
    requirements:
      - bucketName:
          node: obsb17cb
      - funcId:
          node: fgsf36en
  obsb17cb:
    type: HuaweiCloud.OBS.Bucket
    properties:
      acl: private
outputs:
  function-urn:
    description: function URN
    value:
      get_attribute:
        - fgsf36en
        - refID
  bucket-name:
    description: OBS bucket name
    value:
      get_attribute:
        - obsb17cb
        - refName
  obs_trigger_info:
    description: OBS trigger info
    value:
      get_attribute:
        - fgsoe4tm
        - obsEventMap