
# 查询华为云算子模板详情-GetActionTemplate
#### 功能介绍
本接口用于按名称查询Action模板。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限。
如果使用角色与策略授权，具体权限要求请参见[权限及授权项说明](https://support.huaweicloud.com/api-dwr/dwr_07_0050.html)。
#### URI
GET /v3/{project_id}/actiontemplate/{template_name}
#### 请求消息样式
```
GET /v2/actiontemplates/{template_name} HTTP/1.1
Host: obs.cn-north-4.myhuaweicloud.com 
Authorization: authorization
Content-Type: application/json
Content-Length: length
Date: date
```
#### 请求消息参数
表1请求参数 
| 名称            | 是否必选 | 参数类型   | 说明                                                                                                                                                    | 约束                                           |
|:---|:---|:---|:---|:---|
| template_name | 是    | String | Action模板名称，默认内置的枚举值有：[内置Action模板名](https://support.huaweicloud.com/api-dwr/dwr_04_0122.html#dwr_04_0122__zh-cn_topic_0272882628_table11855202184517)。 | 名称必须以字母或数字开头，只能由字母、数字、下划线和中划线组成，长度小于等于64个字符。 |
   
#### 请求消息头
该请求使用公共消息头，具体参见[表3](https://support.huaweicloud.com/api-dwr/dwr_07_0008.html#dwr_07_0008__zh-cn_topic_0121682347_table1986821153312)。
#### 请求消息元素
该请求消息中不使用消息元素。
#### 响应消息样式
```
HTTP/1.1 status_code 
Date: date 
Content-Length: length 
X-Request-ID: obs request id
json body
```
#### 响应消息头
该请求的响应消息使用公共消息头，具体请参考[响应消息头](https://support.huaweicloud.com/api-dwr/dwr_07_0011.html#dwr_07_0011__zh-cn_topic_0170155703_zh-cn_topic_0113746487_section61333484715)。
#### 响应消息元素
表2响应消息元素 
| 名称               | 参数类型                                                                               | 说明           |
|:---|:---|:---|
| provided_actions | Array of [ProvidedAction] | 可选的Action列表。 |
   
 表3ProvidedAction参数说明 
| 名称                        | 是否必选 | 参数类型                                                                                                                             | 说明          |
|:---|:---|:---|:---|
| name                      | 是    | String                                                                                                                           | Action模板名称。 |
| category                  | 是    | String                                                                                                                           | 分类。         |
| create_time               | 是    | String                                                                                                                           | 创建时间。       |
| last_modify_time          | 否    | String                                                                                                                           | 最近修改时间。     |
| function_template         | 是    | String                                                                                                                           | 函数的URN。     |
| inputs                    | 否    | Array of [Input](https://support.huaweicloud.com/api-dwr/dwr_04_0122.html#dwr_04_0122__zh-cn_topic_0272882628_table285619212450) | 可修改参数定义列表。  |
| dynamic_source_definition | 是    | Map                                                                                                                              | 可修改参数引用。    |
| need_policy               | 是    | [Policy]                                                                | 需要的权限。      |
| provider                  | 是    | String                                                                                                                           | 提供方。        |
| description               | 否    | String                                                                                                                           | 描述。         |
   
 表4Policy参数说明 
| 名称        | 参数类型                                                                          | 说明                                                                                                                                                                                                                                                                                                                                                                                                                                |
|:---|:---|:---|
| version   | String                                                                        | 权限版本号。 - 1.0：系统预置的角色。以服务为粒度，提供有限的服务相关角色用于授权。  - 1.1：策略。IAM最新提供的一种细粒度授权的能力，可以精确到具体服务的操作、资源以及请求条件等。   |
| statement | Array of [Statement] | 授权语句，描述权限的具体内容。                                                                                                                                                                                                                                                                                                                                                                                                                   |
   
 表5Statement参数说明 
| 名称       | 参数类型         | 说明                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
|:---|:---|:---|
| action   | Array String | 授权项。指对资源的具体操作权限，不超过100个。 - 格式为：服务名:资源类型:操作，例：vpc:ports:create。  - 服务名为产品名称，例如ecs、evs和vpc等，服务名仅支持小写。 资源类型和操作没有大小写，要求支持通配符号\*，无需罗列全部授权项。  - 当自定义策略为委托自定义策略时，该字段值为：*"Action": \["iam:agencies:assume"\]*。                                              |
| resource | Array String | 资源。数组长度不超过10，每个字符串长度不超过128，规则如下： - 可填 \* 的五段式：::::，例："obs:::bucket:\*"。  - region字段为\*或用户可访问的region。service必须存在且resource属于对应service。  - 当该自定义策略为委托自定义策略时，该字段类型为Object，值为：*"Resource": {"uri": \["/iam/agencies/07805acaba800fdd4fbdc00b8f888c7c"\]}*。   |
   
#### 错误响应消息
无特殊错误，所有错误已经包含在[错误码](https://support.huaweicloud.com/api-dwr/ErrorCode_0.html)中。
#### 请求示例
```
GET /v2/actiontemplates/{template_name} HTTP/1.1
Host: obs.cn-north-4.myhuaweicloud.com 
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:sc2PM13Wlfcoc/YZLK0MwsI2Zpo=
Content-Type: application/json
Content-Length: 0
Date: Thu, 27 Aug 2020 12:38:10 GMT
```
#### 响应示例
```
HTTP/1.1 200 OK 
Date: Thu, 27 Aug 2020 12:38:10 GMT 
Content-Length: 0 
Content-Type: application/json
X-Request-ID: 6a63a18b8bab40ffb71ebd9cb80d0085
{
    "provided_actions": {
        "created_time": "<timestamp>",
        "last_modify_time": "<timestamp>",
        "name": "<template_name>",
        "category": "<category>",
        "provider_domainid": "<domainid>",
        "provider_userid": "<userid>",
        "provider_name": "<name>",
        "function_template": "urn:fss:cn-north-5:3f1e6caf808246c68457e660e4bfeb2f:function:default:test",
        "inputs": [{
            "parameter_name": "param1",
            "default": "TCP",
            "type": "string",
            "label": "action1",
            "constraints": {
                "valid_values": ["TCP", "UDP"]
            },
            "invisible": true,
            "description": "description param1"
        }],
        "dynamic_source_definition": {
            "param1": {
                "get_input": "$.inputs.param1"
            },
            "param2": {
                "get_input": "$.inputs.param2"
            }
        },
        "need_policy": {
            "version": "1.1",
            "statement": [{
                "action": [
                    "FunctionGraph:function:invokeAsync",
                    "FunctionGraph:function:invoke",
                    "FunctionGraph:function:updateCode",
                    "FunctionGraph:function:updateConfig",
                    "FunctionGraph:function:create",
                    "FunctionGraph:function:getConfig",
                    "FunctionGraph:function:getCode"
                ],
                "resource": ["FunctionGraph:*:*:function:*"]
            }, {
                "action": ["MPC:*:*:mpc:*"]
            }]
        },
        "description": ""
    }
}
```
