sophon_tools component

更新时间:
复制 MD 格式

When you replicate a SOAR playbook to a different region, each region uses a different API domain. Without sophon_tools, you must update domain addresses in the playbook manually each time. The sophon_tools component resolves the correct API domain for the runtime region automatically, using a configurable region-to-domain mapping.

Actions

ActionDescription
getDomainByRegionLooks up the runtime region in domainMap and returns the corresponding domain. If no match is found, returns defaultDomain.

getDomainByRegion

How it works

When a playbook runs, getDomainByRegion checks the runtime service region against the entries in domainMap. The resolution logic is:

ConditionResult
Region found in domainMapReturns the mapped domain
Region not found, or domainMap is emptyReturns defaultDomain

This lets you define all region-to-domain mappings once and reuse the same playbook across regions without modification.

Currently only cn-shanghai and ap-southeast-1 are supported.

Parameters

ParameterTypeRequiredDescription
defaultDomainStringYesThe fallback domain returned when the runtime region has no entry in domainMap. Example: cn-shanghai.ecs.aliyun.com.
domainMapComplexYesRegion-to-domain mappings. Each entry maps a regionId to a domain.

`domainMap` format:

[
  {
    "fieldName": "cn-shanghai",
    "fieldValue": "cn-shanghai.ecs.aliyun.com"
  },
  {
    "fieldName": "ap-southeast-1",
    "fieldValue": "ap-southeast-1.ecs.aliyun.com"
  }
]

Configuration example

The following JSON defines a test playbook with a single getDomainByRegion action. Import it to explore the parameters interactively in the visualization flow editor.

Save the following content as a .json file before importing. For the import procedure, see Import playbooks.
{
    "cells": [
        {
            "position": {
                "x": -610,
                "y": -175
            },
            "size": {
                "width": 36,
                "height": 36
            },
            "attrs": {
                "body": {
                    "fill": "white",
                    "strokeOpacity": 0.95,
                    "stroke": "#63ba4d",
                    "strokeWidth": 2
                },
                "label": {
                    "text": "start",
                    "fontSize": 12,
                    "refX": 0.5,
                    "refY": "100%",
                    "refY2": 4,
                    "textAnchor": "middle",
                    "textVerticalAnchor": "top"
                },
                "path": {
                    "stroke": "#63ba4d"
                }
            },
            "visible": true,
            "shape": "circle",
            "id": "58d87b7d-28d9-4f0e-b135-4adc4f1a70e4",
            "zIndex": 1,
            "data": {
                "nodeType": "startEvent",
                "appType": "basic",
                "nodeName": "start",
                "icon": "icon-circle",
                "description": "The playbook start node. A playbook must have one and only one start node, which requires input data configuration for the playbook."
            },
            "markup": [
                {
                    "tagName": "circle",
                    "selector": "body"
                },
                {
                    "tagName": "text",
                    "selector": "label"
                }
            ],
            "isNode": true
        },
        {
            "shape": "custom-edge",
            "attrs": {
                "line": {
                    "stroke": "#63ba4d",
                    "targetMarker": {
                        "stroke": "#63ba4d"
                    }
                }
            },
            "zIndex": 1,
            "id": "5293c3f9-e1c9-4a49-b0eb-635067dc67e8",
            "data": {
                "nodeType": "sequenceFlow",
                "appType": "basic",
                "isRequired": true,
                "icon": "icon-upper-right-arrow"
            },
            "isNode": false,
            "source": {
                "cell": "58d87b7d-28d9-4f0e-b135-4adc4f1a70e4"
            },
            "target": {
                "cell": "822f61c0-8a34-4e7c-84a1-294c21b11cd6"
            },
            "router": {
                "name": "manhattan",
                "args": {
                    "padding": 5,
                    "excludeHiddenNodes": true,
                    "excludeNodes": [
                        "clone_node_id"
                    ]
                }
            },
            "vertices": [],
            "visible": true
        },
        {
            "position": {
                "x": -70,
                "y": -170
            },
            "size": {
                "width": 36,
                "height": 36
            },
            "attrs": {
                "body": {
                    "fill": "white",
                    "strokeOpacity": 0.95,
                    "stroke": "#63ba4d",
                    "strokeWidth": 2
                },
                "path": {
                    "r": 12,
                    "refX": "50%",
                    "refY": "50%",
                    "fill": "#63ba4d",
                    "strokeOpacity": 0.95,
                    "stroke": "#63ba4d",
                    "strokeWidth": 4
                },
                "label": {
                    "text": "end",
                    "fontSize": 12,
                    "refX": 0.5,
                    "refY": "100%",
                    "refY2": 4,
                    "textAnchor": "middle",
                    "textVerticalAnchor": "top"
                }
            },
            "visible": true,
            "shape": "circle",
            "id": "317dd1be-2d20-460e-977e-1fc936ffb583",
            "zIndex": 1,
            "data": {
                "nodeType": "endEvent",
                "appType": "basic",
                "nodeName": "end",
                "icon": "icon-radio-off-full",
                "description": "end"
            },
            "markup": [
                {
                    "tagName": "circle",
                    "selector": "body"
                },
                {
                    "tagName": "circle",
                    "selector": "path"
                },
                {
                    "tagName": "text",
                    "selector": "label"
                }
            ],
            "isNode": true
        },
        {
            "position": {
                "x": -420,
                "y": -190
            },
            "size": {
                "width": 137,
                "height": 66
            },
            "view": "react-shape-view",
            "attrs": {
                "label": {
                    "text": "sophon_tools_1"
                }
            },
            "shape": "activity",
            "id": "822f61c0-8a34-4e7c-84a1-294c21b11cd6",
            "data": {
                "componentName": "sophon_tools",
                "appType": "component",
                "nodeType": "action",
                "icon": "https://sophon-gen-v2.oss-cn-zhangjiakou.aliyuncs.com/componentUpload/1706772985014_sophon_tools_logo.png?Expires=1745635432&OSSAccessKeyId=STS.NXFP************&Signature=GAu8FWgRyY5cZeRQv1clIvWSZqw%3D&security-token=CAIS2AJ1q6Ft5B2yfSjIr5vzG87foZl22KyFUBLSokwYY%2Fh22qDsqTz2IHhMenFpAegcv%2Fw%2BlGFZ6%2F8elrp6SJtIXleCZtF94oxN9h2gb4fb4yUAIjSK0s%2FLI3OaLjKm9u2wCryLYbGwU%2FOpbE%2B%2B5U0X6LDmdDKkckW4OJmS8%2FBOZcgWWQ%2FKBlgvRq0hRG1YpdQdKGHaONu0LxfumRCwNkdzvRdmgm4NgsbWgO%2Fks0OP3AOrlrBN%2Bdiuf8T9NvMBZskvD42Hu8VtbbfE3SJq7BxHybx7lqQs%2B02c5onDWwAJu0%2FXa7uEo4wydVNjFbM9A65Dqufxn%2Fpgt%2Braj4X7xhhEIOVJSSPbSZBbSxJNvU1RXDxQVcEYWxylurjnXvF%2Bs5c2%2B8hAf0rM946UoJvc3YDI5hWbc8mJsTnhSSTAEIv%2By8ptqoFOtH7DkLTHWR7hCtv2306G8%2BSFMytAXxqAASheMaPI1EtW9vmzJTiUzI1Mpy%2FK1KMvL%2B5YrTITRTgQenkGkLFgTOTzW2VSuoF6w%2BpSA8UDTPnYZlyFlgELihq4wDNkqqrtUToxub0PrpMEESyGVIWbCAK0XljETFRtwl7eMM99EaqvKTN8r6%2Bhxw2xWIDH5k25760sl0KS5qaCIAA%3D",
                "ownType": "user",
                "zIndex": 1,
                "tenantId": "baba",
                "customInput": false,
                "description": "Obtains the domain based on the region configuration, using defaultDomain by default. Currently only supports ap-southeast-1 and cn-shanghai. The playbook execution layer will select the corresponding domain based on the runtime environment.",
                "id": 0,
                "name": "getDomainByRegion",
                "operateType": "general",
                "parameters": [
                    {
                        "dataType": "String",
                        "defaultValue": "",
                        "description": "Default domain address",
                        "enDescription": "",
                        "name": "defaultDomain",
                        "needCascader": false,
                        "required": true,
                        "tags": ""
                    },
                    {
                        "dataType": "Complex",
                        "defaultValue": "",
                        "description": "Domain address configuration information",
                        "enDescription": "",
                        "name": "domainMap",
                        "needCascader": false,
                        "required": true,
                        "tags": ""
                    }
                ],
                "riskLevel": 2,
                "nodeName": "sophon_tools_1",
                "actionName": "getDomainByRegion",
                "actionDisplayName": "getDomainByRegion",
                "cascaderValue": [],
                "valueData": {
                    "defaultDomain": "cn-hangzhou.ecs.aliyun.com",
                    "domainMap": "[{\"fieldName\":\"cn-hangzhou\",\"fieldValue\":\"cn-hangzhou.ecs.aliyun.com\"},{\"fieldName\":\"cn-shanghai\",\"fieldValue\":\"cn-shanghai.ecs.aliyun.com\"}]"
                },
                "status": "success"
            },
            "zIndex": 1
        },
        {
            "shape": "custom-edge",
            "attrs": {
                "line": {
                    "stroke": "#63ba4d",
                    "targetMarker": {
                        "stroke": "#63ba4d"
                    }
                }
            },
            "zIndex": 1,
            "id": "a614bb79-ff0e-4ed7-8064-ac9c5ad6835d",
            "data": {
                "nodeType": "sequenceFlow",
                "appType": "basic",
                "isRequired": true,
                "icon": "icon-upper-right-arrow"
            },
            "isNode": false,
            "router": {
                "name": "manhattan",
                "args": {
                    "padding": 5,
                    "excludeHiddenNodes": true,
                    "excludeNodes": [
                        "clone_node_id"
                    ]
                }
            },
            "source": {
                "cell": "822f61c0-8a34-4e7c-84a1-294c21b11cd6"
            },
            "target": {
                "cell": "317dd1be-2d20-460e-977e-1fc936ffb583"
            },
            "vertices": [],
            "visible": true
        }
    ]
}