文档目录

项目管理相关接口

创建项目(CreateIAM2Project)

API请求

URLs
POST zstack/v1/iam2/projects
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "project",
    "attributes": [
      {
        "name": "some-attribute-name",
        "value": "attribute-value"
      }
    ],
    "resourceTemplates": [
      "{\n  \"name\": \"sgName\",\n  \"resourceType\": \"SecurityGroupVO\"\n}"
    ],
    "organizationUuid": "50ce7e8c3b5f36c5b7ae528349364968"
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"project","attributes":[{"name":"some-attribute-name","value":"attribute-value"}],"resourceTemplates":["{\n  \"name\": \"sgName\",\n  \"resourceType\": \"SecurityGroupVO\"\n}"],"organizationUuid":"50ce7e8c3b5f36c5b7ae528349364968"}}' http://localhost:8080/zstack/v1/iam2/projects
参数列表
名字 类型 位置 描述 可选值 起始版本
name String body(包含在params结构中) 资源名称 2.4.0
description (可选) String body(包含在params结构中) 资源的详细描述 2.4.0
attributes (可选) List body(包含在params结构中) 2.4.0
resourceUuid (可选) String body(包含在params结构中) 2.4.0
systemTags (可选) List body 2.4.0
userTags (可选) List body 2.4.0
quota (可选) Map body(包含在params结构中) 2.4.0
roleUuids (可选) List body(包含在params结构中) 2.4.0
resourceTemplates (可选) List body(包含在params结构中) 资源模板 4.4.0
organizationUuid (可选) String body(包含在params结构中) 组织uuid 4.4.0
tagUuids (可选) List body(包含在params结构中) 标签UUID列表 4.4.0

API返回

返回示例
{
  "inventory": {
    "uuid": "154643938783465e9899fd2617446a62",
    "name": "project",
    "state": "Enabled"
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 2.4.0
inventory IAM2ProjectInventory 详情参考inventory 2.4.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 2.4.0
description String 错误的概要描述 2.4.0
details String 错误的详细信息 2.4.0
elaboration String 保留字段,默认为null 2.4.0
opaque LinkedHashMap 保留字段,默认为null 2.4.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 2.4.0
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.4.0
name String 资源名称 2.4.0
description String 资源的详细描述 2.4.0
createDate Timestamp 创建时间 2.4.0
lastOpDate Timestamp 最后一次修改时间 2.4.0
linkedAccountUuid String 2.4.0
state ProjectState 详情参考state 2.4.0
attributes List 详情参考attributes 2.4.0
#state
名字 类型 描述 起始版本
name String 资源名称 2.4.0
ordinal int 2.4.0
#attributes
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.4.0
name String 资源名称 2.4.0
value String 2.4.0
type AttributeType 详情参考type 2.4.0
#type
名字 类型 描述 起始版本
name String 资源名称 2.4.0
ordinal int 2.4.0

SDK示例

Java SDK
CreateIAM2ProjectAction action = new CreateIAM2ProjectAction();
action.name = "project";
action.attributes = asList([name:some-attribute-name, value:attribute-value]);
action.resourceTemplates = asList("{
  "name": "sgName",
  "resourceType": "SecurityGroupVO"
}");
action.organizationUuid = "50ce7e8c3b5f36c5b7ae528349364968";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateIAM2ProjectAction.Result res = action.call();
Python SDK
CreateIAM2ProjectAction action = CreateIAM2ProjectAction()
action.name = "project"
action.attributes = [[name:some-attribute-name, value:attribute-value]]
action.resourceTemplates = [{
  "name": "sgName",
  "resourceType": "SecurityGroupVO"
}]
action.organizationUuid = "50ce7e8c3b5f36c5b7ae528349364968"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateIAM2ProjectAction.Result res = action.call()

从模版创建IAM2项目(CreateIAM2ProjectFromTemplate)

API请求

URLs
POST zstack/v1/iam2/projects/from/templates/{templateUuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "project",
    "organizationUuid": "589ddc9593ea3d378fd34623ee243b55"
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST d '{"params":{"name":"project","organizationUuid":"589ddc9593ea3d378fd34623ee243b55"}}' http://localhost:8080/zstack/v1/iam2/projects/from/templates/adff5802786439228aaf60d8a53f7f93
参数列表
名字 类型 位置 描述 可选值 起始版本
name String body(包含在params结构中) 资源名称 2.4.0
description (可选) String body(包含在params结构中) 资源的详细描述 2.4.0
templateUuid String url 2.4.0
resourceUuid (可选) String body(包含在params结构中) 2.4.0
systemTags (可选) List body 2.4.0
userTags (可选) List body 2.4.0
roleUuids (可选) List body(包含在params结构中) 2.4.0
organizationUuid (可选) String body(包含在params结构中) 组织uuid 4.4.0
tagUuids (可选) List body(包含在params结构中) 标签UUID列表 4.4.0

API返回

返回示例
{
  "inventory": {
    "uuid": "31bede78c8b748d1b2ac8ea058135bb4",
    "name": "project",
    "state": "Enabled"
  }
}
名字 类型 描述 起始版本
success boolean 0.6
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 2.4.0
inventory IAM2ProjectInventory 详情参考inventory 2.4.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 2.4.0
description String 错误的概要描述 2.4.0
details String 错误的详细信息 2.4.0
elaboration String 保留字段,默认为null 2.4.0
opaque LinkedHashMap 保留字段,默认为null 2.4.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 2.4.0
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.4.0
name String 资源名称 2.4.0
description String 资源的详细描述 2.4.0
createDate Timestamp 创建时间 2.4.0
lastOpDate Timestamp 最后一次修改时间 2.4.0
linkedAccountUuid String 2.4.0
state ProjectState 详情参考state 2.4.0
attributes List 详情参考attributes 2.4.0
#state
名字 类型 描述 起始版本
name String 资源名称 2.4.0
ordinal int 2.4.0
#attributes
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.4.0
name String 资源名称 2.4.0
value String 2.4.0
type AttributeType 详情参考type 2.4.0
#type
名字 类型 描述 起始版本
name String 资源名称 2.4.0
ordinal int 2.4.0

SDK示例

Java SDK
CreateIAM2ProjectFromTemplateAction action = new CreateIAM2ProjectFromTemplateAction();
action.name = "project";
action.templateUuid = "adff5802786439228aaf60d8a53f7f93";
action.organizationUuid = "589ddc9593ea3d378fd34623ee243b55";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateIAM2ProjectFromTemplateAction.Result res = action.call();
Python SDK
CreateIAM2ProjectFromTemplateAction action = CreateIAM2ProjectFromTemplateAction()
action.name = "project"
action.templateUuid = "adff5802786439228aaf60d8a53f7f93"
action.organizationUuid = "589ddc9593ea3d378fd34623ee243b55"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateIAM2ProjectFromTemplateAction.Result res = action.call()

删除项目(DeleteIAM2Project)

API请求

URLs
DELETE zstack/v1/iam2/projects/{uuid}?deleteMode={deleteMode}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/iam2/projects/fffc7e1b2a983029833d1ab52bfa8187?deleteMode=Permissive
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 2.4.0
deleteMode (可选) String url 2.4.0
systemTags (可选) List body 2.4.0
userTags (可选) List body 2.4.0

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK示例

Java SDK
DeleteIAM2ProjectAction action = new DeleteIAM2ProjectAction();
action.uuid = "fffc7e1b2a983029833d1ab52bfa8187";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteIAM2ProjectAction.Result res = action.call();
Python SDK
DeleteIAM2ProjectAction action = DeleteIAM2ProjectAction()
action.uuid = "fffc7e1b2a983029833d1ab52bfa8187"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteIAM2ProjectAction.Result res = action.call()

查询项目(QueryIAM2Project)

API请求

URLs
GET zstack/v1/iam2/projects
GET zstack/v1/iam2/projects/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/iam2/projects?q=name=test
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/iam2/projects/834affbf924e354f97ad0f47ff95d27d

可查询字段

运行CLI命令行工具,输入QueryIAM2Project并按Tab键查看所有可查询字段以及可跨表查询的资源名。

API返回

返回示例
{
  "inventories": [
    {
      "uuid": "daa77ad8d7af42cbadc88950cb85abe4",
      "name": "project",
      "state": "Enabled"
    }
  ]
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 2.4.0
inventories List 详情参考inventories 2.4.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 2.4.0
description String 错误的概要描述 2.4.0
details String 错误的详细信息 2.4.0
elaboration String 保留字段,默认为null 2.4.0
opaque LinkedHashMap 保留字段,默认为null 2.4.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 2.4.0
#inventories
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.4.0
name String 资源名称 2.4.0
description String 资源的详细描述 2.4.0
createDate Timestamp 创建时间 2.4.0
lastOpDate Timestamp 最后一次修改时间 2.4.0
linkedAccountUuid String 2.4.0
state ProjectState 详情参考state 2.4.0
attributes List 详情参考attributes 2.4.0
#state
名字 类型 描述 起始版本
name String 资源名称 2.4.0
ordinal int 2.4.0
#attributes
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.4.0
name String 资源名称 2.4.0
value String 2.4.0
type AttributeType 详情参考type 2.4.0
#type
名字 类型 描述 起始版本
name String 资源名称 2.4.0
ordinal int 2.4.0

SDK示例

Java SDK
QueryIAM2ProjectAction action = new QueryIAM2ProjectAction();
action.conditions = asList("name=test");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryIAM2ProjectAction.Result res = action.call();
Python SDK
QueryIAM2ProjectAction action = QueryIAM2ProjectAction()
action.conditions = ["name=test"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryIAM2ProjectAction.Result res = action.call()

更新项目(UpdateIAM2Project)

API请求

URLs
PUT zstack/v1/iam2/projects/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateIAM2Project": {
    "name": "new-name"
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateIAM2Project":{"name":"new-name"}}' http://localhost:8080/zstack/v1/iam2/projects/63f57ce8c8013d56ac4df307cfb1c648/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 2.4.0
name (可选) String body(包含在updateIAM2Project结构中) 资源名称 2.4.0
description (可选) String body(包含在updateIAM2Project结构中) 资源的详细描述 2.4.0
systemTags (可选) List body 2.4.0
userTags (可选) List body 2.4.0

API返回

返回示例
{
  "inventory": {
    "uuid": "41d47db9cb0040edabe5823e1fff0c0e",
    "name": "project",
    "state": "Enabled"
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 2.4.0
inventory IAM2ProjectInventory 详情参考inventory 2.4.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 2.4.0
description String 错误的概要描述 2.4.0
details String 错误的详细信息 2.4.0
elaboration String 保留字段,默认为null 2.4.0
opaque LinkedHashMap 保留字段,默认为null 2.4.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 2.4.0
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.4.0
name String 资源名称 2.4.0
description String 资源的详细描述 2.4.0
createDate Timestamp 创建时间 2.4.0
lastOpDate Timestamp 最后一次修改时间 2.4.0
linkedAccountUuid String 2.4.0
state ProjectState 详情参考state 2.4.0
attributes List 详情参考attributes 2.4.0
#state
名字 类型 描述 起始版本
name String 资源名称 2.4.0
ordinal int 2.4.0
#attributes
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.4.0
name String 资源名称 2.4.0
value String 2.4.0
type AttributeType 详情参考type 2.4.0
#type
名字 类型 描述 起始版本
name String 资源名称 2.4.0
ordinal int 2.4.0

SDK示例

Java SDK
UpdateIAM2ProjectAction action = new UpdateIAM2ProjectAction();
action.uuid = "63f57ce8c8013d56ac4df307cfb1c648";
action.name = "new-name";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateIAM2ProjectAction.Result res = action.call();
Python SDK
UpdateIAM2ProjectAction action = UpdateIAM2ProjectAction()
action.uuid = "63f57ce8c8013d56ac4df307cfb1c648"
action.name = "new-name"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateIAM2ProjectAction.Result res = action.call()

登录项目(LoginIAM2Project)

API请求

URLs
PUT zstack/v1/iam2/projects/login
Headers
Authorization: OAuth the-session-uuid
Body
{
  "loginIAM2Project": {
    "projectName": "project"
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"loginIAM2Project":{"projectName":"project"}}' http://localhost:8080/zstack/v1/iam2/projects/login
参数列表
名字 类型 位置 描述 可选值 起始版本
projectName String body(包含在loginIAM2Project结构中) 2.4.0
clientInfo (可选) Map body(包含在loginIAM2Project结构中) 客户端信息 3.5.0
systemTags (可选) List body 2.4.0
userTags (可选) List body 2.4.0

API返回

返回示例
{
  "inventory": {
    "uuid": "3357cccd4d1436748a1721d5e12f2fcd",
    "noSessionEvaluation": false
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 2.4.0
inventory SessionInventory 详情参考inventory 2.4.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 2.4.0
description String 错误的概要描述 2.4.0
details String 错误的详细信息 2.4.0
elaboration String 保留字段,默认为null 2.4.0
opaque LinkedHashMap 保留字段,默认为null 2.4.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 2.4.0
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.4.0
accountUuid String 账户UUID 2.4.0
userUuid String 用户UUID 2.4.0
expiredDate Timestamp 2.4.0
createDate Timestamp 创建时间 2.4.0

SDK示例

Java SDK
LoginIAM2ProjectAction action = new LoginIAM2ProjectAction();
action.projectName = "project";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
LoginIAM2ProjectAction.Result res = action.call();
Python SDK
LoginIAM2ProjectAction action = LoginIAM2ProjectAction()
action.projectName = "project"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
LoginIAM2ProjectAction.Result res = action.call()

设置项目登陆限制(SetIAM2ProjectLoginExpired)

API请求

URLs
PUT zstack/v1/iam2/projects/add/login-expired/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "setIAM2ProjectLoginExpired": {
    "loginExpired": "allow 1/59 * * * * ? * to 30/59 * * * * ? *"
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"setIAM2ProjectLoginExpired":{"loginExpired":"allow 1/59 * * * * ? * to 30/59 * * * * ? *"}}' http://localhost:8080/zstack/v1/iam2/projects/add/login-expired/6b2eb879751736389b66649f98f3e29b/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 4.3.0
loginExpired Map body(包含在setIAM2ProjectLoginExpired结构中) 表达式 4.3.0
systemTags (可选) List body 系统标签 4.3.0
userTags (可选) List body 用户标签 4.3.0

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK示例

Java SDK
SetIAM2ProjectLoginExpiredAction action = new SetIAM2ProjectLoginExpiredAction();
action.uuid = "6b2eb879751736389b66649f98f3e29b";
action.loginExpired = "allow 1/59 * * * * ? * to 30/59 * * * * ? *";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SetIAM2ProjectLoginExpiredAction.Result res = action.call();
Python SDK
SetIAM2ProjectLoginExpiredAction action = SetIAM2ProjectLoginExpiredAction()
action.uuid = "6b2eb879751736389b66649f98f3e29b"
action.loginExpired = "allow 1/59 * * * * ? * to 30/59 * * * * ? *"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SetIAM2ProjectLoginExpiredAction.Result res = action.call()

删除项目限制登陆(RemoveIAM2ProjectLoginExpired)

API请求

URLs
PUT zstack/v1/iam2/projects/remove/login-expired/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "removeIAM2ProjectLoginExpired": {
    "attributeUuid": "f386055bea993b6c88d39d33fe133c44"
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"removeIAM2ProjectLoginExpired":{"attributeUuid":"f386055bea993b6c88d39d33fe133c44"}}' http://localhost:8080/zstack/v1/iam2/projects/remove/login-expired/b81a99d69d77366d8b1bba254aa02e0a/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 4.3.0
attributeUuid Map body(包含在removeIAM2ProjectLoginExpired结构中) 4.3.0
systemTags (可选) List body 系统标签 4.3.0
userTags (可选) List body 用户标签 4.3.0

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK示例

Java SDK
RemoveIAM2ProjectLoginExpiredAction action = new RemoveIAM2ProjectLoginExpiredAction();
action.uuid = "b81a99d69d77366d8b1bba254aa02e0a";
action.attributeUuid = "f386055bea993b6c88d39d33fe133c44";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemoveIAM2ProjectLoginExpiredAction.Result res = action.call();
Python SDK
RemoveIAM2ProjectLoginExpiredAction action = RemoveIAM2ProjectLoginExpiredAction()
action.uuid = "b81a99d69d77366d8b1bba254aa02e0a"
action.attributeUuid = "f386055bea993b6c88d39d33fe133c44"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RemoveIAM2ProjectLoginExpiredAction.Result res = action.call()

修改项目状态(ChangeIAM2ProjectState)

API请求

URLs
PUT zstack/v1/iam2/projects/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "changeIAM2ProjectState": {
    "stateEvent": "enable"
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changeIAM2ProjectState":{"stateEvent":"enable"}}' http://localhost:8080/zstack/v1/iam2/projects/13096969d0093f76802126ca15d9ac9c/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 2.4.0
stateEvent StateEvent body(包含在changeIAM2ProjectState结构中)
  • enable
  • disable
2.4.0
systemTags (可选) List body 2.4.0
userTags (可选) List body 2.4.0

API返回

返回示例
{
  "inventory": {
    "uuid": "21fc3599223d46ddb5d065f6bf674a70",
    "name": "project",
    "state": "Enabled"
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 2.4.0
inventory IAM2ProjectInventory 详情参考inventory 2.4.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 2.4.0
description String 错误的概要描述 2.4.0
details String 错误的详细信息 2.4.0
elaboration String 保留字段,默认为null 2.4.0
opaque LinkedHashMap 保留字段,默认为null 2.4.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 2.4.0
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.4.0
name String 资源名称 2.4.0
description String 资源的详细描述 2.4.0
createDate Timestamp 创建时间 2.4.0
lastOpDate Timestamp 最后一次修改时间 2.4.0
linkedAccountUuid String 2.4.0
state ProjectState 详情参考state 2.4.0
attributes List 详情参考attributes 2.4.0
#state
名字 类型 描述 起始版本
name String 资源名称 2.4.0
ordinal int 2.4.0
#attributes
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.4.0
name String 资源名称 2.4.0
value String 2.4.0
type AttributeType 详情参考type 2.4.0
#type
名字 类型 描述 起始版本
name String 资源名称 2.4.0
ordinal int 2.4.0

SDK示例

Java SDK
ChangeIAM2ProjectStateAction action = new ChangeIAM2ProjectStateAction();
action.uuid = "13096969d0093f76802126ca15d9ac9c";
action.stateEvent = "enable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeIAM2ProjectStateAction.Result res = action.call();
Python SDK
ChangeIAM2ProjectStateAction action = ChangeIAM2ProjectStateAction()
action.uuid = "13096969d0093f76802126ca15d9ac9c"
action.stateEvent = "enable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ChangeIAM2ProjectStateAction.Result res = action.call()

从项目移除成员(RemoveIAM2VirtualIDsFromProject)

API请求

URLs
DELETE zstack/v1/iam2/projects/{projectUuid}/virtual-ids?virtualIDUuids={virtualIDUuids}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/iam2/projects/bd9eaf0cc58e3ffb8792922633be41d6/virtual-ids?virtualIDUuids=e1bc00e294e430069d37c620583ed9fd&virtualIDUuids=28852db42801373ba539eb67387e7658
参数列表
名字 类型 位置 描述 可选值 起始版本
projectUuid String url 2.4.0
virtualIDUuids List url 2.4.0
systemTags (可选) List body 2.4.0
userTags (可选) List body 2.4.0

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK示例

Java SDK
RemoveIAM2VirtualIDsFromProjectAction action = new RemoveIAM2VirtualIDsFromProjectAction();
action.projectUuid = "bd9eaf0cc58e3ffb8792922633be41d6";
action.virtualIDUuids = asList("e1bc00e294e430069d37c620583ed9fd","28852db42801373ba539eb67387e7658");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemoveIAM2VirtualIDsFromProjectAction.Result res = action.call();
Python SDK
RemoveIAM2VirtualIDsFromProjectAction action = RemoveIAM2VirtualIDsFromProjectAction()
action.projectUuid = "bd9eaf0cc58e3ffb8792922633be41d6"
action.virtualIDUuids = [e1bc00e294e430069d37c620583ed9fd, 28852db42801373ba539eb67387e7658]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RemoveIAM2VirtualIDsFromProjectAction.Result res = action.call()

获取系统属性(GetIAM2SystemAttributes)

API请求

URLs
GET /v1/iam2/attributes/system
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/iam2/attributes/system
参数列表
名字 类型 位置 描述 可选值 起始版本
systemTags (可选) List query 2.4.0
userTags (可选) List query 2.4.0

API返回

返回示例
{
  "inventories": [
    {
      "uuid": "f6fb2ce8587d4455b51164b3970b2568",
      "name": "__ProjectAdmin__",
      "type": "System"
    }
  ]
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 2.4.0
inventories List 详情参考inventories 2.4.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 2.4.0
description String 错误的概要描述 2.4.0
details String 错误的详细信息 2.4.0
elaboration String 保留字段,默认为null 2.4.0
opaque LinkedHashMap 保留字段,默认为null 2.4.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 2.4.0
#inventories
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.4.0
name String 资源名称 2.4.0
value String 2.4.0
type AttributeType 详情参考type 2.4.0
#type
名字 类型 描述 起始版本
name String 资源名称 2.4.0
ordinal int 2.4.0

SDK示例

Java SDK
GetIAM2SystemAttributesAction action = new GetIAM2SystemAttributesAction();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetIAM2SystemAttributesAction.Result res = action.call();
Python SDK
GetIAM2SystemAttributesAction action = GetIAM2SystemAttributesAction()
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetIAM2SystemAttributesAction.Result res = action.call()

为项目添加属性(AddAttributesToIAM2Project)

API请求

URLs
POST zstack/v1/iam2/projects/{uuid}/attributes
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "attributes": [
      {
        "name": "some-attribute-name",
        "value": "attribute-value"
      }
    ]
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"attributes":[{"name":"some-attribute-name","value":"attribute-value"}]}}' http://localhost:8080/zstack/v1/iam2/projects/71c17463bb2434f28e4649d77cd12366/attributes
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 2.4.0
attributes List body(包含在params结构中) 属性 2.4.0
systemTags (可选) List body 2.4.0
userTags (可选) List body 2.4.0

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK示例

Java SDK
AddAttributesToIAM2ProjectAction action = new AddAttributesToIAM2ProjectAction();
action.uuid = "71c17463bb2434f28e4649d77cd12366";
action.attributes = asList([name:some-attribute-name, value:attribute-value]);
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddAttributesToIAM2ProjectAction.Result res = action.call();
Python SDK
AddAttributesToIAM2ProjectAction action = AddAttributesToIAM2ProjectAction()
action.uuid = "71c17463bb2434f28e4649d77cd12366"
action.attributes = [[name:some-attribute-name, value:attribute-value]]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddAttributesToIAM2ProjectAction.Result res = action.call()

从项目移除属性(RemoveAttributesFromIAM2Project)

API请求

URLs
DELETE zstack/v1/iam2/projects/{uuid}/attributes?attributeUuids={attributeUuids}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/iam2/projects/3212113e647a3c4d9e7d2dc87f607a45/attributes?attributeUuids=46f60ffedda13fbda87a584d5b23b6ba&attributeUuids=c41ee23e5fd330ccbb9f9cf8bb2061c1
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 2.4.0
attributeUuids List url 2.4.0
systemTags (可选) List body 2.4.0
userTags (可选) List body 2.4.0

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK示例

Java SDK
RemoveAttributesFromIAM2ProjectAction action = new RemoveAttributesFromIAM2ProjectAction();
action.uuid = "3212113e647a3c4d9e7d2dc87f607a45";
action.attributeUuids = asList("46f60ffedda13fbda87a584d5b23b6ba","c41ee23e5fd330ccbb9f9cf8bb2061c1");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemoveAttributesFromIAM2ProjectAction.Result res = action.call();
Python SDK
RemoveAttributesFromIAM2ProjectAction action = RemoveAttributesFromIAM2ProjectAction()
action.uuid = "3212113e647a3c4d9e7d2dc87f607a45"
action.attributeUuids = [46f60ffedda13fbda87a584d5b23b6ba, c41ee23e5fd330ccbb9f9cf8bb2061c1]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RemoveAttributesFromIAM2ProjectAction.Result res = action.call()

创建成员组(CreateIAM2VirtualIDGroup)

API请求

URLs
POST zstack/v1/iam2/projects/{projectUuid}/groups?projectUuid={projectUuid}
POST zstack/v1/iam2/groups?projectUuid={projectUuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "projectUuid": "ae81ff6fb37e392ca9b7568475f064b6",
    "name": "group"
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"projectUuid":"ae81ff6fb37e392ca9b7568475f064b6","name":"group"}}' http://localhost:8080/zstack/v1/iam2/groups
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"projectUuid":"ae81ff6fb37e392ca9b7568475f064b6","name":"group"}}' http://localhost:8080/zstack/v1/iam2/projects/ae81ff6fb37e392ca9b7568475f064b6/groups
参数列表
名字 类型 位置 描述 可选值 起始版本
projectUuid(可选) String url 4.0.0
name String body(包含在params结构中) 资源名称 2.4.0
description (可选) String body(包含在params结构中) 资源的详细描述 2.4.0
attributes (可选) List body(包含在params结构中) 2.4.0
resourceUuid (可选) String body(包含在params结构中) 2.4.0
systemTags (可选) List body 2.4.0
userTags (可选) List body 2.4.0

API返回

返回示例
{
  "inventory": {
    "uuid": "7c1b800eb5644c35823bbed13d14b54c",
    "projectUuid": "04ef5931e13e4362b1960e03033b7d79",
    "name": "group-name",
    "state": "Enabled",
    "attributes": [
      {
        "uuid": "70200048148344c1833a5cc8d6227f0b",
        "name": "attribute-name",
        "value": "attribute-value",
        "type": "Customized"
      }
    ]
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 2.4.0
inventory IAM2VirtualIDGroupInventory 详情参考inventory 2.4.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 2.4.0
description String 错误的概要描述 2.4.0
details String 错误的详细信息 2.4.0
elaboration String 保留字段,默认为null 2.4.0
opaque LinkedHashMap 保留字段,默认为null 2.4.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 2.4.0
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.4.0
projectUuid String 2.4.0
name String 资源名称 2.4.0
description String 资源的详细描述 2.4.0
createDate Timestamp 创建时间 2.4.0
lastOpDate Timestamp 最后一次修改时间 2.4.0
state State 详情参考state 2.4.0
attributes List 详情参考attributes 2.4.0
#state
名字 类型 描述 起始版本
name String 资源名称 2.4.0
ordinal int 2.4.0
#attributes
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.4.0
name String 资源名称 2.4.0
value String 2.4.0
type AttributeType 详情参考type 2.4.0
#type
名字 类型 描述 起始版本
name String 资源名称 2.4.0
ordinal int 2.4.0

SDK示例

Java SDK
CreateIAM2VirtualIDGroupAction action = new CreateIAM2VirtualIDGroupAction();
action.projectUuid = "ae81ff6fb37e392ca9b7568475f064b6";
action.name = "group";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateIAM2VirtualIDGroupAction.Result res = action.call();
Python SDK
CreateIAM2VirtualIDGroupAction action = CreateIAM2VirtualIDGroupAction()
action.projectUuid = "ae81ff6fb37e392ca9b7568475f064b6"
action.name = "group"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateIAM2VirtualIDGroupAction.Result res = action.call()

删除成员组(DeleteIAM2VirtualIDGroup)

API请求

URLs
DELETE zstack/v1/iam2/projects/groups/{uuid}?deleteMode={deleteMode}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/iam2/projects/groups/70844c49506031a69cb4a19a1478cddf?deleteMode=Permissive
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 2.4.0
deleteMode (可选) String url 2.4.0
systemTags (可选) List body 2.4.0
userTags (可选) List body 2.4.0

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK示例

Java SDK
DeleteIAM2VirtualIDGroupAction action = new DeleteIAM2VirtualIDGroupAction();
action.uuid = "70844c49506031a69cb4a19a1478cddf";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteIAM2VirtualIDGroupAction.Result res = action.call();
Python SDK
DeleteIAM2VirtualIDGroupAction action = DeleteIAM2VirtualIDGroupAction()
action.uuid = "70844c49506031a69cb4a19a1478cddf"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteIAM2VirtualIDGroupAction.Result res = action.call()

查询成员组(QueryIAM2VirtualIDGroup)

API请求

URLs
GET zstack/v1/iam2/projects/groups
GET zstack/v1/iam2/projects/groups/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/iam2/projects/groups?q=name=test
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/iam2/projects/groups/dfc5a52d28e3354fad1aaf634e50eb35

可查询字段

运行CLI命令行工具,输入QueryIAM2VirtualIDGroup并按Tab键查看所有可查询字段以及可跨表查询的资源名。

API返回

返回示例
{
  "inventories": [
    {
      "uuid": "89142c9562a74f619d9e2fe90982e559",
      "projectUuid": "bb66c8d69fbd419082b7c1f5e0e91ac9",
      "name": "group-name",
      "state": "Enabled",
      "attributes": [
        {
          "uuid": "39f0d375a4974ef3a8757de82ab1fdce",
          "name": "attribute-name",
          "value": "attribute-value",
          "type": "Customized"
        }
      ]
    }
  ]
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 2.4.0
inventories List 详情参考inventories 2.4.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 2.4.0
description String 错误的概要描述 2.4.0
details String 错误的详细信息 2.4.0
elaboration String 保留字段,默认为null 2.4.0
opaque LinkedHashMap 保留字段,默认为null 2.4.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 2.4.0
#inventories
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.4.0
projectUuid String 2.4.0
name String 资源名称 2.4.0
description String 资源的详细描述 2.4.0
createDate Timestamp 创建时间 2.4.0
lastOpDate Timestamp 最后一次修改时间 2.4.0
state State 详情参考state 2.4.0
attributes List 详情参考attributes 2.4.0
#state
名字 类型 描述 起始版本
name String 资源名称 2.4.0
ordinal int 2.4.0
#attributes
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.4.0
name String 资源名称 2.4.0
value String 2.4.0
type AttributeType 详情参考type 2.4.0
#type
名字 类型 描述 起始版本
name String 资源名称 2.4.0
ordinal int 2.4.0

SDK示例

Java SDK
QueryIAM2VirtualIDGroupAction action = new QueryIAM2VirtualIDGroupAction();
action.conditions = asList("name=test");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryIAM2VirtualIDGroupAction.Result res = action.call();
Python SDK
QueryIAM2VirtualIDGroupAction action = QueryIAM2VirtualIDGroupAction()
action.conditions = ["name=test"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryIAM2VirtualIDGroupAction.Result res = action.call()

更新成员组(UpdateIAM2VirtualIDGroup)

API请求

URLs
PUT zstack/v1/iam2/projects/groups/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateIAM2VirtualIDGroup": {
    "name": "new-name"
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateIAM2VirtualIDGroup":{"name":"new-name"}}' http://localhost:8080/zstack/v1/iam2/projects/groups/384bd47592273ddcb71039de694a37d3/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 2.4.0
name (可选) String body(包含在updateIAM2VirtualIDGroup结构中) 资源名称 2.4.0
description (可选) String body(包含在updateIAM2VirtualIDGroup结构中) 资源的详细描述 2.4.0
systemTags (可选) List body 2.4.0
userTags (可选) List body 2.4.0

API返回

返回示例
{
  "inventory": {
    "uuid": "9d44314e3c1a40759a0af2c59b4bd9b2",
    "projectUuid": "943d49ec4af74b8795d4c37b01d9e512",
    "name": "group-name",
    "state": "Enabled",
    "attributes": [
      {
        "uuid": "2e3fb2391e774e81bd55c6130c083c1d",
        "name": "attribute-name",
        "value": "attribute-value",
        "type": "Customized"
      }
    ]
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 2.4.0
inventory IAM2VirtualIDGroupInventory 详情参考inventory 2.4.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 2.4.0
description String 错误的概要描述 2.4.0
details String 错误的详细信息 2.4.0
elaboration String 保留字段,默认为null 2.4.0
opaque LinkedHashMap 保留字段,默认为null 2.4.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 2.4.0
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.4.0
projectUuid String 2.4.0
name String 资源名称 2.4.0
description String 资源的详细描述 2.4.0
createDate Timestamp 创建时间 2.4.0
lastOpDate Timestamp 最后一次修改时间 2.4.0
state State 详情参考state 2.4.0
attributes List 详情参考attributes 2.4.0
#state
名字 类型 描述 起始版本
name String 资源名称 2.4.0
ordinal int 2.4.0
#attributes
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.4.0
name String 资源名称 2.4.0
value String 2.4.0
type AttributeType 详情参考type 2.4.0
#type
名字 类型 描述 起始版本
name String 资源名称 2.4.0
ordinal int 2.4.0

SDK示例

Java SDK
UpdateIAM2VirtualIDGroupAction action = new UpdateIAM2VirtualIDGroupAction();
action.uuid = "384bd47592273ddcb71039de694a37d3";
action.name = "new-name";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateIAM2VirtualIDGroupAction.Result res = action.call();
Python SDK
UpdateIAM2VirtualIDGroupAction action = UpdateIAM2VirtualIDGroupAction()
action.uuid = "384bd47592273ddcb71039de694a37d3"
action.name = "new-name"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateIAM2VirtualIDGroupAction.Result res = action.call()

修改成员组状态(ChangeIAM2VirtualIDGroupState)

API请求

URLs
PUT zstack/v1/iam2/projects/groups/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "changeIAM2VirtualIDGroupState": {
    "stateEvent": "enable"
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changeIAM2VirtualIDGroupState":{"stateEvent":"enable"}}' http://localhost:8080/zstack/v1/iam2/projects/groups/dbc102a32b41404da8f639fe782834e9/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 2.4.0
stateEvent StateEvent body(包含在changeIAM2VirtualIDGroupState结构中)
  • enable
  • disable
2.4.0
systemTags (可选) List body 2.4.0
userTags (可选) List body 2.4.0

API返回

返回示例
{
  "inventory": {
    "uuid": "2da22aa4a4c840e2a0e5368427c7ab60",
    "projectUuid": "8aaf3ae982794c6e9f491964b2f419b2",
    "name": "group-name",
    "state": "Enabled",
    "attributes": [
      {
        "uuid": "d754761544514141ab5080ecbe9e31e5",
        "name": "attribute-name",
        "value": "attribute-value",
        "type": "Customized"
      }
    ]
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 2.4.0
inventory IAM2VirtualIDGroupInventory 详情参考inventory 2.4.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 2.4.0
description String 错误的概要描述 2.4.0
details String 错误的详细信息 2.4.0
elaboration String 保留字段,默认为null 2.4.0
opaque LinkedHashMap 保留字段,默认为null 2.4.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 2.4.0
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.4.0
projectUuid String 2.4.0
name String 资源名称 2.4.0
description String 资源的详细描述 2.4.0
createDate Timestamp 创建时间 2.4.0
lastOpDate Timestamp 最后一次修改时间 2.4.0
state State 详情参考state 2.4.0
attributes List 详情参考attributes 2.4.0
#state
名字 类型 描述 起始版本
name String 资源名称 2.4.0
ordinal int 2.4.0
#attributes
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.4.0
name String 资源名称 2.4.0
value String 2.4.0
type AttributeType 详情参考type 2.4.0
#type
名字 类型 描述 起始版本
name String 资源名称 2.4.0
ordinal int 2.4.0

SDK示例

Java SDK
ChangeIAM2VirtualIDGroupStateAction action = new ChangeIAM2VirtualIDGroupStateAction();
action.uuid = "b5b3e38809d24fb4b8c72603c5290c6b";
action.stateEvent = "enable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeIAM2VirtualIDGroupStateAction.Result res = action.call();
Python SDK
ChangeIAM2VirtualIDGroupStateAction action = ChangeIAM2VirtualIDGroupStateAction()
action.uuid = "28b8a0760b484c5c91cdda19ee998644"
action.stateEvent = "enable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ChangeIAM2VirtualIDGroupStateAction.Result res = action.call()

将成员添加到项目(AddIAM2VirtualIDsToProject)

API请求

URLs
POST zstack/v1/iam2/projects/{projectUuid}/virtual-ids
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "virtualIDUuids": [
      "6552671ff11d301cb593ed46b6db53ed",
      "f2a0c8724833360c939db5665d83aefc"
    ]
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"virtualIDUuids":["6552671ff11d301cb593ed46b6db53ed","f2a0c8724833360c939db5665d83aefc"]}}' http://localhost:8080/zstack/v1/iam2/projects/70d6ff93ccec388d92cd5c2c96f9df0b/virtual-ids
参数列表
名字 类型 位置 描述 可选值 起始版本
projectUuid String url 2.4.0
virtualIDUuids List body(包含在params结构中) 2.4.0
systemTags (可选) List body 2.4.0
userTags (可选) List body 2.4.0
roleUuids (可选) List body(包含在params结构中) 2.4.0

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK示例

Java SDK
AddIAM2VirtualIDsToProjectAction action = new AddIAM2VirtualIDsToProjectAction();
action.projectUuid = "70d6ff93ccec388d92cd5c2c96f9df0b";
action.virtualIDUuids = asList("6552671ff11d301cb593ed46b6db53ed","f2a0c8724833360c939db5665d83aefc");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddIAM2VirtualIDsToProjectAction.Result res = action.call();
Python SDK
AddIAM2VirtualIDsToProjectAction action = AddIAM2VirtualIDsToProjectAction()
action.projectUuid = "70d6ff93ccec388d92cd5c2c96f9df0b"
action.virtualIDUuids = [6552671ff11d301cb593ed46b6db53ed, f2a0c8724833360c939db5665d83aefc]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddIAM2VirtualIDsToProjectAction.Result res = action.call()

将多个用户添加到多个项目(AddIAM2VirtualIDsToProjects)

API请求

URLs
POST zstack/v1/iam2/projects/virtual-ids
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "projectUuids": [
      "106f65981c7a36498a75df50b95beb07",
      "5ee4abd779493b96a9c150f5a044963e"
    ],
    "virtualIDUuids": [
      "573e6aa70b063c5abe03528ffe4f095c",
      "ff71e39e4c2c340590b24d8609194392"
    ],
    "roleUuids": [
      "259c6ad5c2db3a8caf1b97436059f9df",
      "66e234a2951c3468823cd79a1d4315f9"
    ]
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"projectUuids":["106f65981c7a36498a75df50b95beb07","5ee4abd779493b96a9c150f5a044963e"],"virtualIDUuids":["573e6aa70b063c5abe03528ffe4f095c","ff71e39e4c2c340590b24d8609194392"],"roleUuids":["259c6ad5c2db3a8caf1b97436059f9df","66e234a2951c3468823cd79a1d4315f9"]}}' http://localhost:8080/zstack/v1/iam2/projects/virtual-ids
参数列表
名字 类型 位置 描述 可选值 起始版本
projectUuids List body(包含在params结构中) 项目uuid 4.0.0
virtualIDUuids List body(包含在params结构中) 用户uuid 4.0.0
roleUuids (可选) List body(包含在params结构中) 角色uuid 4.0.0
systemTags (可选) List body 系统标签 4.0.0
userTags (可选) List body 用户标签 4.0.0

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK示例

Java SDK
AddIAM2VirtualIDsToProjectsAction action = new AddIAM2VirtualIDsToProjectsAction();
action.projectUuids = asList("106f65981c7a36498a75df50b95beb07","5ee4abd779493b96a9c150f5a044963e");
action.virtualIDUuids = asList("573e6aa70b063c5abe03528ffe4f095c","ff71e39e4c2c340590b24d8609194392");
action.roleUuids = asList("259c6ad5c2db3a8caf1b97436059f9df","66e234a2951c3468823cd79a1d4315f9");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddIAM2VirtualIDsToProjectsAction.Result res = action.call();
Python SDK
AddIAM2VirtualIDsToProjectsAction action = AddIAM2VirtualIDsToProjectsAction()
action.projectUuids = [106f65981c7a36498a75df50b95beb07, 5ee4abd779493b96a9c150f5a044963e]
action.virtualIDUuids = [573e6aa70b063c5abe03528ffe4f095c, ff71e39e4c2c340590b24d8609194392]
action.roleUuids = [259c6ad5c2db3a8caf1b97436059f9df, 66e234a2951c3468823cd79a1d4315f9]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddIAM2VirtualIDsToProjectsAction.Result res = action.call()

将用户移出项目(RemoveIAM2VirtualIDsFromProjects)

API请求

URLs
DELECT zstack/v1/iam2/projects/virtual-ids
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/iam2/projects/virtual-ids
参数列表
名字 类型 位置 描述 可选值 起始版本
projectUuids List body(包含在params结构中) 项目uuid 4.0.0
virtualIDUuids List body(包含在params结构中) 用户uuid 4.0.0
systemTags (可选) List body(包含在params结构中) 系统标签 4.0.0
userTags (可选) List body(包含在params结构中) 用户标签 4.0.0

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK示例

Java SDK
RemoveIAM2VirtualIDsFromProjectsAction action = new RemoveIAM2VirtualIDsFromProjectsAction();
action.projectUuids = asList("4b2abe7589643af3a924c3d852b68645","3b52002f0fbd37ac9714dcd218f3862b");
action.virtualIDUuids = asList("0fbfc7baae4f394bbf368605da56da84","e78eeced9c15367e84c7e467bdc8ac70");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemoveIAM2VirtualIDsFromProjectsAction.Result res = action.call();
Python SDK
RemoveIAM2VirtualIDsFromProjectsAction action = RemoveIAM2VirtualIDsFromProjectsAction()
action.projectUuids = [4b2abe7589643af3a924c3d852b68645, 3b52002f0fbd37ac9714dcd218f3862b]
action.virtualIDUuids = [0fbfc7baae4f394bbf368605da56da84, e78eeced9c15367e84c7e467bdc8ac70]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RemoveIAM2VirtualIDsFromProjectsAction.Result res = action.call()

将多个成员组添加到多个项目(AddIAM2VirtualIDGroupToProjects)

API请求

URLs
POST zstack/v1/iam2/projects/groups
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "structs": []
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"structs":[]}}' http://localhost:8080/zstack/v1/iam2/projects/groups
参数列表
名字 类型 位置 描述 可选值 起始版本
projectUuids List body(包含在params结构中) 项目uuid 4.0.0
groupUuids List body(包含在params结构中) 用户组uuid 4.0.0
roleUuids (可选) List body(包含在params结构中) 角色uuid 4.0.0
systemTags (可选) List body 4.0.0
userTags (可选) List body 4.0.0

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK示例

Java SDK
AddIAM2VirtualIDGroupToProjectsAction action = new AddIAM2VirtualIDGroupToProjectsAction();
action.structs = new ArrayList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddIAM2VirtualIDGroupToProjectsAction.Result res = action.call();
Python SDK
AddIAM2VirtualIDGroupToProjectsAction action = AddIAM2VirtualIDGroupToProjectsAction()
action.structs = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddIAM2VirtualIDGroupToProjectsAction.Result res = action.call()

将成员组移出项目(RemoveIAM2VirtualIDGroupFromProjects)

API请求

URLs
DELETE zstack/v1/iam2/projects/groups
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/iam2/projects/groups
参数列表
名字 类型 位置 描述 可选值 起始版本
projectUuids (可选) List body(包含在params结构中) 项目uuid 4.0.0
groupUuids (可选) List body(包含在params结构中) 用户uuid 4.0.0
systemTags (可选) List body(包含在params结构中) 系统标签 4.0.0
userTags (可选) List body(包含在params结构中) 用户标签 4.0.0

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK示例

Java SDK
RemoveIAM2VirtualIDGroupFromProjectsAction action = new RemoveIAM2VirtualIDGroupFromProjectsAction();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemoveIAM2VirtualIDGroupFromProjectsAction.Result res = action.call();
Python SDK
RemoveIAM2VirtualIDGroupFromProjectsAction action = RemoveIAM2VirtualIDGroupFromProjectsAction()
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RemoveIAM2VirtualIDGroupFromProjectsAction.Result res = action.call()

向项目添加资源(AddResourceToIAM2Project)

API请求

URLs
POST zstack/v1/iam2/projects/add/resource/
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "projectUuid": "4b596d98fa90346cb7ac102ed2ba354a",
    "resourceTemplates": [
      "{}",
      "{}"
    ]
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"projectUuid":"4b596d98fa90346cb7ac102ed2ba354a","resourceTemplates":["{}","{}"]}}' http://localhost:8080/zstack/v1/iam2/projects/add/resource/
参数列表
名字 类型 位置 描述 可选值 起始版本
projectUuid String body(包含在params结构中) 项目uuid 4.4.0
resourceTemplates List body(包含在params结构中) 资源模板 4.4.0
systemTags (可选) List body 系统标签 4.4.0
userTags (可选) List body 用户标签 4.4.0

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK示例

Java SDK
AddResourceToIAM2ProjectAction action = new AddResourceToIAM2ProjectAction();
action.projectUuid = "4b596d98fa90346cb7ac102ed2ba354a";
action.resourceTemplates = asList("{}","{}");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddResourceToIAM2ProjectAction.Result res = action.call();
Python SDK
AddResourceToIAM2ProjectAction action = AddResourceToIAM2ProjectAction()
action.projectUuid = "4b596d98fa90346cb7ac102ed2ba354a"
action.resourceTemplates = [{}, {}]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddResourceToIAM2ProjectAction.Result res = action.call()

将成员添加到成员组(AddIAM2VirtualIDsToGroup)

API请求

URLs
POST zstack/v1/iam2/projects/groups/{groupUuid}/virtual-ids
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "virtualIDUuids": [
      "28e44658cba33e57b96da2c430cbbefe",
      "f9450427d6b03c2cb992c80a3a64efaa"
    ]
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"virtualIDUuids":["28e44658cba33e57b96da2c430cbbefe","f9450427d6b03c2cb992c80a3a64efaa"]}}' http://localhost:8080/zstack/v1/iam2/projects/groups/2a5a0fe00543339f8c424e069df8c956/virtual-ids
参数列表
名字 类型 位置 描述 可选值 起始版本
virtualIDUuids List body(包含在params结构中) 2.4.0
groupUuid String url 2.4.0
systemTags (可选) List body 2.4.0
userTags (可选) List body 2.4.0

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK示例

Java SDK
AddIAM2VirtualIDsToGroupAction action = new AddIAM2VirtualIDsToGroupAction();
action.virtualIDUuids = asList("28e44658cba33e57b96da2c430cbbefe","f9450427d6b03c2cb992c80a3a64efaa");
action.groupUuid = "2a5a0fe00543339f8c424e069df8c956";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddIAM2VirtualIDsToGroupAction.Result res = action.call();
Python SDK
AddIAM2VirtualIDsToGroupAction action = AddIAM2VirtualIDsToGroupAction()
action.virtualIDUuids = [28e44658cba33e57b96da2c430cbbefe, f9450427d6b03c2cb992c80a3a64efaa]
action.groupUuid = "2a5a0fe00543339f8c424e069df8c956"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddIAM2VirtualIDsToGroupAction.Result res = action.call()

从成员组移除成员(RemoveIAM2VirtualIDsFromGroup)

API请求

URLs
DELETE zstack/v1/iam2/projects/groups/{groupUuid}/virtual-ids?virtualIDUuids={virtualIDUuids}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/iam2/projects/groups/7e89f250537f36818cd3d079f2730b2d/virtual-ids?virtualIDUuids=de445baef47130f68b3db86d7614151f&virtualIDUuids=a44ee69219963ef98ca3a15963fc8cfc
参数列表
名字 类型 位置 描述 可选值 起始版本
virtualIDUuids List url 2.4.0
groupUuid String url 2.4.0
systemTags (可选) List body 2.4.0
userTags (可选) List body 2.4.0

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK示例

Java SDK
RemoveIAM2VirtualIDsFromGroupAction action = new RemoveIAM2VirtualIDsFromGroupAction();
action.virtualIDUuids = asList("de445baef47130f68b3db86d7614151f","a44ee69219963ef98ca3a15963fc8cfc");
action.groupUuid = "7e89f250537f36818cd3d079f2730b2d";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemoveIAM2VirtualIDsFromGroupAction.Result res = action.call();
Python SDK
RemoveIAM2VirtualIDsFromGroupAction action = RemoveIAM2VirtualIDsFromGroupAction()
action.virtualIDUuids = [de445baef47130f68b3db86d7614151f, a44ee69219963ef98ca3a15963fc8cfc]
action.groupUuid = "7e89f250537f36818cd3d079f2730b2d"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RemoveIAM2VirtualIDsFromGroupAction.Result res = action.call()

更新权限(UpdateIAM2VirtualID)

API请求

URLs
PUT zstack/v1/iam2/virtual-ids/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateIAM2VirtualID": {
    "name": "new-name",
    "description": "new-desc",
    "password": "new-password"
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateIAM2VirtualID":{"name":"new-name","description":"new-desc","password":"new-password"}}' http://localhost:8080/zstack/v1/iam2/virtual-ids/348ac2cc1d9438ffa84878d4cb494234/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 2.4.0
name (可选) String body(包含在updateIAM2VirtualID结构中) 资源名称 2.4.0
description (可选) String body(包含在updateIAM2VirtualID结构中) 资源的详细描述 2.4.0
password (可选) String body(包含在updateIAM2VirtualID结构中) 2.4.0
systemTags (可选) List body 2.4.0
userTags (可选) List body 2.4.0

API返回

返回示例
{
  "inventory": {
    "uuid": "4906f550acb843b7ae64c32fbf7251c3",
    "name": "id1",
    "state": "Enabled",
    "attributes": [
      {
        "uuid": "b0926ede396547f9b1f6199c05ffe4d4",
        "name": "attribute-name",
        "value": "attribute-value",
        "type": "Customized"
      }
    ]
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 2.4.0
inventory IAM2VirtualIDInventory 详情参考inventory 2.4.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 2.4.0
description String 错误的概要描述 2.4.0
details String 错误的详细信息 2.4.0
elaboration String 保留字段,默认为null 2.4.0
opaque LinkedHashMap 保留字段,默认为null 2.4.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 2.4.0
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.4.0
name String 资源名称 2.4.0
description String 资源的详细描述 2.4.0
createDate Timestamp 创建时间 2.4.0
lastOpDate Timestamp 最后一次修改时间 2.4.0
state State 详情参考state 2.4.0
attributes List 详情参考attributes 2.4.0
#state
名字 类型 描述 起始版本
name String 资源名称 2.4.0
ordinal int 2.4.0
#attributes
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.4.0
name String 资源名称 2.4.0
value String 2.4.0
type AttributeType 详情参考type 2.4.0
#type
名字 类型 描述 起始版本
name String 资源名称 2.4.0
ordinal int 2.4.0

SDK示例

Java SDK
UpdateIAM2VirtualIDAction action = new UpdateIAM2VirtualIDAction();
action.uuid = "348ac2cc1d9438ffa84878d4cb494234";
action.name = "new-name";
action.description = "new-desc";
action.password = "new-password";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateIAM2VirtualIDAction.Result res = action.call();
Python SDK
UpdateIAM2VirtualIDAction action = UpdateIAM2VirtualIDAction()
action.uuid = "348ac2cc1d9438ffa84878d4cb494234"
action.name = "new-name"
action.description = "new-desc"
action.password = "new-password"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateIAM2VirtualIDAction.Result res = action.call()

为成员添加权限(AddRolesToIAM2VirtualID)

API请求

URLs
POST zstack/v1/iam2/projects/virtual-ids/{virtualIDUuid}/roles
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "roleUuids": [
      "d1140b7d8ca03f7ba15ce467a9befec6",
      "8245aba180633254a5dfd76cbdd6f773"
    ]
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"roleUuids":["d1140b7d8ca03f7ba15ce467a9befec6","8245aba180633254a5dfd76cbdd6f773"]}}' http://localhost:8080/zstack/v1/iam2/projects/virtual-ids/3390a29bd4df30a8a2b69cf2b56be703/roles
参数列表
名字 类型 位置 描述 可选值 起始版本
virtualIDUuid String url 2.4.0
roleUuids List body(包含在params结构中) 2.4.0
systemTags (可选) List body 2.4.0
userTags (可选) List body 2.4.0

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK示例

Java SDK
AddRolesToIAM2VirtualIDAction action = new AddRolesToIAM2VirtualIDAction();
action.virtualIDUuid = "3390a29bd4df30a8a2b69cf2b56be703";
action.roleUuids = asList("d1140b7d8ca03f7ba15ce467a9befec6","8245aba180633254a5dfd76cbdd6f773");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddRolesToIAM2VirtualIDAction.Result res = action.call();
Python SDK
AddRolesToIAM2VirtualIDAction action = AddRolesToIAM2VirtualIDAction()
action.virtualIDUuid = "3390a29bd4df30a8a2b69cf2b56be703"
action.roleUuids = [d1140b7d8ca03f7ba15ce467a9befec6, 8245aba180633254a5dfd76cbdd6f773]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddRolesToIAM2VirtualIDAction.Result res = action.call()

从成员移除权限(RemoveRolesFromIAM2VirtualID)

API请求

URLs
DELETE zstack/v1/iam2/projects/virtual-ids/{virtualIDUuid}/roles?roleUuids={roleUuids}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/iam2/projects/virtual-ids/8ac88abb03b336c68d9a5facd7a0cd8d/roles?roleUuids=0c535557981832d2a8a9748c590e7222
参数列表
名字 类型 位置 描述 可选值 起始版本
roleUuids List url 2.4.0
virtualIDUuid String url 2.4.0
systemTags (可选) List body 2.4.0
userTags (可选) List body 2.4.0

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK示例

Java SDK
RemoveRolesFromIAM2VirtualIDAction action = new RemoveRolesFromIAM2VirtualIDAction();
action.roleUuids = asList("0c535557981832d2a8a9748c590e7222");
action.virtualIDUuid = "8ac88abb03b336c68d9a5facd7a0cd8d";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemoveRolesFromIAM2VirtualIDAction.Result res = action.call();
Python SDK
RemoveRolesFromIAM2VirtualIDAction action = RemoveRolesFromIAM2VirtualIDAction()
action.roleUuids = [0c535557981832d2a8a9748c590e7222]
action.virtualIDUuid = "8ac88abb03b336c68d9a5facd7a0cd8d"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RemoveRolesFromIAM2VirtualIDAction.Result res = action.call()

为成员组添加权限(AddRolesToIAM2VirtualIDGroup)

API请求

URLs
POST zstack/v1/iam2/projects/groups/{groupUuid}/roles
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "roleUuids": [
      "15258e508f6e39cabb2b68e5e8b1dc57",
      "e01f1cc2abc934fc88491a3b2bd4d77f"
    ]
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"roleUuids":["15258e508f6e39cabb2b68e5e8b1dc57","e01f1cc2abc934fc88491a3b2bd4d77f"]}}' http://localhost:8080/zstack/v1/iam2/projects/groups/606625f400b739b99a78355a54175dc7/roles
参数列表
名字 类型 位置 描述 可选值 起始版本
roleUuids List body(包含在params结构中) 2.4.0
groupUuid String url 2.4.0
systemTags (可选) List body 2.4.0
userTags (可选) List body 2.4.0

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK示例

Java SDK
AddRolesToIAM2VirtualIDGroupAction action = new AddRolesToIAM2VirtualIDGroupAction();
action.roleUuids = asList("15258e508f6e39cabb2b68e5e8b1dc57","e01f1cc2abc934fc88491a3b2bd4d77f");
action.groupUuid = "606625f400b739b99a78355a54175dc7";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddRolesToIAM2VirtualIDGroupAction.Result res = action.call();
Python SDK
AddRolesToIAM2VirtualIDGroupAction action = AddRolesToIAM2VirtualIDGroupAction()
action.roleUuids = [15258e508f6e39cabb2b68e5e8b1dc57, e01f1cc2abc934fc88491a3b2bd4d77f]
action.groupUuid = "606625f400b739b99a78355a54175dc7"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddRolesToIAM2VirtualIDGroupAction.Result res = action.call()

从成员组移除权限(RemoveRolesFromIAM2VirtualIDGroup)

API请求

URLs
DELETE zstack/v1/iam2/projects/groups/{groupUuid}/roles?roleUuids={roleUuids}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/iam2/projects/groups/a1a30de59ad4346d9660fa63ea326ee7/roles?roleUuids=46c87204285e38428ddbf4c971df2907&roleUuids=ebf229bcbc13378686158380a5fe5217
参数列表
名字 类型 位置 描述 可选值 起始版本
roleUuids List url 2.4.0
groupUuid String url 2.4.0
systemTags (可选) List body 2.4.0
userTags (可选) List body 2.4.0

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK示例

Java SDK
RemoveRolesFromIAM2VirtualIDGroupAction action = new RemoveRolesFromIAM2VirtualIDGroupAction();
action.roleUuids = asList("46c87204285e38428ddbf4c971df2907","ebf229bcbc13378686158380a5fe5217");
action.groupUuid = "a1a30de59ad4346d9660fa63ea326ee7";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemoveRolesFromIAM2VirtualIDGroupAction.Result res = action.call();
Python SDK
RemoveRolesFromIAM2VirtualIDGroupAction action = RemoveRolesFromIAM2VirtualIDGroupAction()
action.roleUuids = [46c87204285e38428ddbf4c971df2907, ebf229bcbc13378686158380a5fe5217]
action.groupUuid = "a1a30de59ad4346d9660fa63ea326ee7"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RemoveRolesFromIAM2VirtualIDGroupAction.Result res = action.call()

为成员组添加属性(AddAttributesToIAM2VirtualIDGroup)

API请求

URLs
POST zstack/v1/iam2/projects/groups/{uuid}/attributes
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "attributes": [
      {
        "name": "some-attribute-name",
        "value": "attribute-value"
      }
    ]
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"attributes":[{"name":"some-attribute-name","value":"attribute-value"}]}}' http://localhost:8080/zstack/v1/iam2/projects/groups/21fb131f6da53f8f8c22fd1ae334a931/attributes
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 2.4.0
attributes List body(包含在params结构中) 属性 2.4.0
systemTags (可选) List body 2.4.0
userTags (可选) List body 2.4.0

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK示例

Java SDK
AddAttributesToIAM2VirtualIDGroupAction action = new AddAttributesToIAM2VirtualIDGroupAction();
action.uuid = "21fb131f6da53f8f8c22fd1ae334a931";
action.attributes = asList([name:some-attribute-name, value:attribute-value]);
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddAttributesToIAM2VirtualIDGroupAction.Result res = action.call();
Python SDK
AddAttributesToIAM2VirtualIDGroupAction action = AddAttributesToIAM2VirtualIDGroupAction()
action.uuid = "21fb131f6da53f8f8c22fd1ae334a931"
action.attributes = [[name:some-attribute-name, value:attribute-value]]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddAttributesToIAM2VirtualIDGroupAction.Result res = action.call()

从成员组移除属性(RemoveAttributesFromIAM2VirtualIDGroup)

API请求

URLs
DELETE zstack/v1/iam2/projects/groups/{uuid}/attributes?attributeUuids={attributeUuids}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/iam2/projects/groups/3244b0ff8134320b81db4f470f6f9dee/attributes?attributeUuids=68a7c71c12c039e38e677ced921248e4&attributeUuids=aa7306e18d8b3f0283457a55637e93de
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 2.4.0
attributeUuids List url 2.4.0
systemTags (可选) List body 2.4.0
userTags (可选) List body 2.4.0

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK示例

Java SDK
RemoveAttributesFromIAM2VirtualIDGroupAction action = new RemoveAttributesFromIAM2VirtualIDGroupAction();
action.uuid = "3244b0ff8134320b81db4f470f6f9dee";
action.attributeUuids = asList("68a7c71c12c039e38e677ced921248e4","aa7306e18d8b3f0283457a55637e93de");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemoveAttributesFromIAM2VirtualIDGroupAction.Result res = action.call();
Python SDK
RemoveAttributesFromIAM2VirtualIDGroupAction action = RemoveAttributesFromIAM2VirtualIDGroupAction()
action.uuid = "3244b0ff8134320b81db4f470f6f9dee"
action.attributeUuids = [68a7c71c12c039e38e677ced921248e4, aa7306e18d8b3f0283457a55637e93de]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RemoveAttributesFromIAM2VirtualIDGroupAction.Result res = action.call()

创建角色(CreateRole)

API请求

URLs
POST zstack/v1/identities/roles
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "role-1",
    "description": "role for test",
    "statements": [
      "statement for test"
    ],
    "policyUuids": [
      "c950762ed8ab31818b320c704a1a276f"
    ]
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"role-1","description":"role for test","statements":["statement for test"],"policyUuids":["c950762ed8ab31818b320c704a1a276f"]}}' http://localhost:8080/zstack/v1/identities/roles
参数列表
名字 类型 位置 描述 可选值 起始版本
name String body(包含在params结构中) 资源名称 0.6
description (可选) String body(包含在params结构中) 资源的详细描述 0.6
statements (可选) List body(包含在params结构中) 0.6
policyUuids (可选) List body(包含在params结构中) 0.6
resourceUuid (可选) String body(包含在params结构中) 0.6
systemTags (可选) List body 0.6
userTags (可选) List body 0.6

API返回

返回示例
{
  "inventory": {
    "uuid": "7e9df59e6d453b2187a0da3ee94f63c9",
    "name": "role-1",
    "description": "role for test",
    "type": "Customized",
    "state": "Enabled",
    "statements": [
      "statement for test"
    ]
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 0.6
inventory RoleInventory 详情参考inventory 0.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 0.6
name String 资源名称 0.6
description String 资源的详细描述 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
type RoleType 详情参考type 0.6
state RoleState 详情参考state 0.6
statements List 详情参考statements 0.6
#type
名字 类型 描述 起始版本
name String 资源名称 0.6
ordinal int 0.6
#state
名字 类型 描述 起始版本
name String 资源名称 0.6
ordinal int 0.6
#statements
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
statement PolicyStatement 详情参考statement 0.6
#statement
名字 类型 描述 起始版本
name String 资源名称 0.6
principals List 0.6
actions List 0.6
resources List 0.6
effect StatementEffect 详情参考effect 0.6
#effect
名字 类型 描述 起始版本
name String 资源名称 0.6
ordinal int 0.6

SDK示例

Java SDK
CreateRoleAction action = new CreateRoleAction();
action.name = "role-1";
action.description = "role for test";
action.statements = asList("statement for test");
action.policyUuids = asList("c950762ed8ab31818b320c704a1a276f");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateRoleAction.Result res = action.call();
Python SDK
CreateRoleAction action = CreateRoleAction()
action.name = "role-1"
action.description = "role for test"
action.statements = [statement for test]
action.policyUuids = [c950762ed8ab31818b320c704a1a276f]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateRoleAction.Result res = action.call()

删除角色(DeleteRole)

API请求

URLs
DELETE zstack/v1/identities/roles/{uuid}?deleteMode={deleteMode}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/identities/roles/6576d603b86634d68d49e9df50443e7f?deleteMode=Permissive
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 0.6
deleteMode (可选) String url 0.6
systemTags (可选) List body 0.6
userTags (可选) List body 0.6

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK示例

Java SDK
DeleteRoleAction action = new DeleteRoleAction();
action.uuid = "6576d603b86634d68d49e9df50443e7f";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteRoleAction.Result res = action.call();
Python SDK
DeleteRoleAction action = DeleteRoleAction()
action.uuid = "6576d603b86634d68d49e9df50443e7f"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteRoleAction.Result res = action.call()

查询角色(QueryRole)

API请求

URLs
GET zstack/v1/identities/roles
GET zstack/v1/identities/roles/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/identities/roles?q=name=role-1
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/identities/roles/159398ac7d57325daeb62f4abbc5107b

可查询字段

运行CLI命令行工具,输入QueryRole并按Tab键查看所有可查询字段以及可跨表查询的资源名。

API返回

返回示例
{
  "inventories": [
    {
      "uuid": "bc0df9075c8f30cc9150ea9d2030b470",
      "name": "role-1",
      "description": "role for test",
      "type": "Customized",
      "state": "Enabled",
      "statements": [
        "statement for test"
      ]
    }
  ]
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 0.6
inventories List 详情参考inventories 0.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventories
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 0.6
name String 资源名称 0.6
description String 资源的详细描述 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
type RoleType 详情参考type 0.6
state RoleState 详情参考state 0.6
statements List 详情参考statements 0.6
#type
名字 类型 描述 起始版本
name String 资源名称 0.6
ordinal int 0.6
#state
名字 类型 描述 起始版本
name String 资源名称 0.6
ordinal int 0.6
#statements
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
statement PolicyStatement 详情参考statement 0.6
#statement
名字 类型 描述 起始版本
name String 资源名称 0.6
principals List 0.6
actions List 0.6
resources List 0.6
effect StatementEffect 详情参考effect 0.6
#effect
名字 类型 描述 起始版本
name String 资源名称 0.6
ordinal int 0.6

SDK示例

Java SDK
QueryRoleAction action = new QueryRoleAction();
action.conditions = asList("name=role-1");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryRoleAction.Result res = action.call();
Python SDK
QueryRoleAction action = QueryRoleAction()
action.conditions = ["name=role-1"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryRoleAction.Result res = action.call()

更新角色(UpdateRole)

API请求

URLs
PUT zstack/v1/identities/roles/{uuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateRole": {
    "name": "role-1",
    "description": "role for test",
    "statements": [
      {}
    ],
    "policyUuids": [
      "da93f6bf55823973a1bea123d7f5427f"
    ]
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateRole":{"name":"role-1","description":"role for test","statements":[{}],"policyUuids":["da93f6bf55823973a1bea123d7f5427f"]}}' http://localhost:8080/zstack/v1/identities/roles/a3489a74f7e23a5682b808b59f4d25c4/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 0.6
name String body(包含在updateRole结构中) 资源名称 0.6
description (可选) String body(包含在updateRole结构中) 资源的详细描述 0.6
statements (可选) List body(包含在updateRole结构中) 角色权限描述 0.6
policyUuids (可选) List body(包含在updateRole结构中) 角色权限UUID 0.6
systemTags (可选) List body 0.6
userTags (可选) List body 0.6

API返回

返回示例
{
  "inventory": {
    "uuid": "14c577188a0c3ee8871e27087a287bc2",
    "name": "role-1",
    "description": "role for test",
    "type": "Customized",
    "state": "Enabled",
    "statements": [
      "statement for test"
    ]
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 0.6
inventory RoleInventory 详情参考inventory 0.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 0.6
name String 资源名称 0.6
description String 资源的详细描述 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
type RoleType 详情参考type 0.6
statements List 详情参考statements 0.6
#type
名字 类型 描述 起始版本
name String 资源名称 0.6
ordinal int 0.6
#statements
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
statement PolicyStatement 详情参考statement 0.6
#statement
名字 类型 描述 起始版本
name String 资源名称 0.6
principals List 0.6
actions List 0.6
resources List 0.6
effect StatementEffect 详情参考effect 0.6
#effect
名字 类型 描述 起始版本
name String 资源名称 0.6
ordinal int 0.6

SDK示例

Java SDK
UpdateRoleAction action = new UpdateRoleAction();
action.uuid = "a3489a74f7e23a5682b808b59f4d25c4";
action.name = "role-1";
action.description = "role for test";
action.statements = asList([:]);
action.policyUuids = asList("da93f6bf55823973a1bea123d7f5427f");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateRoleAction.Result res = action.call();
Python SDK
UpdateRoleAction action = UpdateRoleAction()
action.uuid = "a3489a74f7e23a5682b808b59f4d25c4"
action.name = "role-1"
action.description = "role for test"
action.statements = [[:]]
action.policyUuids = [da93f6bf55823973a1bea123d7f5427f]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateRoleAction.Result res = action.call()

更改角色状态(ChangeRoleState)

API请求

URLs
PUT zstack/v1/identities/roles/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "changeRoleState": {
    "stateEvent": "enable"
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changeRoleState":{"stateEvent":"enable"}}' http://localhost:8080/zstack/v1/identities/roles/bd69220686b1390e9ae7c473c73745fa/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 0.6
stateEvent RoleStateEvent body(包含在changeRoleState结构中)
  • enable
  • disable
0.6
systemTags (可选) List body 0.6
userTags (可选) List body 0.6

API返回

返回示例
{
  "inventory": {
    "uuid": "69f93c9ed74235e18019dafcf3f1fb65",
    "name": "role-1",
    "description": "role for test",
    "type": "Customized",
    "state": "Enabled",
    "statements": [
      "statement for test"
    ]
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 0.6
inventory RoleInventory 详情参考inventory 0.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 0.6
name String 资源名称 0.6
description String 资源的详细描述 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
type RoleType 详情参考type 0.6
state RoleState 详情参考state 0.6
statements List 详情参考statements 0.6
#type
名字 类型 描述 起始版本
name String 资源名称 0.6
ordinal int 0.6
#state
名字 类型 描述 起始版本
name String 资源名称 0.6
ordinal int 0.6
#statements
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
statement PolicyStatement 详情参考statement 0.6
#statement
名字 类型 描述 起始版本
name String 资源名称 0.6
principals List 0.6
actions List 0.6
resources List 0.6
effect StatementEffect 详情参考effect 0.6
#effect
名字 类型 描述 起始版本
name String 资源名称 0.6
ordinal int 0.6

SDK示例

Java SDK
ChangeRoleStateAction action = new ChangeRoleStateAction();
action.uuid = "bd69220686b1390e9ae7c473c73745fa";
action.stateEvent = "enable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeRoleStateAction.Result res = action.call();
Python SDK
ChangeRoleStateAction action = ChangeRoleStateAction()
action.uuid = "bd69220686b1390e9ae7c473c73745fa"
action.stateEvent = "enable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ChangeRoleStateAction.Result res = action.call()

加载权限到角色(AttachPolicyToRole)

API请求

URLs
POST zstack/v1/identities/policies/{policyUuid}/roles/{roleUuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {},
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{}}' http://localhost:8080/zstack/v1/identities/policies/b6d28a1479ba35ff992c468c6422086b/roles/ac53fe888c20385691c8c89335041b00
参数列表
名字 类型 位置 描述 可选值 起始版本
roleUuid String url 0.6
policyUuid String url 权限策略UUID 0.6
systemTags (可选) List body 0.6
userTags (可选) List body 0.6

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK示例

Java SDK
AttachPolicyToRoleAction action = new AttachPolicyToRoleAction();
action.roleUuid = "ac53fe888c20385691c8c89335041b00";
action.policyUuid = "b6d28a1479ba35ff992c468c6422086b";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachPolicyToRoleAction.Result res = action.call();
Python SDK
AttachPolicyToRoleAction action = AttachPolicyToRoleAction()
action.roleUuid = "ac53fe888c20385691c8c89335041b00"
action.policyUuid = "b6d28a1479ba35ff992c468c6422086b"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AttachPolicyToRoleAction.Result res = action.call()

从角色中移除权限(DetachPolicyFromRole)

API请求

URLs
DELETE zstack/v1/identities/policies/{policyUuid}/roles/{roleUuid}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/identities/policies/1690962271f435cda25a5db08a21694c/roles/1d06e80ea3b23da9a6c5cc9b434ce7ce?
参数列表
名字 类型 位置 描述 可选值 起始版本
roleUuid String url 0.6
policyUuid String url 权限策略UUID 0.6
systemTags (可选) List body 0.6
userTags (可选) List body 0.6

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK示例

Java SDK
DetachPolicyFromRoleAction action = new DetachPolicyFromRoleAction();
action.roleUuid = "1d06e80ea3b23da9a6c5cc9b434ce7ce";
action.policyUuid = "1690962271f435cda25a5db08a21694c";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DetachPolicyFromRoleAction.Result res = action.call();
Python SDK
DetachPolicyFromRoleAction action = DetachPolicyFromRoleAction()
action.roleUuid = "1d06e80ea3b23da9a6c5cc9b434ce7ce"
action.policyUuid = "1690962271f435cda25a5db08a21694c"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DetachPolicyFromRoleAction.Result res = action.call()

添加权限属性到角色(AddPolicyStatementsToRole)

API请求

URLs
POST zstack/v1/identities/roles/{uuid}/policy-statements
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "statements": [
      {
        "name": "state-1",
        "effect": "Allow",
        "actions": [
          "accpet"
        ]
      }
    ]
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"statements":[{"name":"state-1","effect":"Allow","actions":["accpet"]}]}}' http://localhost:8080/zstack/v1/identities/roles/4723bb74195e3ce28de45bbbd9173173/policy-statements
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 0.6
statements List body(包含在params结构中) 0.6
systemTags (可选) List body 0.6
userTags (可选) List body 0.6

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK示例

Java SDK
AddPolicyStatementsToRoleAction action = new AddPolicyStatementsToRoleAction();
action.uuid = "4723bb74195e3ce28de45bbbd9173173";
action.statements = asList([name:state-1, effect:Allow, actions:[accpet]]);
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddPolicyStatementsToRoleAction.Result res = action.call();
Python SDK
AddPolicyStatementsToRoleAction action = AddPolicyStatementsToRoleAction()
action.uuid = "4723bb74195e3ce28de45bbbd9173173"
action.statements = [[name:state-1, effect:Allow, actions:[accpet]]]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddPolicyStatementsToRoleAction.Result res = action.call()

从角色移除权限属性(RemovePolicyStatementsFromRole)

API请求

URLs
DELETE zstack/v1/identities/roles/{uuid}/policy-statements?policyStatementUuids={policyStatementUuids}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/identities/roles/fd6ff08afb3e3a4db5f13816b0110caa/policy-statements?policyStatementUuids=d0e7ec31946437d3b17ec2e20e48a1ac
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 0.6
policyStatementUuids List url 0.6
systemTags (可选) List body 0.6
userTags (可选) List body 0.6

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK示例

Java SDK
RemovePolicyStatementsFromRoleAction action = new RemovePolicyStatementsFromRoleAction();
action.uuid = "fd6ff08afb3e3a4db5f13816b0110caa";
action.policyStatementUuids = asList("d0e7ec31946437d3b17ec2e20e48a1ac");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemovePolicyStatementsFromRoleAction.Result res = action.call();
Python SDK
RemovePolicyStatementsFromRoleAction action = RemovePolicyStatementsFromRoleAction()
action.uuid = "fd6ff08afb3e3a4db5f13816b0110caa"
action.policyStatementUuids = [d0e7ec31946437d3b17ec2e20e48a1ac]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RemovePolicyStatementsFromRoleAction.Result res = action.call()

加载角色到账户(AttachRoleToAccount)

API请求

URLs
POST zstack/v1/identities/accounts/{accountUuid}/roles/{roleUuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {},
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{}}' http://localhost:8080/zstack/v1/identities/accounts/053a25bbfe2c34a889d75601e64d4a51/roles/b7a901c45db33f12993c9c7aad874ff4
参数列表
名字 类型 位置 描述 可选值 起始版本
roleUuid String url 0.6
accountUuid String url 账户UUID 0.6
systemTags (可选) List body 0.6
userTags (可选) List body 0.6

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK示例

Java SDK
AttachRoleToAccountAction action = new AttachRoleToAccountAction();
action.roleUuid = "b7a901c45db33f12993c9c7aad874ff4";
action.accountUuid = "053a25bbfe2c34a889d75601e64d4a51";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachRoleToAccountAction.Result res = action.call();
Python SDK
AttachRoleToAccountAction action = AttachRoleToAccountAction()
action.roleUuid = "b7a901c45db33f12993c9c7aad874ff4"
action.accountUuid = "053a25bbfe2c34a889d75601e64d4a51"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AttachRoleToAccountAction.Result res = action.call()

从账户卸载角色(DetachRoleFromAccount)

API请求

URLs
DELETE zstack/v1/identities/accounts/{accountUuid}/roles/{roleUuid}?deleteMode={deleteMode}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/identities/accounts/ac3ea9154a603cbcabbb1664dbcf66ef/roles/ca3f332b7ffd347fa30ba01be1176b96?deleteMode=Permissive
参数列表
名字 类型 位置 描述 可选值 起始版本
roleUuid String url 0.6
accountUuid String url 账户UUID 0.6
deleteMode (可选) String url 0.6
systemTags (可选) List body 0.6
userTags (可选) List body 0.6

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK示例

Java SDK
DetachRoleFromAccountAction action = new DetachRoleFromAccountAction();
action.roleUuid = "ca3f332b7ffd347fa30ba01be1176b96";
action.accountUuid = "ac3ea9154a603cbcabbb1664dbcf66ef";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DetachRoleFromAccountAction.Result res = action.call();
Python SDK
DetachRoleFromAccountAction action = DetachRoleFromAccountAction()
action.roleUuid = "ca3f332b7ffd347fa30ba01be1176b96"
action.accountUuid = "ac3ea9154a603cbcabbb1664dbcf66ef"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DetachRoleFromAccountAction.Result res = action.call()

获取IAM2用户API权限(GetIAM2VirtualIDAPIPermission)

API请求

URLs
GET zstack/v1/iam2/virtual-ids/api-permissions
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/iam2/virtual-ids/api-permissions?apisToCheck={"apiName":"org.zstack.header.vm.APICreateVmInstanceMsg","body":{"name":"vm"}}
参数列表
名字 类型 位置 描述 可选值 起始版本
apisToCheck (可选) List query 2.4.0
systemTags (可选) List query 2.4.0
userTags (可选) List query 2.4.0

API返回

返回示例
{
  "permissions": {
    "org.zstack.header.vm.APICreateVmInstanceMsg": {
      "allow": true
    }
  },
  "noPermission": false
}
名字 类型 描述 起始版本
noPermission boolean 2.4.0
success boolean 2.4.0
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 2.4.0
permissions Map 详情参考permissions 2.4.0
error ErrorCode 详情参考error 2.4.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#permissions
名字 类型 描述 起始版本
allow boolean 是否有权限 2.4.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6

SDK示例

Java SDK
GetIAM2VirtualIDAPIPermissionAction action = new GetIAM2VirtualIDAPIPermissionAction();
action.apisToCheck = asList("{"apiName":"org.zstack.header.vm.APICreateVmInstanceMsg","body":{"name":"vm"}}");
action.onlyCheckParams = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetIAM2VirtualIDAPIPermissionAction.Result res = action.call();
Python SDK
GetIAM2VirtualIDAPIPermissionAction action = GetIAM2VirtualIDAPIPermissionAction()
action.apisToCheck = [{"apiName":"org.zstack.header.vm.APICreateVmInstanceMsg","body":{"name":"vm"}}]
action.onlyCheckParams = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetIAM2VirtualIDAPIPermissionAction.Result res = action.call()

切换平台角色(LoginIAM2Platform)

API请求

URLs
PUT zstack/v1/iam2/platform/login
Body
{
  "loginIAM2Platform": {},
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"loginIAM2Platform":{}}' http://localhost:8080/zstack/v1/iam2/platform/login
参数列表
名字 类型 位置 描述 可选值 起始版本
clientInfo (可选) Map body(包含在loginIAM2Platform结构中) 4.0.0
systemTags (可选) List body 系统标签 4.0.0
userTags (可选) List body 系统标签 4.0.0

API返回

返回示例
{
  "inventory": {
    "uuid": "243138fdb96e37d785ff4bfe01484b75",
    "noSessionEvaluation": false
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 4.0.0
inventory SessionInventory 详情参考inventory 4.0.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 4.0.0
description String 错误的概要描述 4.0.0
details String 错误的详细信息 4.0.0
elaboration String 保留字段,默认为null 4.0.0
opaque LinkedHashMap 保留字段,默认为null 4.0.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 4.0.0
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 4.0.0
accountUuid String 账户UUID 4.0.0
userUuid String 用户UUID 4.0.0
expiredDate Timestamp 4.0.0
createDate Timestamp 创建时间 4.0.0

SDK示例

Java SDK
LoginIAM2PlatformAction action = new LoginIAM2PlatformAction();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
LoginIAM2PlatformAction.Result res = action.call();
Python SDK
LoginIAM2PlatformAction action = LoginIAM2PlatformAction()
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
LoginIAM2PlatformAction.Result res = action.call()
开发手册 | 4.8.38 | ZStack Cloud · ZCF | ZStack 资源中心