上一主题: unlock 方法(template 对象)下一主题: put_acl 方法(template 对象)


get_acl 方法(template 对象)
说明

检索模板 ACL,或检索模板 ACL 中与特定主体相关的部分。

语法
/api/v2/template/get_acl?template=template&principal=<principal>&vdc=controller-name 
参数
模板

模板的名称

principal

URL 编码的主体

vdc

目标虚拟数据中心的名称

事务类型

同步

请求类型

GET

示例:检索应用 ACL

检索模板 VDS_CentOS 的应用 ACL。

GET http://192.168.123.200/api/v2/template/get_acl?template=VDS_CentOS&principal=&vdc=mygrid 
样例输出
XML:

<acl>
  <entries>
    <entry>
      <configure>1</configure>
      <id>778fee4e-9b83-4160-8b79-8bb0e1a87af8</id>
    </entry>
  </entries>
  <owner>
    <id></id>
  </owner>
</acl>

JSON:

{
   "acl" : {
      "owner" : {
         "id" : ""
      },
      "entries" : [
         {
            "configure" : 1,
            "id" : "778fee4e-9b83-4160-8b79-8bb0e1a87af8"
         }
      ]
   }
}

示例:显示主体的 ACL 数据

显示模板 VDS_CentOS 的主体 local:user:api@3tera.com 的 ACL 数据

GET http://192.168.123.200/api/v2/template/get_acl?template=VDS_CentOS&principal=local%3Auser%3Aapi%403tera.com&vdc=mygrid
样例输出

XML:

<acl>
  <entries>
    <entry>
      <configure>1</configure>
      <id>778fee4e-9b83-4160-8b79-8bb0e1a87af8</id>
    </entry>
  </entries>
  <owner>
    <id></id>
  </owner>
</acl>

JSON:

{
   "acl" : {
      "owner" : {
         "id" : ""
      },
      "entries" : [
         {
            "configure" : 1,
            "id" : "778fee4e-9b83-4160-8b79-8bb0e1a87af8"
         }
      ]
   }
}

HTTP 错误代码
400

未找到实体 vdc mygrid-WS_API 应用中没有配置指定的 VDC 名称。

400.4

缺少必需参数 (template)

-缺少参数 app=app

缺少必需参数 (principal)

-缺少参数 principal=principal

404.1

未找到实体-应用 test 不存在。

-指定的模板在 mygrid 上不存在。

未找到实体-无法检索应用 ACL-ACL 不包含主体本地用户“test@3tera.com”。

-指定的主体无效

注意:此 API 可用于 WS_API_r6-1.0.6-1 及更高版本。